r340421 - [Tooling] Allow -flto flags and filter out -Wa, flags
Author: chh Date: Wed Aug 22 10:13:40 2018 New Revision: 340421 URL: http://llvm.org/viewvc/llvm-project?rev=340421&view=rev Log: [Tooling] Allow -flto flags and filter out -Wa, flags This change fixes the problem in https://bugs.llvm.org/show_bug.cgi?id=38332 by allowing driver::Action::BackendJobClass to run with the analyzer. Otherwise, such jobs will look up the non-existing compilation database and then run without flags. Also filter out the -Wa,* flags that could be passed to and ignored by the clang compiler. Clang-tidy gives warnings about unused -Wa,* flags. Differential Revision: http://reviews.llvm.org/D51002 Modified: cfe/trunk/lib/Tooling/CompilationDatabase.cpp cfe/trunk/test/Tooling/clang-check-analyzer.cpp Modified: cfe/trunk/lib/Tooling/CompilationDatabase.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/CompilationDatabase.cpp?rev=340421&r1=340420&r2=340421&view=diff == --- cfe/trunk/lib/Tooling/CompilationDatabase.cpp (original) +++ cfe/trunk/lib/Tooling/CompilationDatabase.cpp Wed Aug 22 10:13:40 2018 @@ -218,6 +218,15 @@ private: ArrayRef Arr; }; +// Filter of tools unused flags such as -no-integrated-as and -Wa,*. +// They are not used for syntax checking, and could confuse targets +// which don't support these options. +struct FilterUnusedFlags { + bool operator() (StringRef S) { +return (S == "-no-integrated-as") || S.startswith("-Wa,"); + } +}; + } // namespace /// Strips any positional args and possible argv[0] from a command-line @@ -275,10 +284,7 @@ static bool stripPositionalArgs(std::vec // up with no jobs but then this is the user's fault. Args.push_back("placeholder.cpp"); - // Remove -no-integrated-as; it's not used for syntax checking, - // and it confuses targets which don't support this option. - Args.erase(std::remove_if(Args.begin(), Args.end(), -MatchesAny(std::string("-no-integrated-as"))), + Args.erase(std::remove_if(Args.begin(), Args.end(), FilterUnusedFlags()), Args.end()); const std::unique_ptr Compilation( @@ -291,9 +297,11 @@ static bool stripPositionalArgs(std::vec CompileJobAnalyzer CompileAnalyzer; for (const auto &Cmd : Jobs) { -// Collect only for Assemble and Compile jobs. If we do all jobs we get -// duplicates since Link jobs point to Assemble jobs as inputs. +// Collect only for Assemble, Backend, and Compile jobs. If we do all jobs +// we get duplicates since Link jobs point to Assemble jobs as inputs. +// -flto* flags make the BackendJobClass, which still needs analyzer. if (Cmd.getSource().getKind() == driver::Action::AssembleJobClass || +Cmd.getSource().getKind() == driver::Action::BackendJobClass || Cmd.getSource().getKind() == driver::Action::CompileJobClass) { CompileAnalyzer.run(&Cmd.getSource()); } Modified: cfe/trunk/test/Tooling/clang-check-analyzer.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Tooling/clang-check-analyzer.cpp?rev=340421&r1=340420&r2=340421&view=diff == --- cfe/trunk/test/Tooling/clang-check-analyzer.cpp (original) +++ cfe/trunk/test/Tooling/clang-check-analyzer.cpp Wed Aug 22 10:13:40 2018 @@ -1,4 +1,7 @@ // RUN: clang-check -analyze "%s" -- -c 2>&1 | FileCheck %s +// RUN: clang-check -analyze "%s" -- -c -flto -Wa,--noexecstack 2>&1 | FileCheck %s +// RUN: clang-check -analyze "%s" -- -c -no-integrated-as -flto=thin 2>&1 | FileCheck %s +// RUN: clang-check -analyze "%s" -- -c -flto=full 2>&1 | FileCheck %s // CHECK: Dereference of null pointer void a(int *x) { if(x){} *x = 47; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r314264 - [clang-format] Adjust space around &/&& of structured bindings
Author: chh Date: Tue Sep 26 17:58:45 2017 New Revision: 314264 URL: http://llvm.org/viewvc/llvm-project?rev=314264&view=rev Log: [clang-format] Adjust space around &/&& of structured bindings Keep space before or after the &/&& tokens, but not both. For example, auto [x,y] = a; auto &[xr, yr] = a; // LLVM style auto& [xr, yr] = a; // google style Differential Revision:https://reviews.llvm.org/D35743 Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp cfe/trunk/unittests/Format/FormatTest.cpp Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=314264&r1=314263&r2=314264&view=diff == --- cfe/trunk/lib/Format/TokenAnnotator.cpp (original) +++ cfe/trunk/lib/Format/TokenAnnotator.cpp Tue Sep 26 17:58:45 2017 @@ -342,10 +342,10 @@ private: bool ColonFound = false; unsigned BindingIncrease = 1; -if (Left->is(TT_Unknown)) { - if (Left->isCppStructuredBinding(Style)) { -Left->Type = TT_StructuredBindingLSquare; - } else if (StartsObjCMethodExpr) { +if (Left->isCppStructuredBinding(Style)) { + Left->Type = TT_StructuredBindingLSquare; +} else if (Left->is(TT_Unknown)) { + if (StartsObjCMethodExpr) { Left->Type = TT_ObjCMethodExpr; } else if (Style.Language == FormatStyle::LK_JavaScript && Parent && Contexts.back().ContextKind == tok::l_brace && @@ -2515,6 +2515,14 @@ bool TokenAnnotator::spaceRequiredBefore TT_TemplateOpener)); if ((Left.is(TT_TemplateOpener)) != (Right.is(TT_TemplateCloser))) return Style.SpacesInAngles; + // Space before TT_StructuredBindingLSquare. + if (Right.is(TT_StructuredBindingLSquare)) +return !Left.isOneOf(tok::amp, tok::ampamp) || + Style.PointerAlignment != FormatStyle::PAS_Right; + // Space before & or && following a TT_StructuredBindingLSquare. + if (Right.Next && Right.Next->is(TT_StructuredBindingLSquare) && + Right.isOneOf(tok::amp, tok::ampamp)) +return Style.PointerAlignment != FormatStyle::PAS_Left; if ((Right.is(TT_BinaryOperator) && !Left.is(tok::l_paren)) || (Left.isOneOf(TT_BinaryOperator, TT_ConditionalExpr) && !Right.is(tok::r_paren))) Modified: cfe/trunk/unittests/Format/FormatTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=314264&r1=314263&r2=314264&view=diff == --- cfe/trunk/unittests/Format/FormatTest.cpp (original) +++ cfe/trunk/unittests/Format/FormatTest.cpp Tue Sep 26 17:58:45 2017 @@ -11579,24 +11579,59 @@ TEST_F(FormatTest, StructuredBindings) { EXPECT_EQ("auto const volatile [a, b] = f();", format("auto const volatile[a, b] = f();")); EXPECT_EQ("auto [a, b, c] = f();", format("auto [ a , b,c ] = f();")); - EXPECT_EQ("auto & [a, b, c] = f();", + EXPECT_EQ("auto &[a, b, c] = f();", format("auto &[ a , b,c ] = f();")); - EXPECT_EQ("auto && [a, b, c] = f();", + EXPECT_EQ("auto &&[a, b, c] = f();", format("auto &&[ a , b,c ] = f();")); - EXPECT_EQ("auto const & [a, b] = f();", format("auto const&[a, b] = f();")); - EXPECT_EQ("auto const volatile && [a, b] = f();", + EXPECT_EQ("auto const &[a, b] = f();", format("auto const&[a, b] = f();")); + EXPECT_EQ("auto const volatile &&[a, b] = f();", format("auto const volatile &&[a, b] = f();")); - EXPECT_EQ("auto && [a, b] = f();", format("auto &&[a, b] = f();")); + EXPECT_EQ("auto const &&[a, b] = f();", format("auto const && [a, b] = f();")); + EXPECT_EQ("const auto &[a, b] = f();", format("const auto & [a, b] = f();")); + EXPECT_EQ("const auto volatile &&[a, b] = f();", +format("const auto volatile &&[a, b] = f();")); + EXPECT_EQ("volatile const auto &&[a, b] = f();", +format("volatile const auto &&[a, b] = f();")); + EXPECT_EQ("const auto &&[a, b] = f();", format("const auto && [a, b] = f();")); // Make sure we don't mistake structured bindings for lambdas. - verifyFormat("auto [a, b]{A * i};"); - verifyFormat("auto const [a, b]{A * i};"); - verifyFormat("auto const && [a, b]{A * i};"); + FormatStyle PointerMiddle = getLLVMStyle(); + PointerMiddle.PointerAlignment = FormatStyle::PAS_Middle; + verifyFormat("auto [a1, b]{A * i};", getGoogleStyle()); + verifyFormat("auto [a2, b]{A * i};", getLLVMStyle()); + verifyFormat("auto [a3, b]{A * i};", PointerMiddle); + verifyFormat("auto const [a1, b]{A * i};", getGoogleStyle()); + verifyFormat("auto const [a2, b]{A * i};", getLLVMStyle()); + verifyFormat("auto const [a3, b]{A * i};", PointerMiddle); + verifyFormat("auto const& [a1, b]{A * i};", getGoogleStyle()); + verifyFormat("auto const &[a2, b]{A * i};", getLLVMStyle()); + verifyFormat("auto const & [a
r326499 - [Driver] Pass -f[no-]emulated-tls and set up ExplicitEmulatedTLS
Author: chh Date: Thu Mar 1 14:26:19 2018 New Revision: 326499 URL: http://llvm.org/viewvc/llvm-project?rev=326499&view=rev Log: [Driver] Pass -f[no-]emulated-tls and set up ExplicitEmulatedTLS Since LLVM r326341, default EmulatedTLS mode is decided in backend according to target triple. Any front-end should pass -f[no]-emulated-tls to backend and set up ExplicitEmulatedTLS only when the flags are used. Differential Revision: https://reviews.llvm.org/D43965 Modified: cfe/trunk/include/clang/Driver/Options.td cfe/trunk/include/clang/Frontend/CodeGenOptions.def cfe/trunk/lib/CodeGen/BackendUtil.cpp cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/test/Driver/emulated-tls.cpp Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=326499&r1=326498&r2=326499&view=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Thu Mar 1 14:26:19 2018 @@ -815,7 +815,7 @@ def femit_all_decls : Flag<["-"], "femit HelpText<"Emit all declarations, even if unused">; def femulated_tls : Flag<["-"], "femulated-tls">, Group, Flags<[CC1Option]>, HelpText<"Use emutls functions to access thread_local variables">; -def fno_emulated_tls : Flag<["-"], "fno-emulated-tls">, Group; +def fno_emulated_tls : Flag<["-"], "fno-emulated-tls">, Group, Flags<[CC1Option]>; def fencoding_EQ : Joined<["-"], "fencoding=">, Group; def ferror_limit_EQ : Joined<["-"], "ferror-limit=">, Group, Flags<[CoreOption]>; def fexceptions : Flag<["-"], "fexceptions">, Group, Flags<[CC1Option]>, Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=326499&r1=326498&r2=326499&view=diff == --- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original) +++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Thu Mar 1 14:26:19 2018 @@ -69,7 +69,8 @@ CODEGENOPT(EmitDeclMetadata , 1, 0) /// CODEGENOPT(EmitGcovArcs , 1, 0) ///< Emit coverage data files, aka. GCDA. CODEGENOPT(EmitGcovNotes , 1, 0) ///< Emit coverage "notes" files, aka GCNO. CODEGENOPT(EmitOpenCLArgMetadata , 1, 0) ///< Emit OpenCL kernel arg metadata. -CODEGENOPT(EmulatedTLS , 1, 0) ///< Set when -femulated-tls is enabled. +CODEGENOPT(EmulatedTLS , 1, 0) ///< Set by default or -f[no-]emulated-tls. +CODEGENOPT(ExplicitEmulatedTLS , 1, 0) ///< Set if -f[no-]emulated-tls is used. /// \brief Embed Bitcode mode (off/all/bitcode/marker). ENUM_CODEGENOPT(EmbedBitcode, EmbedBitcodeKind, 2, Embed_Off) CODEGENOPT(ForbidGuardVariables , 1, 0) ///< Issue errors if C++ guard variables Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=326499&r1=326498&r2=326499&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu Mar 1 14:26:19 2018 @@ -433,6 +433,7 @@ static void initTargetOptions(llvm::Targ Options.DataSections = CodeGenOpts.DataSections; Options.UniqueSectionNames = CodeGenOpts.UniqueSectionNames; Options.EmulatedTLS = CodeGenOpts.EmulatedTLS; + Options.ExplicitEmulatedTLS = CodeGenOpts.ExplicitEmulatedTLS; Options.DebuggerTuning = CodeGenOpts.getDebuggerTuning(); Options.EmitStackSizeSection = CodeGenOpts.StackSizeSection; Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=326499&r1=326498&r2=326499&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Thu Mar 1 14:26:19 2018 @@ -3937,13 +3937,9 @@ void Clang::ConstructJob(Compilation &C, Args.AddLastArg(CmdArgs, options::OPT_femit_all_decls); Args.AddLastArg(CmdArgs, options::OPT_fheinous_gnu_extensions); Args.AddLastArg(CmdArgs, options::OPT_fno_operator_names); - // Emulated TLS is enabled by default on Android and OpenBSD, and can be enabled - // manually with -femulated-tls. - bool EmulatedTLSDefault = Triple.isAndroid() || Triple.isOSOpenBSD() || -Triple.isWindowsCygwinEnvironment(); - if (Args.hasFlag(options::OPT_femulated_tls, options::OPT_fno_emulated_tls, - EmulatedTLSDefault)) -CmdArgs.push_back("-femulated-tls"); + Args.AddLastArg(CmdArgs, options::OPT_femulated_tls, + options::OPT_fno_emulated_tls); + // AltiVec-like language extensions aren't relevant for assembling. if (!isa(JA) || Ou
Re: [PATCH] D45454: Make __gcov_flush visible outside a shared library
Should we have two versions of `__gcov_flush`? One version is visible outside a .so file, we use dlsym to find and call it to dump profile data of .so files, like Android. One version is hidden and must be called from another wrapper function in a .so file. An application that wants to flush .so file profile data will need to call those wrapper functions. On Wed, Apr 11, 2018 at 12:31 PM, Xinliang David Li wrote: > > > On Wed, Apr 11, 2018 at 11:31 AM, Chih-Hung Hsieh via Phabricator via > llvm-commits wrote: > >> chh added a comment. >> >> Yes, calling `__gcov_flush` within .so files are different, >> but it's a revert of https://reviews.llvm.org/D38124. >> I think https://bugs.llvm.org/show_bug.cgi?id=27224 >> can be fixed by hiding only llvm_gcda_* functions, >> without any change to `__gcov_flush`. >> >> > The coverage dumping behavior for shared libraries (not dlopened) was also > wrong before D38124. D38124 fixed the crash as well as the dumping bug. > > David > > > > > >> (1) Before https://reviews.llvm.org/D38124: >> >> - Calling `__gcov_flush` within .so or main function dumps to main gcda >> file. >> - Android's dlsym() lookup/call of `__gcov_flush` dumps to .so file >> specific gcda files. >> >> (2) After https://reviews.llvm.org/D38124: >> >> - Android's dlsym() cannot find/call `__gcov_flush`. >> - Calling `__gcov_flush` from main works as in (1). >> - Calling `__gcov_flush` from .so works differently; it will dump to .so >> specific gcda file, not the main one. >> >> (3) With this change, we revert `__gcov_flush` behavior back to (1). >> >> Is there any application that needs to call `__gcov_flush` within .so >> and expects the output to .so specific gcda file like in (2)? >> I think the behavior of (1) is more desirable. >> If a main program wants to dump to .so specific gcda file, like Android, >> it can use dlsym() to look up .so specific `__gcov_flush`. >> >> >> https://reviews.llvm.org/D45454 >> >> >> >> ___ >> llvm-commits mailing list >> llvm-comm...@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits >> > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r310858 - [clang-tidy] Add a close-on-exec check on dup() in Android module.
Author: chh Date: Mon Aug 14 10:04:16 2017 New Revision: 310858 URL: http://llvm.org/viewvc/llvm-project?rev=310858&view=rev Log: [clang-tidy] Add a close-on-exec check on dup() in Android module. Summary: dup() is better to be replaced by fcntl() to avoid file descriptor leakage. Differential Revision: https://reviews.llvm.org/D35364 Added: clang-tools-extra/trunk/clang-tidy/android/CloexecDupCheck.cpp clang-tools-extra/trunk/clang-tidy/android/CloexecDupCheck.h clang-tools-extra/trunk/docs/clang-tidy/checks/android-cloexec-dup.rst clang-tools-extra/trunk/test/clang-tidy/android-cloexec-dup.cpp Modified: clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.h clang-tools-extra/trunk/docs/ReleaseNotes.rst clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst Modified: clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp?rev=310858&r1=310857&r2=310858&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp Mon Aug 14 10:04:16 2017 @@ -11,6 +11,7 @@ #include "../ClangTidyModule.h" #include "../ClangTidyModuleRegistry.h" #include "CloexecCreatCheck.h" +#include "CloexecDupCheck.h" #include "CloexecFopenCheck.h" #include "CloexecMemfdCreateCheck.h" #include "CloexecOpenCheck.h" @@ -27,6 +28,7 @@ class AndroidModule : public ClangTidyMo public: void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { CheckFactories.registerCheck("android-cloexec-creat"); +CheckFactories.registerCheck("android-cloexec-dup"); CheckFactories.registerCheck("android-cloexec-fopen"); CheckFactories.registerCheck( "android-cloexec-memfd-create"); Modified: clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt?rev=310858&r1=310857&r2=310858&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt Mon Aug 14 10:04:16 2017 @@ -4,6 +4,7 @@ add_clang_library(clangTidyAndroidModule AndroidTidyModule.cpp CloexecCheck.cpp CloexecCreatCheck.cpp + CloexecDupCheck.cpp CloexecFopenCheck.cpp CloexecMemfdCreateCheck.cpp CloexecOpenCheck.cpp Modified: clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp?rev=310858&r1=310857&r2=310858&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp Mon Aug 14 10:04:16 2017 @@ -100,6 +100,15 @@ void CloexecCheck::insertStringFlag( ReplacementText); } +StringRef CloexecCheck::getSpellingArg(const MatchFinder::MatchResult &Result, + int N) const { + const auto *MatchedCall = Result.Nodes.getNodeAs(FuncBindingStr); + const SourceManager &SM = *Result.SourceManager; + return Lexer::getSourceText( + CharSourceRange::getTokenRange(MatchedCall->getArg(N)->getSourceRange()), + SM, Result.Context->getLangOpts()); +} + } // namespace android } // namespace tidy } // namespace clang Modified: clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.h?rev=310858&r1=310857&r2=310858&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.h (original) +++ clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.h Mon Aug 14 10:04:16 2017 @@ -86,6 +86,10 @@ protected: /// \param ArgPos The 0-based position of the flag argument. void insertStringFlag(const ast_matchers::MatchFinder::MatchResult &Result, const char Mode, const int ArgPos); + + /// Helper function to get the spelling of a particular argument. + StringRef getSpellingArg(const ast_matchers::MatchFinder::MatchResult &Result, + int N) const; }; } // namespace android Added: clang-tools-extra/trunk/clang-tidy/android/CloexecDupCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecDupCheck.cpp?rev=310858&view=auto ===
[clang-tools-extra] r310861 - [clang-tidy] Add a close-on-exec check on inotify_init() in Android module.
Author: chh Date: Mon Aug 14 10:25:41 2017 New Revision: 310861 URL: http://llvm.org/viewvc/llvm-project?rev=310861&view=rev Log: [clang-tidy] Add a close-on-exec check on inotify_init() in Android module. Summary: inotify_init() is better to be replaced by inotify_init1() with IN_CLOEXEC flag to avoid file descriptor leakage. Differential Revision: https://reviews.llvm.org/D35370 Added: clang-tools-extra/trunk/clang-tidy/android/CloexecInotifyInitCheck.cpp clang-tools-extra/trunk/clang-tidy/android/CloexecInotifyInitCheck.h clang-tools-extra/trunk/docs/clang-tidy/checks/android-cloexec-inotify-init.rst clang-tools-extra/trunk/test/clang-tidy/android-cloexec-inotify-init.cpp Modified: clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt clang-tools-extra/trunk/docs/ReleaseNotes.rst clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst Modified: clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp?rev=310861&r1=310860&r2=310861&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp Mon Aug 14 10:25:41 2017 @@ -13,6 +13,7 @@ #include "CloexecCreatCheck.h" #include "CloexecDupCheck.h" #include "CloexecFopenCheck.h" +#include "CloexecInotifyInitCheck.h" #include "CloexecMemfdCreateCheck.h" #include "CloexecOpenCheck.h" #include "CloexecSocketCheck.h" @@ -30,6 +31,8 @@ public: CheckFactories.registerCheck("android-cloexec-creat"); CheckFactories.registerCheck("android-cloexec-dup"); CheckFactories.registerCheck("android-cloexec-fopen"); +CheckFactories.registerCheck( +"android-cloexec-inotify-init"); CheckFactories.registerCheck( "android-cloexec-memfd-create"); CheckFactories.registerCheck("android-cloexec-open"); Modified: clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt?rev=310861&r1=310860&r2=310861&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt Mon Aug 14 10:25:41 2017 @@ -6,6 +6,7 @@ add_clang_library(clangTidyAndroidModule CloexecCreatCheck.cpp CloexecDupCheck.cpp CloexecFopenCheck.cpp + CloexecInotifyInitCheck.cpp CloexecMemfdCreateCheck.cpp CloexecOpenCheck.cpp CloexecSocketCheck.cpp Added: clang-tools-extra/trunk/clang-tidy/android/CloexecInotifyInitCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecInotifyInitCheck.cpp?rev=310861&view=auto == --- clang-tools-extra/trunk/clang-tidy/android/CloexecInotifyInitCheck.cpp (added) +++ clang-tools-extra/trunk/clang-tidy/android/CloexecInotifyInitCheck.cpp Mon Aug 14 10:25:41 2017 @@ -0,0 +1,34 @@ +//===--- CloexecInotifyInitCheck.cpp - clang-tidy--===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "CloexecInotifyInitCheck.h" +#include "clang/AST/ASTContext.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" + +using namespace clang::ast_matchers; + +namespace clang { +namespace tidy { +namespace android { + +void CloexecInotifyInitCheck::registerMatchers(MatchFinder *Finder) { + registerMatchersImpl( + Finder, functionDecl(returns(isInteger()), hasName("inotify_init"))); +} + +void CloexecInotifyInitCheck::check(const MatchFinder::MatchResult &Result) { + replaceFunc(Result, /*WarningMsg=*/ + "prefer inotify_init() to inotify_init1() " + "because inotify_init1() allows IN_CLOEXEC", + /*FixMsg=*/"inotify_init1(IN_CLOEXEC)"); +} + +} // namespace android +} // namespace tidy +} // namespace clang Added: clang-tools-extra/trunk/clang-tidy/android/CloexecInotifyInitCheck.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecInotifyInitCheck.h?rev=310861&view=auto == --- clang-tools-extra/trunk/clang-tidy/android/CloexecInotifyInitCheck.h (added) +++ clang-tools-extra/trunk/clang-tidy/android/CloexecInotifyInitCheck.h Mon Aug 14 10:25:41 2017 @@ -0,0 +1,35 @@ +//===--- CloexecInotifyInitCheck.h - clang-tidy--*- C++ -*-===// +// +//
[clang-tools-extra] r310863 - [clang-tidy] Add a close-on-exec check on inotify_init1() in Android module.
Author: chh Date: Mon Aug 14 10:45:48 2017 New Revision: 310863 URL: http://llvm.org/viewvc/llvm-project?rev=310863&view=rev Log: [clang-tidy] Add a close-on-exec check on inotify_init1() in Android module. Summary: inotify_init1() is better to set IN_CLOEXEC flag to avoid file descriptor leakage. Differential Revision: https://reviews.llvm.org/D35368 Added: clang-tools-extra/trunk/clang-tidy/android/CloexecInotifyInit1Check.cpp clang-tools-extra/trunk/clang-tidy/android/CloexecInotifyInit1Check.h clang-tools-extra/trunk/docs/clang-tidy/checks/android-cloexec-inotify-init1.rst clang-tools-extra/trunk/test/clang-tidy/android-cloexec-inotify-init1.cpp Modified: clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt clang-tools-extra/trunk/docs/ReleaseNotes.rst clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst Modified: clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp?rev=310863&r1=310862&r2=310863&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp Mon Aug 14 10:45:48 2017 @@ -13,6 +13,7 @@ #include "CloexecCreatCheck.h" #include "CloexecDupCheck.h" #include "CloexecFopenCheck.h" +#include "CloexecInotifyInit1Check.h" #include "CloexecInotifyInitCheck.h" #include "CloexecMemfdCreateCheck.h" #include "CloexecOpenCheck.h" @@ -33,6 +34,8 @@ public: CheckFactories.registerCheck("android-cloexec-fopen"); CheckFactories.registerCheck( "android-cloexec-inotify-init"); +CheckFactories.registerCheck( +"android-cloexec-inotify-init1"); CheckFactories.registerCheck( "android-cloexec-memfd-create"); CheckFactories.registerCheck("android-cloexec-open"); Modified: clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt?rev=310863&r1=310862&r2=310863&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt Mon Aug 14 10:45:48 2017 @@ -6,6 +6,7 @@ add_clang_library(clangTidyAndroidModule CloexecCreatCheck.cpp CloexecDupCheck.cpp CloexecFopenCheck.cpp + CloexecInotifyInit1Check.cpp CloexecInotifyInitCheck.cpp CloexecMemfdCreateCheck.cpp CloexecOpenCheck.cpp Added: clang-tools-extra/trunk/clang-tidy/android/CloexecInotifyInit1Check.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecInotifyInit1Check.cpp?rev=310863&view=auto == --- clang-tools-extra/trunk/clang-tidy/android/CloexecInotifyInit1Check.cpp (added) +++ clang-tools-extra/trunk/clang-tidy/android/CloexecInotifyInit1Check.cpp Mon Aug 14 10:45:48 2017 @@ -0,0 +1,33 @@ +//===--- CloexecInotifyInit1Check.cpp - clang-tidy-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "CloexecInotifyInit1Check.h" +#include "../utils/ASTUtils.h" +#include "clang/AST/ASTContext.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" + +using namespace clang::ast_matchers; + +namespace clang { +namespace tidy { +namespace android { + +void CloexecInotifyInit1Check::registerMatchers(MatchFinder *Finder) { + registerMatchersImpl( + Finder, functionDecl(returns(isInteger()), hasName("inotify_init1"), + hasParameter(0, hasType(isInteger(); +} + +void CloexecInotifyInit1Check::check(const MatchFinder::MatchResult &Result) { + insertMacroFlag(Result, /*MarcoFlag=*/"IN_CLOEXEC", /*ArgPos=*/0); +} + +} // namespace android +} // namespace tidy +} // namespace clang Added: clang-tools-extra/trunk/clang-tidy/android/CloexecInotifyInit1Check.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecInotifyInit1Check.h?rev=310863&view=auto == --- clang-tools-extra/trunk/clang-tidy/android/CloexecInotifyInit1Check.h (added) +++ clang-tools-extra/trunk/clang-tidy/android/CloexecInotifyInit1Check.h Mon Aug 14 10:45:48 2017 @@ -0,0 +1,35 @@ +//===--- CloexecInotifyInit1Check.h - clang-tidy-*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the Unive
[clang-tools-extra] r311020 - [clang-tidy] Use CloexecCheck as base class.
Author: chh Date: Wed Aug 16 09:59:26 2017 New Revision: 311020 URL: http://llvm.org/viewvc/llvm-project?rev=311020&view=rev Log: [clang-tidy] Use CloexecCheck as base class. Summary: Simplify registerMatchers and check functions in CloexecCreatCheck, CloexecSocketCheck, CloexecFopenCheck, and CloexecOpenCheck. Differential Revision: https://reviews.llvm.org/D36761 Modified: clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.h clang-tools-extra/trunk/clang-tidy/android/CloexecCreatCheck.cpp clang-tools-extra/trunk/clang-tidy/android/CloexecCreatCheck.h clang-tools-extra/trunk/clang-tidy/android/CloexecFopenCheck.cpp clang-tools-extra/trunk/clang-tidy/android/CloexecFopenCheck.h clang-tools-extra/trunk/clang-tidy/android/CloexecOpenCheck.cpp clang-tools-extra/trunk/clang-tidy/android/CloexecOpenCheck.h clang-tools-extra/trunk/clang-tidy/android/CloexecSocketCheck.cpp clang-tools-extra/trunk/clang-tidy/android/CloexecSocketCheck.h Modified: clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp?rev=311020&r1=311019&r2=311020&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp Wed Aug 16 09:59:26 2017 @@ -20,10 +20,6 @@ namespace tidy { namespace android { namespace { - -const char *const FuncDeclBindingStr = "funcDecl"; -const char *const FuncBindingStr = "func"; - // Helper function to form the correct string mode for Type3. // Build the replace text. If it's string constant, add directly in the // end of the string. Else, add . @@ -41,6 +37,10 @@ std::string buildFixMsgForStringFlag(con } } // namespace +constexpr char CloexecCheck::FuncDeclBindingStr[]; + +constexpr char CloexecCheck::FuncBindingStr[]; + void CloexecCheck::registerMatchersImpl( MatchFinder *Finder, internal::Matcher Function) { // We assume all the checked APIs are C functions. Modified: clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.h?rev=311020&r1=311019&r2=311020&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.h (original) +++ clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.h Wed Aug 16 09:59:26 2017 @@ -90,6 +90,12 @@ protected: /// Helper function to get the spelling of a particular argument. StringRef getSpellingArg(const ast_matchers::MatchFinder::MatchResult &Result, int N) const; + + /// Binding name of the FuncDecl of a function call. + static constexpr char FuncDeclBindingStr[] = "funcDecl"; + + /// Binding name of the function call expression. + static constexpr char FuncBindingStr[] = "func"; }; } // namespace android Modified: clang-tools-extra/trunk/clang-tidy/android/CloexecCreatCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecCreatCheck.cpp?rev=311020&r1=311019&r2=311020&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/CloexecCreatCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/android/CloexecCreatCheck.cpp Wed Aug 16 09:59:26 2017 @@ -10,7 +10,6 @@ #include "CloexecCreatCheck.h" #include "clang/AST/ASTContext.h" #include "clang/ASTMatchers/ASTMatchFinder.h" -#include "clang/Lex/Lexer.h" using namespace clang::ast_matchers; @@ -21,37 +20,22 @@ namespace android { void CloexecCreatCheck::registerMatchers(MatchFinder *Finder) { auto CharPointerType = hasType(pointerType(pointee(isAnyCharacter(; auto MODETType = hasType(namedDecl(hasName("mode_t"))); - - Finder->addMatcher( - callExpr(callee(functionDecl(isExternC(), returns(isInteger()), - hasName("creat"), - hasParameter(0, CharPointerType), - hasParameter(1, MODETType)) - .bind("funcDecl"))) - .bind("creatFn"), - this); + registerMatchersImpl(Finder, + functionDecl(isExternC(), returns(isInteger()), +hasName("creat"), +hasParameter(0, CharPointerType), +hasParameter(1, MODETType))); } void CloexecCreatCheck::check(const MatchFinder::MatchResult &Result) { - const auto *MatchedCall = Result.Nodes.getNodeAs("creatFn"); - const SourceManager &SM = *Result.SourceManager; - const std::string &ReplacementText = - (Twine("open (") + - Lexer::getSource
[clang-tools-extra] r311024 - [clang-tidy] Add a close-on-exec check on accept() in Android module.
Author: chh Date: Wed Aug 16 10:18:16 2017 New Revision: 311024 URL: http://llvm.org/viewvc/llvm-project?rev=311024&view=rev Log: [clang-tidy] Add a close-on-exec check on accept() in Android module. Summary: accept() is better to be replaced by accept4() with SOCK_CLOEXEC flag to avoid file descriptor leakage. Differential Revision: https://reviews.llvm.org/D35362 Added: clang-tools-extra/trunk/clang-tidy/android/CloexecAcceptCheck.cpp clang-tools-extra/trunk/clang-tidy/android/CloexecAcceptCheck.h clang-tools-extra/trunk/docs/clang-tidy/checks/android-cloexec-accept.rst clang-tools-extra/trunk/test/clang-tidy/android-cloexec-accept.cpp Modified: clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt clang-tools-extra/trunk/docs/ReleaseNotes.rst clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst Modified: clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp?rev=311024&r1=311023&r2=311024&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp Wed Aug 16 10:18:16 2017 @@ -10,6 +10,7 @@ #include "../ClangTidy.h" #include "../ClangTidyModule.h" #include "../ClangTidyModuleRegistry.h" +#include "CloexecAcceptCheck.h" #include "CloexecCreatCheck.h" #include "CloexecDupCheck.h" #include "CloexecFopenCheck.h" @@ -29,6 +30,7 @@ namespace android { class AndroidModule : public ClangTidyModule { public: void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { +CheckFactories.registerCheck("android-cloexec-accept"); CheckFactories.registerCheck("android-cloexec-creat"); CheckFactories.registerCheck("android-cloexec-dup"); CheckFactories.registerCheck("android-cloexec-fopen"); Modified: clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt?rev=311024&r1=311023&r2=311024&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt Wed Aug 16 10:18:16 2017 @@ -2,6 +2,7 @@ set(LLVM_LINK_COMPONENTS support) add_clang_library(clangTidyAndroidModule AndroidTidyModule.cpp + CloexecAcceptCheck.cpp CloexecCheck.cpp CloexecCreatCheck.cpp CloexecDupCheck.cpp Added: clang-tools-extra/trunk/clang-tidy/android/CloexecAcceptCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecAcceptCheck.cpp?rev=311024&view=auto == --- clang-tools-extra/trunk/clang-tidy/android/CloexecAcceptCheck.cpp (added) +++ clang-tools-extra/trunk/clang-tidy/android/CloexecAcceptCheck.cpp Wed Aug 16 10:18:16 2017 @@ -0,0 +1,47 @@ +//===--- CloexecAcceptCheck.cpp - clang-tidy---===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "CloexecAcceptCheck.h" +#include "clang/AST/ASTContext.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" + +using namespace clang::ast_matchers; + +namespace clang { +namespace tidy { +namespace android { + +void CloexecAcceptCheck::registerMatchers(MatchFinder *Finder) { + auto SockAddrPointerType = + hasType(pointsTo(recordDecl(isStruct(), hasName("sockaddr"; + auto SockLenPointerType = hasType(pointsTo(namedDecl(hasName("socklen_t"; + + registerMatchersImpl(Finder, + functionDecl(returns(isInteger()), hasName("accept"), +hasParameter(0, hasType(isInteger())), +hasParameter(1, SockAddrPointerType), +hasParameter(2, SockLenPointerType))); +} + +void CloexecAcceptCheck::check(const MatchFinder::MatchResult &Result) { + const std::string &ReplacementText = + (Twine("accept4(") + getSpellingArg(Result, 0) + ", " + + getSpellingArg(Result, 1) + ", " + getSpellingArg(Result, 2) + + ", SOCK_CLOEXEC)") + .str(); + + replaceFunc( + Result, + "prefer accept4() to accept() because accept4() allows SOCK_CLOEXEC", + ReplacementText); +} + +} // namespace android +} // namespace tidy +} // namespace clang Added: clang-tools-extra/trunk/clang-tidy/android/CloexecAcceptCheck.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tid
[clang-tools-extra] r311027 - [clang-tidy] Add a close-on-exec check on accept4() in Android module.
Author: chh Date: Wed Aug 16 10:46:18 2017 New Revision: 311027 URL: http://llvm.org/viewvc/llvm-project?rev=311027&view=rev Log: [clang-tidy] Add a close-on-exec check on accept4() in Android module. Summary: accept4() is better to set SOCK_CLOEXEC flag to avoid file descriptor leakage. Differential Revision: https://reviews.llvm.org/D35363 Added: clang-tools-extra/trunk/clang-tidy/android/CloexecAccept4Check.cpp clang-tools-extra/trunk/clang-tidy/android/CloexecAccept4Check.h clang-tools-extra/trunk/docs/clang-tidy/checks/android-cloexec-accept4.rst clang-tools-extra/trunk/test/clang-tidy/android-cloexec-accept4.cpp Modified: clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt clang-tools-extra/trunk/docs/ReleaseNotes.rst clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst Modified: clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp?rev=311027&r1=311026&r2=311027&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp Wed Aug 16 10:46:18 2017 @@ -10,6 +10,7 @@ #include "../ClangTidy.h" #include "../ClangTidyModule.h" #include "../ClangTidyModuleRegistry.h" +#include "CloexecAccept4Check.h" #include "CloexecAcceptCheck.h" #include "CloexecCreatCheck.h" #include "CloexecDupCheck.h" @@ -30,6 +31,7 @@ namespace android { class AndroidModule : public ClangTidyModule { public: void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { + CheckFactories.registerCheck("android-cloexec-accept4"); CheckFactories.registerCheck("android-cloexec-accept"); CheckFactories.registerCheck("android-cloexec-creat"); CheckFactories.registerCheck("android-cloexec-dup"); Modified: clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt?rev=311027&r1=311026&r2=311027&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt Wed Aug 16 10:46:18 2017 @@ -2,6 +2,7 @@ set(LLVM_LINK_COMPONENTS support) add_clang_library(clangTidyAndroidModule AndroidTidyModule.cpp + CloexecAccept4Check.cpp CloexecAcceptCheck.cpp CloexecCheck.cpp CloexecCreatCheck.cpp Added: clang-tools-extra/trunk/clang-tidy/android/CloexecAccept4Check.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecAccept4Check.cpp?rev=311027&view=auto == --- clang-tools-extra/trunk/clang-tidy/android/CloexecAccept4Check.cpp (added) +++ clang-tools-extra/trunk/clang-tidy/android/CloexecAccept4Check.cpp Wed Aug 16 10:46:18 2017 @@ -0,0 +1,40 @@ +//===--- CloexecAccept4Check.cpp - clang-tidy--===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "CloexecAccept4Check.h" +#include "../utils/ASTUtils.h" +#include "clang/AST/ASTContext.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" + +using namespace clang::ast_matchers; + +namespace clang { +namespace tidy { +namespace android { + +void CloexecAccept4Check::registerMatchers(MatchFinder *Finder) { + auto SockAddrPointerType = + hasType(pointsTo(recordDecl(isStruct(), hasName("sockaddr"; + auto SockLenPointerType = hasType(pointsTo(namedDecl(hasName("socklen_t"; + + registerMatchersImpl(Finder, + functionDecl(returns(isInteger()), hasName("accept4"), +hasParameter(0, hasType(isInteger())), +hasParameter(1, SockAddrPointerType), +hasParameter(2, SockLenPointerType), +hasParameter(3, hasType(isInteger(); +} + +void CloexecAccept4Check::check(const MatchFinder::MatchResult &Result) { + insertMacroFlag(Result, /*MarcoFlag=*/"SOCK_CLOEXEC", /*ArgPos=*/3); +} + +} // namespace android +} // namespace tidy +} // namespace clang Added: clang-tools-extra/trunk/clang-tidy/android/CloexecAccept4Check.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecAccept4Check.h?rev=311027&view=auto == --- clang-tools-extra/trunk/clang-tidy/androi
[clang-tools-extra] r311028 - [clang-tidy] Add a close-on-exec check on epoll_create1() in Android module.
Author: chh Date: Wed Aug 16 10:53:12 2017 New Revision: 311028 URL: http://llvm.org/viewvc/llvm-project?rev=311028&view=rev Log: [clang-tidy] Add a close-on-exec check on epoll_create1() in Android module. Summary: epoll_create1() is better to set EPOLL_CLOEXEC flag to avoid file descriptor leakage. Differential Revision: https://reviews.llvm.org/D35365 Added: clang-tools-extra/trunk/clang-tidy/android/CloexecEpollCreate1Check.cpp clang-tools-extra/trunk/clang-tidy/android/CloexecEpollCreate1Check.h clang-tools-extra/trunk/docs/clang-tidy/checks/android-cloexec-epoll-create1.rst clang-tools-extra/trunk/test/clang-tidy/android-cloexec-epoll-create1.cpp Modified: clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt clang-tools-extra/trunk/docs/ReleaseNotes.rst clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst Modified: clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp?rev=311028&r1=311027&r2=311028&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp Wed Aug 16 10:53:12 2017 @@ -13,6 +13,7 @@ #include "CloexecAccept4Check.h" #include "CloexecAcceptCheck.h" #include "CloexecCreatCheck.h" +#include "CloexecEpollCreate1Check.h" #include "CloexecDupCheck.h" #include "CloexecFopenCheck.h" #include "CloexecInotifyInit1Check.h" @@ -34,6 +35,8 @@ public: CheckFactories.registerCheck("android-cloexec-accept4"); CheckFactories.registerCheck("android-cloexec-accept"); CheckFactories.registerCheck("android-cloexec-creat"); +CheckFactories.registerCheck( +"android-cloexec-epoll-create1"); CheckFactories.registerCheck("android-cloexec-dup"); CheckFactories.registerCheck("android-cloexec-fopen"); CheckFactories.registerCheck( Modified: clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt?rev=311028&r1=311027&r2=311028&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt Wed Aug 16 10:53:12 2017 @@ -6,6 +6,7 @@ add_clang_library(clangTidyAndroidModule CloexecAcceptCheck.cpp CloexecCheck.cpp CloexecCreatCheck.cpp + CloexecEpollCreate1Check.cpp CloexecDupCheck.cpp CloexecFopenCheck.cpp CloexecInotifyInit1Check.cpp Added: clang-tools-extra/trunk/clang-tidy/android/CloexecEpollCreate1Check.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecEpollCreate1Check.cpp?rev=311028&view=auto == --- clang-tools-extra/trunk/clang-tidy/android/CloexecEpollCreate1Check.cpp (added) +++ clang-tools-extra/trunk/clang-tidy/android/CloexecEpollCreate1Check.cpp Wed Aug 16 10:53:12 2017 @@ -0,0 +1,33 @@ +//===--- CloexecEpollCreate1Check.cpp - clang-tidy-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "CloexecEpollCreate1Check.h" +#include "../utils/ASTUtils.h" +#include "clang/AST/ASTContext.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" + +using namespace clang::ast_matchers; + +namespace clang { +namespace tidy { +namespace android { + +void CloexecEpollCreate1Check::registerMatchers(MatchFinder *Finder) { + registerMatchersImpl( + Finder, functionDecl(returns(isInteger()), hasName("epoll_create1"), + hasParameter(0, hasType(isInteger(); +} + +void CloexecEpollCreate1Check::check(const MatchFinder::MatchResult &Result) { + insertMacroFlag(Result, /*MarcoFlag=*/"EPOLL_CLOEXEC", /*ArgPos=*/0); +} + +} // namespace android +} // namespace tidy +} // namespace clang Added: clang-tools-extra/trunk/clang-tidy/android/CloexecEpollCreate1Check.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecEpollCreate1Check.h?rev=311028&view=auto == --- clang-tools-extra/trunk/clang-tidy/android/CloexecEpollCreate1Check.h (added) +++ clang-tools-extra/trunk/clang-tidy/android/CloexecEpollCreate1Check.h Wed Aug 16 10:53:12 2017 @@ -0,0 +1,35 @@ +//===--- CloexecEpollCreate1Check.h - clang-tidy-*- C++ -*-===// +// +// The LLVM Compiler In
[clang-tools-extra] r311029 - [clang-tidy] Add a close-on-exec check on epoll_create() in Android module.
Author: chh Date: Wed Aug 16 11:02:49 2017 New Revision: 311029 URL: http://llvm.org/viewvc/llvm-project?rev=311029&view=rev Log: [clang-tidy] Add a close-on-exec check on epoll_create() in Android module. Summary: epoll_create() is better to be replaced by epoll_create1() with EPOLL_CLOEXEC flag to avoid file descriptor leakage. Differential Revision: https://reviews.llvm.org/D35367 Added: clang-tools-extra/trunk/clang-tidy/android/CloexecEpollCreateCheck.cpp clang-tools-extra/trunk/clang-tidy/android/CloexecEpollCreateCheck.h clang-tools-extra/trunk/docs/clang-tidy/checks/android-cloexec-epoll-create.rst clang-tools-extra/trunk/test/clang-tidy/android-cloexec-epoll-create.cpp Modified: clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt clang-tools-extra/trunk/docs/ReleaseNotes.rst clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst Modified: clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp?rev=311029&r1=311028&r2=311029&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/android/AndroidTidyModule.cpp Wed Aug 16 11:02:49 2017 @@ -14,6 +14,7 @@ #include "CloexecAcceptCheck.h" #include "CloexecCreatCheck.h" #include "CloexecEpollCreate1Check.h" +#include "CloexecEpollCreateCheck.h" #include "CloexecDupCheck.h" #include "CloexecFopenCheck.h" #include "CloexecInotifyInit1Check.h" @@ -37,6 +38,8 @@ public: CheckFactories.registerCheck("android-cloexec-creat"); CheckFactories.registerCheck( "android-cloexec-epoll-create1"); +CheckFactories.registerCheck( +"android-cloexec-epoll-create"); CheckFactories.registerCheck("android-cloexec-dup"); CheckFactories.registerCheck("android-cloexec-fopen"); CheckFactories.registerCheck( Modified: clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt?rev=311029&r1=311028&r2=311029&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/android/CMakeLists.txt Wed Aug 16 11:02:49 2017 @@ -7,6 +7,7 @@ add_clang_library(clangTidyAndroidModule CloexecCheck.cpp CloexecCreatCheck.cpp CloexecEpollCreate1Check.cpp + CloexecEpollCreateCheck.cpp CloexecDupCheck.cpp CloexecFopenCheck.cpp CloexecInotifyInit1Check.cpp Added: clang-tools-extra/trunk/clang-tidy/android/CloexecEpollCreateCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecEpollCreateCheck.cpp?rev=311029&view=auto == --- clang-tools-extra/trunk/clang-tidy/android/CloexecEpollCreateCheck.cpp (added) +++ clang-tools-extra/trunk/clang-tidy/android/CloexecEpollCreateCheck.cpp Wed Aug 16 11:02:49 2017 @@ -0,0 +1,36 @@ +//===--- CloexecEpollCreateCheck.cpp - clang-tidy--===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "CloexecEpollCreateCheck.h" +#include "clang/AST/ASTContext.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" + +using namespace clang::ast_matchers; + +namespace clang { +namespace tidy { +namespace android { + +void CloexecEpollCreateCheck::registerMatchers(MatchFinder *Finder) { + registerMatchersImpl( + Finder, functionDecl(returns(isInteger()), hasName("epoll_create"), + hasParameter(0, hasType(isInteger(); +} + +void CloexecEpollCreateCheck::check(const MatchFinder::MatchResult &Result) { + replaceFunc(Result, + "prefer epoll_create() to epoll_create1() " + "because epoll_create1() allows " + "EPOLL_CLOEXEC", + "epoll_create1(EPOLL_CLOEXEC)"); +} + +} // namespace android +} // namespace tidy +} // namespace clang Added: clang-tools-extra/trunk/clang-tidy/android/CloexecEpollCreateCheck.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecEpollCreateCheck.h?rev=311029&view=auto == --- clang-tools-extra/trunk/clang-tidy/android/CloexecEpollCreateCheck.h (added) +++ clang-tools-extra/trunk/clang-tidy/android/CloexecEpollCreateCheck.h Wed Aug 16 11:02:49 2017 @@ -0,0 +1,35 @@ +//===--- CloexecEpollCreateCheck.h - clang-tidy---
[clang-tools-extra] r311035 - [clang-tidy] Use const char* to compile with VC cl.exe.
Author: chh Date: Wed Aug 16 12:13:35 2017 New Revision: 311035 URL: http://llvm.org/viewvc/llvm-project?rev=311035&view=rev Log: [clang-tidy] Use const char* to compile with VC cl.exe. Summary: cl.exe does not accept constexpr char FuncBindingStr[] = ... Differential Revision: https://reviews.llvm.org/D36761 Modified: clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.h Modified: clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp?rev=311035&r1=311034&r2=311035&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp Wed Aug 16 12:13:35 2017 @@ -37,9 +37,9 @@ std::string buildFixMsgForStringFlag(con } } // namespace -constexpr char CloexecCheck::FuncDeclBindingStr[]; +const char *CloexecCheck::FuncDeclBindingStr = "funcDecl"; -constexpr char CloexecCheck::FuncBindingStr[]; +const char *CloexecCheck::FuncBindingStr ="func"; void CloexecCheck::registerMatchersImpl( MatchFinder *Finder, internal::Matcher Function) { Modified: clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.h?rev=311035&r1=311034&r2=311035&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.h (original) +++ clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.h Wed Aug 16 12:13:35 2017 @@ -92,10 +92,10 @@ protected: int N) const; /// Binding name of the FuncDecl of a function call. - static constexpr char FuncDeclBindingStr[] = "funcDecl"; + static const char *FuncDeclBindingStr; /// Binding name of the function call expression. - static constexpr char FuncBindingStr[] = "func"; + static const char *FuncBindingStr; }; } // namespace android ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r311040 - [clang-tidy] Remove unused static variable.
Author: chh Date: Wed Aug 16 14:00:06 2017 New Revision: 311040 URL: http://llvm.org/viewvc/llvm-project?rev=311040&view=rev Log: [clang-tidy] Remove unused static variable. Differential Revision: https://reviews.llvm.org/D36761 Modified: clang-tools-extra/trunk/clang-tidy/android/CloexecSocketCheck.cpp Modified: clang-tools-extra/trunk/clang-tidy/android/CloexecSocketCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecSocketCheck.cpp?rev=311040&r1=311039&r2=311040&view=diff == --- clang-tools-extra/trunk/clang-tidy/android/CloexecSocketCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/android/CloexecSocketCheck.cpp Wed Aug 16 14:00:06 2017 @@ -17,8 +17,6 @@ namespace clang { namespace tidy { namespace android { -static constexpr const char *SOCK_CLOEXEC = "SOCK_CLOEXEC"; - void CloexecSocketCheck::registerMatchers(MatchFinder *Finder) { registerMatchersImpl(Finder, functionDecl(isExternC(), returns(isInteger()), ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [clang-tools-extra] r311020 - [clang-tidy] Use CloexecCheck as base class.
Thanks. The fix is in https://reviews.llvm.org/rL311040. On Wed, Aug 16, 2017 at 1:39 PM, Evgenii Stepanov wrote: > Hi, > > this change breaks build: > clang-tools-extra/clang-tidy/android/CloexecSocketCheck.cpp:20:30: > error: unused variable 'SOCK_CLOEXEC' > [-Werror,-Wunused-const-variable] > static constexpr const char *SOCK_CLOEXEC = "SOCK_CLOEXEC"; > > Please test with LLVM_ENABLE_WERROR=ON before submitting! > > > On Wed, Aug 16, 2017 at 9:59 AM, Chih-Hung Hsieh via cfe-commits > wrote: > > Author: chh > > Date: Wed Aug 16 09:59:26 2017 > > New Revision: 311020 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=311020&view=rev > > Log: > > [clang-tidy] Use CloexecCheck as base class. > > > > Summary: > > Simplify registerMatchers and check functions in CloexecCreatCheck, > > CloexecSocketCheck, CloexecFopenCheck, and CloexecOpenCheck. > > > > Differential Revision: https://reviews.llvm.org/D36761 > > > > > > Modified: > > clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp > > clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.h > > clang-tools-extra/trunk/clang-tidy/android/CloexecCreatCheck.cpp > > clang-tools-extra/trunk/clang-tidy/android/CloexecCreatCheck.h > > clang-tools-extra/trunk/clang-tidy/android/CloexecFopenCheck.cpp > > clang-tools-extra/trunk/clang-tidy/android/CloexecFopenCheck.h > > clang-tools-extra/trunk/clang-tidy/android/CloexecOpenCheck.cpp > > clang-tools-extra/trunk/clang-tidy/android/CloexecOpenCheck.h > > clang-tools-extra/trunk/clang-tidy/android/CloexecSocketCheck.cpp > > clang-tools-extra/trunk/clang-tidy/android/CloexecSocketCheck.h > > > > Modified: clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp > > URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/ > trunk/clang-tidy/android/CloexecCheck.cpp?rev=311020& > r1=311019&r2=311020&view=diff > > > == > > --- clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp > (original) > > +++ clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp Wed Aug > 16 09:59:26 2017 > > @@ -20,10 +20,6 @@ namespace tidy { > > namespace android { > > > > namespace { > > - > > -const char *const FuncDeclBindingStr = "funcDecl"; > > -const char *const FuncBindingStr = "func"; > > - > > // Helper function to form the correct string mode for Type3. > > // Build the replace text. If it's string constant, add directly > in the > > // end of the string. Else, add . > > @@ -41,6 +37,10 @@ std::string buildFixMsgForStringFlag(con > > } > > } // namespace > > > > +constexpr char CloexecCheck::FuncDeclBindingStr[]; > > + > > +constexpr char CloexecCheck::FuncBindingStr[]; > > + > > void CloexecCheck::registerMatchersImpl( > > MatchFinder *Finder, internal::Matcher Function) { > >// We assume all the checked APIs are C functions. > > > > Modified: clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.h > > URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/ > trunk/clang-tidy/android/CloexecCheck.h?rev=311020&r1= > 311019&r2=311020&view=diff > > > == > > --- clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.h (original) > > +++ clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.h Wed Aug > 16 09:59:26 2017 > > @@ -90,6 +90,12 @@ protected: > >/// Helper function to get the spelling of a particular argument. > >StringRef getSpellingArg(const ast_matchers::MatchFinder::MatchResult > &Result, > > int N) const; > > + > > + /// Binding name of the FuncDecl of a function call. > > + static constexpr char FuncDeclBindingStr[] = "funcDecl"; > > + > > + /// Binding name of the function call expression. > > + static constexpr char FuncBindingStr[] = "func"; > > }; > > > > } // namespace android > > > > Modified: clang-tools-extra/trunk/clang-tidy/android/ > CloexecCreatCheck.cpp > > URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/ > trunk/clang-tidy/android/CloexecCreatCheck.cpp?rev= > 311020&r1=311019&r2=311020&view=diff > > > == > > --- clang-tools-extra/trunk/clang-tidy/android/CloexecCreatCheck.cpp &
[clang-tools-extra] r299119 - [clang-tidy] Reuse FileID in getLocation
Author: chh Date: Thu Mar 30 17:09:17 2017 New Revision: 299119 URL: http://llvm.org/viewvc/llvm-project?rev=299119&view=rev Log: [clang-tidy] Reuse FileID in getLocation One FileID per warning will increase and overflow NextLocalOffset when input file is large with many warnings. Reusing FileID avoids this problem. Differential Revision: http://reviews.llvm.org/D31406 Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp?rev=299119&r1=299118&r2=299119&view=diff == --- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Thu Mar 30 17:09:17 2017 @@ -238,7 +238,7 @@ private: return SourceLocation(); const FileEntry *File = SourceMgr.getFileManager().getFile(FilePath); -FileID ID = SourceMgr.createFileID(File, SourceLocation(), SrcMgr::C_User); +FileID ID = SourceMgr.getOrCreateFileID(File, SrcMgr::C_User); return SourceMgr.getLocForStartOfFile(ID).getLocWithOffset(Offset); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [clang-tools-extra] r299119 - [clang-tidy] Reuse FileID in getLocation
I don't know why this test failed only on Windows, but will revert my change soon. On Thu, Mar 30, 2017 at 6:07 PM, Yung, Douglas wrote: > Hi, this change seems to be causing the test clang-tidy/llvm-include-order.cpp > to fail with a crash on the PS4 Windows bot: > > (From http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_ > 64-scei-ps4-windows10pro-fast/builds/7487) > > TEST 'Clang Tools :: clang-tidy/llvm-include-order.cpp' > FAILED > Script: > -- > C:/Python27/python.exe C:/Buildbot/Slave/llvm-clang-lld-x86_64-scei-ps4- > windows10pro-fast/llvm.src/tools/clang/tools/extra/test/. > ./test\clang-tidy\check_clang_tidy.py C:\Buildbot\Slave\llvm-clang- > lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\ > tools\clang\tools\extra\test\clang-tidy\llvm-include-order.cpp > llvm-include-order C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4- > windows10pro-fast\llvm.obj\tools\clang\tools\extra\test\ > clang-tidy\Output\llvm-include-order.cpp.tmp -- -- -isystem > C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4- > windows10pro-fast\llvm.src\tools\clang\tools\extra\test\ > clang-tidy/Inputs/Headers > -- > Exit Code: 1 > > Command Output (stdout): > -- > $ "C:/Python27/python.exe" "C:/Buildbot/Slave/llvm-clang- > lld-x86_64-scei-ps4-windows10pro-fast/llvm.src/ > tools/clang/tools/extra/test/../test\clang-tidy\check_clang_tidy.py" > "C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4- > windows10pro-fast\llvm.src\tools\clang\tools\extra\test\ > clang-tidy\llvm-include-order.cpp" "llvm-include-order" > "C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4- > windows10pro-fast\llvm.obj\tools\clang\tools\extra\test\ > clang-tidy\Output\llvm-include-order.cpp.tmp" "--" "--" "-isystem" > "C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4- > windows10pro-fast\llvm.src\tools\clang\tools\extra\test\ > clang-tidy/Inputs/Headers" > # command output: > Running ['clang-tidy', 'C:\\Buildbot\\Slave\\llvm- > clang-lld-x86_64-scei-ps4-windows10pro-fast\\llvm.obj\\ > tools\\clang\\tools\\extra\\test\\clang-tidy\\Output\\ > llvm-include-order.cpp.tmp.cpp', '-fix', '--checks=-*,llvm-include-order', > '--', '-isystem', 'C:\\Buildbot\\Slave\\llvm-clang-lld-x86_64-scei-ps4- > windows10pro-fast\\llvm.src\\tools\\clang\\tools\\extra\\ > test\\clang-tidy/Inputs/Headers', '-nostdinc++']... > clang-tidy failed: > 2 warnings generated. > > Assertion failed: EndColNo <= map.getSourceLine().size() && "Invalid > range!", file C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4- > windows10pro-fast\llvm.src\tools\clang\lib\Frontend\TextDiagnostic.cpp, > line 999 > > > > # command stderr: > Traceback (most recent call last): > > File "C:/Buildbot/Slave/llvm-clang-lld-x86_64-scei-ps4- > windows10pro-fast/llvm.src/tools/clang/tools/extra/test/. > ./test\clang-tidy\check_clang_tidy.py", line 140, in > > main() > > File "C:/Buildbot/Slave/llvm-clang-lld-x86_64-scei-ps4- > windows10pro-fast/llvm.src/tools/clang/tools/extra/test/. > ./test\clang-tidy\check_clang_tidy.py", line 96, in main > > subprocess.check_output(args, stderr=subprocess.STDOUT).decode() > > File "C:\Python27\lib\subprocess.py", line 573, in check_output > > raise CalledProcessError(retcode, cmd, output=output) > > subprocess.CalledProcessError: Command '['clang-tidy', > 'C:\\Buildbot\\Slave\\llvm-clang-lld-x86_64-scei-ps4- > windows10pro-fast\\llvm.obj\\tools\\clang\\tools\\extra\\ > test\\clang-tidy\\Output\\llvm-include-order.cpp.tmp.cpp', '-fix', > '--checks=-*,llvm-include-order', '--', '-isystem', > 'C:\\Buildbot\\Slave\\llvm-clang-lld-x86_64-scei-ps4- > windows10pro-fast\\llvm.src\\tools\\clang\\tools\\extra\\ > test\\clang-tidy/Inputs/Headers', '-nostdinc++']' returned non-zero exit > status 255 > > > error: command failed with exit status: 1 > > -- > > > > Can you take a look? > > Douglas Yung > > > -Original Message- > > From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf > Of > > Chih-Hung Hsieh via cfe-commits > > Sent: Thursday, March 30, 2017 15:09 > > To: cfe-commits@lists.llvm.org > > Subject: [clang-tools-extra] r299119 - [clang-tidy] Reuse FileID in > > getLocation > > > > Author: chh > > Date: Thu Mar
[clang-tools-extra] r299146 - [clang-tidy] Revert D31406 (Reuse FileID in getLocation)
Author: chh Date: Thu Mar 30 20:11:11 2017 New Revision: 299146 URL: http://llvm.org/viewvc/llvm-project?rev=299146&view=rev Log: [clang-tidy] Revert D31406 (Reuse FileID in getLocation) Somehow the change failed test clang-tidy/llvm-include-order.cpp on Windows platform. Differential Revision: http://reviews.llvm.org/D31406 Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp?rev=299146&r1=299145&r2=299146&view=diff == --- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Thu Mar 30 20:11:11 2017 @@ -238,7 +238,7 @@ private: return SourceLocation(); const FileEntry *File = SourceMgr.getFileManager().getFile(FilePath); -FileID ID = SourceMgr.getOrCreateFileID(File, SrcMgr::C_User); +FileID ID = SourceMgr.createFileID(File, SourceLocation(), SrcMgr::C_User); return SourceMgr.getLocForStartOfFile(ID).getLocWithOffset(Offset); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r299681 - [Basic] getColumnNumber returns location of CR+LF on Windows
Author: chh Date: Thu Apr 6 13:36:50 2017 New Revision: 299681 URL: http://llvm.org/viewvc/llvm-project?rev=299681&view=rev Log: [Basic] getColumnNumber returns location of CR+LF on Windows When fixing a Clang-Tidy bug in D31406, reuse of FileID enabled the missing highlightRange function. Assertion in highlightRange failed because the end-of-range column number was 2 + the last column of a line on Windows. This fix is required to enable D31406. Differential Revision: https://reviews.llvm.org/D31713 Modified: cfe/trunk/lib/Basic/SourceManager.cpp Modified: cfe/trunk/lib/Basic/SourceManager.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=299681&r1=299680&r2=299681&view=diff == --- cfe/trunk/lib/Basic/SourceManager.cpp (original) +++ cfe/trunk/lib/Basic/SourceManager.cpp Thu Apr 6 13:36:50 2017 @@ -1136,6 +1136,7 @@ unsigned SourceManager::getColumnNumber( return 1; } + const char *Buf = MemBuf->getBufferStart(); // See if we just calculated the line number for this FilePos and can use // that to lookup the start of the line instead of searching for it. if (LastLineNoFileIDQuery == FID && @@ -1144,11 +1145,19 @@ unsigned SourceManager::getColumnNumber( unsigned *SourceLineCache = LastLineNoContentCache->SourceLineCache; unsigned LineStart = SourceLineCache[LastLineNoResult - 1]; unsigned LineEnd = SourceLineCache[LastLineNoResult]; -if (FilePos >= LineStart && FilePos < LineEnd) +if (FilePos >= LineStart && FilePos < LineEnd) { + // LineEnd is the LineStart of the next line. + // A line ends with separator LF or CR+LF on Windows. + // FilePos might point to the last separator, + // but we need a column number at most 1 + the last column. + if (FilePos + 1 == LineEnd && FilePos > LineStart) { +if (Buf[FilePos - 1] == '\r' || Buf[FilePos - 1] == '\n') + --FilePos; + } return FilePos - LineStart + 1; +} } - const char *Buf = MemBuf->getBufferStart(); unsigned LineStart = FilePos; while (LineStart && Buf[LineStart-1] != '\n' && Buf[LineStart-1] != '\r') --LineStart; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r299700 - [clang-tidy] Reuse FileID in getLocation
Author: chh Date: Thu Apr 6 15:19:26 2017 New Revision: 299700 URL: http://llvm.org/viewvc/llvm-project?rev=299700&view=rev Log: [clang-tidy] Reuse FileID in getLocation One FileID per warning will increase and overflow NextLocalOffset when input file is large with many warnings. Reusing FileID avoids this problem. This requires changes in getColumnNumber, D31406, rL299681. Differential Revision: http://reviews.llvm.org/D31406 Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp?rev=299700&r1=299699&r2=299700&view=diff == --- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Thu Apr 6 15:19:26 2017 @@ -239,7 +239,7 @@ private: return SourceLocation(); const FileEntry *File = SourceMgr.getFileManager().getFile(FilePath); -FileID ID = SourceMgr.createFileID(File, SourceLocation(), SrcMgr::C_User); +FileID ID = SourceMgr.getOrCreateFileID(File, SrcMgr::C_User); return SourceMgr.getLocForStartOfFile(ID).getLocWithOffset(Offset); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r307809 - [clang] buildFixItInsertionLine should use Hints of the same FID and LineNo
Author: chh Date: Wed Jul 12 09:25:40 2017 New Revision: 307809 URL: http://llvm.org/viewvc/llvm-project?rev=307809&view=rev Log: [clang] buildFixItInsertionLine should use Hints of the same FID and LineNo Fix bug https://bugs.llvm.org/show_bug.cgi?id=33734 Differential Revision: https://reviews.llvm.org/D35230 Modified: cfe/trunk/lib/Frontend/TextDiagnostic.cpp Modified: cfe/trunk/lib/Frontend/TextDiagnostic.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnostic.cpp?rev=307809&r1=307808&r2=307809&view=diff == --- cfe/trunk/lib/Frontend/TextDiagnostic.cpp (original) +++ cfe/trunk/lib/Frontend/TextDiagnostic.cpp Wed Jul 12 09:25:40 2017 @@ -1052,7 +1052,8 @@ static void highlightRange(const CharSou std::fill(CaretLine.begin()+StartColNo,CaretLine.begin()+EndColNo,'~'); } -static std::string buildFixItInsertionLine(unsigned LineNo, +static std::string buildFixItInsertionLine(FileID FID, + unsigned LineNo, const SourceColumnMap &map, ArrayRef Hints, const SourceManager &SM, @@ -1069,7 +1070,8 @@ static std::string buildFixItInsertionLi // code contains no newlines and is on the same line as the caret. std::pair HintLocInfo = SM.getDecomposedExpansionLoc(I->RemoveRange.getBegin()); - if (LineNo == SM.getLineNumber(HintLocInfo.first, HintLocInfo.second) && + if (FID == HintLocInfo.first && + LineNo == SM.getLineNumber(HintLocInfo.first, HintLocInfo.second) && StringRef(I->CodeToInsert).find_first_of("\n\r") == StringRef::npos) { // Insert the new code into the line just below the code // that the user wrote. @@ -1105,9 +1107,6 @@ static std::string buildFixItInsertionLi PrevHintEndCol = HintCol + llvm::sys::locale::columnWidth(I->CodeToInsert); - } else { -FixItInsertionLine.clear(); -break; } } } @@ -1222,7 +1221,7 @@ void TextDiagnostic::emitSnippetAndCaret } std::string FixItInsertionLine = buildFixItInsertionLine( -LineNo, sourceColMap, Hints, SM, DiagOpts.get()); +FID, LineNo, sourceColMap, Hints, SM, DiagOpts.get()); // If the source line is too long for our terminal, select only the // "interesting" source region within that line. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r307810 - [clang-tidy] add regression test to performance-unnecessary-value-param
Author: chh Date: Wed Jul 12 09:27:00 2017 New Revision: 307810 URL: http://llvm.org/viewvc/llvm-project?rev=307810&view=rev Log: [clang-tidy] add regression test to performance-unnecessary-value-param This test shows the problem in https://bugs.llvm.org/show_bug.cgi?id=33734 Differential Revision: https://reviews.llvm.org/D35225 Added: clang-tools-extra/trunk/test/clang-tidy/Inputs/performance-unnecessary-value-param/ clang-tools-extra/trunk/test/clang-tidy/Inputs/performance-unnecessary-value-param/header-fixed.h clang-tools-extra/trunk/test/clang-tidy/Inputs/performance-unnecessary-value-param/header.h clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-header.cpp Added: clang-tools-extra/trunk/test/clang-tidy/Inputs/performance-unnecessary-value-param/header-fixed.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/Inputs/performance-unnecessary-value-param/header-fixed.h?rev=307810&view=auto == --- clang-tools-extra/trunk/test/clang-tidy/Inputs/performance-unnecessary-value-param/header-fixed.h (added) +++ clang-tools-extra/trunk/test/clang-tidy/Inputs/performance-unnecessary-value-param/header-fixed.h Wed Jul 12 09:27:00 2017 @@ -0,0 +1,15 @@ +// struct ABC is expensive to copy and should be +// passed as a const referece. +struct ABC { + ABC(const ABC&); + int get(int) const; +}; + + +int f1(int n, const ABC& v1, const ABC& v2); // line 9 + +int f1(int n, ABC v1); // line 11 + + + +int f2(int n, const ABC& v2); // line 15 Added: clang-tools-extra/trunk/test/clang-tidy/Inputs/performance-unnecessary-value-param/header.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/Inputs/performance-unnecessary-value-param/header.h?rev=307810&view=auto == --- clang-tools-extra/trunk/test/clang-tidy/Inputs/performance-unnecessary-value-param/header.h (added) +++ clang-tools-extra/trunk/test/clang-tidy/Inputs/performance-unnecessary-value-param/header.h Wed Jul 12 09:27:00 2017 @@ -0,0 +1,15 @@ +// struct ABC is expensive to copy and should be +// passed as a const referece. +struct ABC { + ABC(const ABC&); + int get(int) const; +}; + + +int f1(int n, ABC v1, ABC v2); // line 9 + +int f1(int n, ABC v1); // line 11 + + + +int f2(int n, ABC v2); // line 15 Added: clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-header.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-header.cpp?rev=307810&view=auto == --- clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-header.cpp (added) +++ clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-header.cpp Wed Jul 12 09:27:00 2017 @@ -0,0 +1,18 @@ +// RUN: cp %S/Inputs/performance-unnecessary-value-param/header.h %T/header.h +// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t -- -- -std=c++11 -I %T +// RUN: diff %T/header.h %S/Inputs/performance-unnecessary-value-param/header-fixed.h + +#include "header.h" + + + +int f1(int n, ABC v1, ABC v2) { + // CHECK-MESSAGES: [[@LINE-1]]:19: warning: the parameter 'v1' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param] + // CHECK-MESSAGES: [[@LINE-2]]:27: warning: the parameter 'v2' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param] + // CHECK-FIXES: int f1(int n, const ABC& v1, const ABC& v2) { + return v1.get(n) + v2.get(n); +} +int f2(int n, ABC v2) { + // CHECK-MESSAGES: [[@LINE-1]]:19: warning: the parameter 'v2' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param] + // CHECK-FIXES: int f2(int n, const ABC& v2) { +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r303645 - [clang-tidy] Do not dereference a null BaseType
Author: chh Date: Tue May 23 11:19:04 2017 New Revision: 303645 URL: http://llvm.org/viewvc/llvm-project?rev=303645&view=rev Log: [clang-tidy] Do not dereference a null BaseType Check BaseType before dereference. Simplified test case is derived from Android Open Source code. Differential Revision: https://reviews.llvm.org/D33430 Modified: clang-tools-extra/trunk/clang-tidy/misc/ForwardingReferenceOverloadCheck.cpp clang-tools-extra/trunk/test/clang-tidy/misc-forwarding-reference-overload.cpp Modified: clang-tools-extra/trunk/clang-tidy/misc/ForwardingReferenceOverloadCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/ForwardingReferenceOverloadCheck.cpp?rev=303645&r1=303644&r2=303645&view=diff == --- clang-tools-extra/trunk/clang-tidy/misc/ForwardingReferenceOverloadCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/misc/ForwardingReferenceOverloadCheck.cpp Tue May 23 11:19:04 2017 @@ -40,6 +40,8 @@ AST_MATCHER(QualType, isEnableIf) { if (const auto *Dependent = BaseType->getAs()) { BaseType = Dependent->getQualifier()->getAsType(); } + if (!BaseType) +return false; if (CheckTemplate(BaseType->getAs())) { return true; // Case: enable_if_t< >. } else if (const auto *Elaborated = BaseType->getAs()) { Modified: clang-tools-extra/trunk/test/clang-tidy/misc-forwarding-reference-overload.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-forwarding-reference-overload.cpp?rev=303645&r1=303644&r2=303645&view=diff == --- clang-tools-extra/trunk/test/clang-tidy/misc-forwarding-reference-overload.cpp (original) +++ clang-tools-extra/trunk/test/clang-tidy/misc-forwarding-reference-overload.cpp Tue May 23 11:19:04 2017 @@ -121,3 +121,25 @@ public: private: Test6(const Test6 &rhs); }; + +// Do not dereference a null BaseType. +template class result_of; +template class result_of<_Fp(_Args...)> { }; +template using result_of_t = typename result_of<_Tp>::type; + +template struct __overload; +template +struct __overload<_Tp, _Types...> : __overload<_Types...> { + using __overload<_Types...>::operator(); +}; + +template +using __best_match_t = typename result_of_t<__overload<_Types...>(_Tp&&)>::type; + +template +class variant { +public: + template > + constexpr variant(_Arg&& __arg) {} + // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: constructor accepting a forwarding reference can hide the copy and move constructors +}; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r244502 - Fix test case to work with -Asserts builds.
Author: chh Date: Mon Aug 10 15:58:54 2015 New Revision: 244502 URL: http://llvm.org/viewvc/llvm-project?rev=244502&view=rev Log: Fix test case to work with -Asserts builds. When clang is built with -DLLVM_ENABLE_ASSERTIONS=Off, it does not create names for IR values. Differential Revision: http://reviews.llvm.org/D11437 Modified: cfe/trunk/test/CodeGen/x86_64-fp128.c Modified: cfe/trunk/test/CodeGen/x86_64-fp128.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_64-fp128.c?rev=244502&r1=244501&r2=244502&view=diff == --- cfe/trunk/test/CodeGen/x86_64-fp128.c (original) +++ cfe/trunk/test/CodeGen/x86_64-fp128.c Mon Aug 10 15:58:54 2015 @@ -31,20 +31,20 @@ typedef __builtin_va_list va_list; int TestGetVarInt(va_list ap) { return __builtin_va_arg(ap, int); -// Since int can be passed in memory or in register there is a branch and a phi. +// Since int can be passed in memory or register there are two branches. // CHECK: define i32 @TestGetVarInt( -// CHECK: br -// CHECK: load {{.*}} %overflow_arg_area_p +// CHECK: br label +// CHECK: br label // CHECK: = phi // CHECK: ret i32 } double TestGetVarDouble(va_list ap) { return __builtin_va_arg(ap, double); -// Since double can be passed in memory or in register there is a branch and a phi. +// Since double can be passed in memory or register there are two branches. // CHECK: define double @TestGetVarDouble( -// CHECK: br -// CHECK: load {{.*}} %overflow_arg_area_p +// CHECK: br label +// CHECK: br label // CHECK: = phi // CHECK: ret double } @@ -54,10 +54,10 @@ long double TestGetVarLD(va_list ap) { // fp128 can be passed in memory or in register, but x86_fp80 is in memory. // ANDROID: define fp128 @TestGetVarLD( // GNU: define x86_fp80 @TestGetVarLD( -// ANDROID: br -// GNU-NOT: br -// CHECK: load {{.*}} %overflow_arg_area_p +// ANDROID: br label +// ANDROID: br label // ANDROID: = phi +// GNU-NOT: br // GNU-NOT: = phi // ANDROID: ret fp128 // GNU: ret x86_fp80 @@ -69,7 +69,6 @@ long double _Complex TestGetVarLDC(va_li // ANDROID: define void @TestGetVarLDC({ fp128, fp128 }* {{.*}}, %struct.__va_list_tag* // GNU: define { x86_fp80, x86_fp80 } @TestGetVarLDC( // CHECK-NOT: br -// CHECK: load {{.*}} %overflow_arg_area_p // CHECK-NOT: phi // ANDROID: ret void // GNU: ret { x86_fp80, x86_fp80 } @@ -106,11 +105,11 @@ void TestPassVarLD(long double x) { void TestPassVarLDC(long double _Complex x) { TestVarArg("A", x); // ANDROID: define void @TestPassVarLDC({ fp128, fp128 }* {{.*}} %x) -// ANDROID: store fp128 %x.{{.*}}, fp128* % -// ANDROID-NEXT: store fp128 %x.{{.*}}, fp128* % +// ANDROID: store fp128 %{{.*}}, fp128* % +// ANDROID-NEXT: store fp128 %{{.*}}, fp128* % // ANDROID-NEXT: call {{.*}} @TestVarArg(i8* {{.*}}, { fp128, fp128 }* {{.*}} % // GNU: define void @TestPassVarLDC({ x86_fp80, x86_fp80 }* {{.*}} %x) -// GNU: store x86_fp80 %x.{{.*}}, x86_fp80* % -// GNU-NEXT: store x86_fp80 %x.{{.*}}, x86_fp80* % +// GNU: store x86_fp80 %{{.*}}, x86_fp80* % +// GNU-NEXT: store x86_fp80 %{{.*}}, x86_fp80* % // GNGNU-NEXT: call {{.*}} @TestVarArg(i8* {{.*}}, { x86_fp80, x86_fp80 }* {{.*}} % } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r244468 - Correct x86_64 fp128 calling convention
I submitted a new patch into r244502. Please let me know if there is any other error. Thanks. On Mon, Aug 10, 2015 at 12:46 PM, David Blaikie wrote: > > > On Mon, Aug 10, 2015 at 10:33 AM, Chih-Hung Hsieh via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> Author: chh >> Date: Mon Aug 10 12:33:31 2015 >> New Revision: 244468 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=244468&view=rev >> Log: >> Correct x86_64 fp128 calling convention >> >> These changes are for Android x86_64 targets to be compatible >> with current Android g++ and conform to AMD64 ABI. >> >> https://llvm.org/bugs/show_bug.cgi?id=23897 >> * Return type of long double (fp128) should be fp128, not x86_fp80. >> * Vararg of long double (fp128) could be in register and overflowed to >> memory. >> >> https://llvm.org/bugs/show_bug.cgi?id=24111 >> * Return value of long double (fp128) _Complex should be in memory like >> a structure of {fp128,fp128}. >> >> Differential Revision: http://reviews.llvm.org/D11437 >> >> >> Added: >> cfe/trunk/test/CodeGen/x86_64-fp128.c >> Modified: >> cfe/trunk/lib/CodeGen/TargetInfo.cpp >> >> Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=244468&r1=244467&r2=244468&view=diff >> >> == >> --- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original) >> +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Mon Aug 10 12:33:31 2015 >> @@ -1862,13 +1862,20 @@ void X86_64ABIInfo::classify(QualType Ty >>Hi = Integer; >> } else if (k >= BuiltinType::Bool && k <= BuiltinType::LongLong) { >>Current = Integer; >> -} else if ((k == BuiltinType::Float || k == BuiltinType::Double) || >> - (k == BuiltinType::LongDouble && >> -getTarget().getTriple().isOSNaCl())) { >> +} else if (k == BuiltinType::Float || k == BuiltinType::Double) { >>Current = SSE; >> } else if (k == BuiltinType::LongDouble) { >> - Lo = X87; >> - Hi = X87Up; >> + const llvm::fltSemantics *LDF = &getTarget().getLongDoubleFormat(); >> + if (LDF == &llvm::APFloat::IEEEquad) { >> +Lo = SSE; >> +Hi = SSEUp; >> + } else if (LDF == &llvm::APFloat::x87DoubleExtended) { >> +Lo = X87; >> +Hi = X87Up; >> + } else if (LDF == &llvm::APFloat::IEEEdouble) { >> +Current = SSE; >> + } else >> +llvm_unreachable("unexpected long double representation!"); >> } >> // FIXME: _Decimal32 and _Decimal64 are SSE. >> // FIXME: _float128 and _Decimal128 are (SSE, SSEUp). >> @@ -1973,14 +1980,21 @@ void X86_64ABIInfo::classify(QualType Ty >> Current = Integer; >>else if (Size <= 128) >> Lo = Hi = Integer; >> -} else if (ET == getContext().FloatTy) >> +} else if (ET == getContext().FloatTy) { >>Current = SSE; >> -else if (ET == getContext().DoubleTy || >> - (ET == getContext().LongDoubleTy && >> - getTarget().getTriple().isOSNaCl())) >> +} else if (ET == getContext().DoubleTy) { >>Lo = Hi = SSE; >> -else if (ET == getContext().LongDoubleTy) >> - Current = ComplexX87; >> +} else if (ET == getContext().LongDoubleTy) { >> + const llvm::fltSemantics *LDF = &getTarget().getLongDoubleFormat(); >> + if (LDF == &llvm::APFloat::IEEEquad) >> +Current = Memory; >> + else if (LDF == &llvm::APFloat::x87DoubleExtended) >> +Current = ComplexX87; >> + else if (LDF == &llvm::APFloat::IEEEdouble) >> +Lo = Hi = SSE; >> + else >> +llvm_unreachable("unexpected long double representation!"); >> +} >> >> // If this complex type crosses an eightbyte boundary then it >> // should be split. >> @@ -2249,7 +2263,8 @@ llvm::Type *X86_64ABIInfo::GetByteVector >> Ty = QualType(InnerTy, 0); >> >>llvm::Type *IRType = CGT.ConvertType(Ty); >> - if(isa(IRType)) >> + if (isa(IRType) || >> + IRType->getTypeID() == llvm::Type::FP128TyID) >> return IRType; >> >>// We couldn't find the preferred IR vector type for 'Ty'. >> >> Added: cfe/trunk/test/CodeGen/x86_64-fp128.c
Re: [PATCH] D11921: Add NaCl (a target where long double = double) to long double ABI test
chh added a comment. Please rebase the change to r244502 or newer, to run with -Asserts builds. Thanks. Repository: rL LLVM http://reviews.llvm.org/D11921 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D11922: Add NaCl to long double/fp128 mangling test
chh added a comment. If there were only two different types, we should have mangled name 'd' for double and 'e' for long double, even if their implementations are the same. The problem came when g++ has __float80 and __float128 types, and long double could be implemented as __float80 or __float128. Then 'e' is used for __float80, 'g' for __float128, and 'long double' has mangled name 'e' or 'g', depending on whether it is __float80 or __float128. Yes, so far I know only Android and powerpc use fp128 for long double on x86_64. Repository: rL LLVM http://reviews.llvm.org/D11922 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D11437: Correct x86_64 fp128 calling convention
chh added a comment. Reid, thanks a lot for fixing my hacks! I tried your new diff 31457 and it worked for Android libm and all my other tests. I am still waiting for some review of the back end changes in http://reviews.llvm.org/D11438. This patch can be submitted now or later with http://reviews.llvm.org/D11438. Would you like to submit this one? http://reviews.llvm.org/D11437 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r244468 - Correct x86_64 fp128 calling convention
Author: chh Date: Mon Aug 10 12:33:31 2015 New Revision: 244468 URL: http://llvm.org/viewvc/llvm-project?rev=244468&view=rev Log: Correct x86_64 fp128 calling convention These changes are for Android x86_64 targets to be compatible with current Android g++ and conform to AMD64 ABI. https://llvm.org/bugs/show_bug.cgi?id=23897 * Return type of long double (fp128) should be fp128, not x86_fp80. * Vararg of long double (fp128) could be in register and overflowed to memory. https://llvm.org/bugs/show_bug.cgi?id=24111 * Return value of long double (fp128) _Complex should be in memory like a structure of {fp128,fp128}. Differential Revision: http://reviews.llvm.org/D11437 Added: cfe/trunk/test/CodeGen/x86_64-fp128.c Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=244468&r1=244467&r2=244468&view=diff == --- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Mon Aug 10 12:33:31 2015 @@ -1862,13 +1862,20 @@ void X86_64ABIInfo::classify(QualType Ty Hi = Integer; } else if (k >= BuiltinType::Bool && k <= BuiltinType::LongLong) { Current = Integer; -} else if ((k == BuiltinType::Float || k == BuiltinType::Double) || - (k == BuiltinType::LongDouble && -getTarget().getTriple().isOSNaCl())) { +} else if (k == BuiltinType::Float || k == BuiltinType::Double) { Current = SSE; } else if (k == BuiltinType::LongDouble) { - Lo = X87; - Hi = X87Up; + const llvm::fltSemantics *LDF = &getTarget().getLongDoubleFormat(); + if (LDF == &llvm::APFloat::IEEEquad) { +Lo = SSE; +Hi = SSEUp; + } else if (LDF == &llvm::APFloat::x87DoubleExtended) { +Lo = X87; +Hi = X87Up; + } else if (LDF == &llvm::APFloat::IEEEdouble) { +Current = SSE; + } else +llvm_unreachable("unexpected long double representation!"); } // FIXME: _Decimal32 and _Decimal64 are SSE. // FIXME: _float128 and _Decimal128 are (SSE, SSEUp). @@ -1973,14 +1980,21 @@ void X86_64ABIInfo::classify(QualType Ty Current = Integer; else if (Size <= 128) Lo = Hi = Integer; -} else if (ET == getContext().FloatTy) +} else if (ET == getContext().FloatTy) { Current = SSE; -else if (ET == getContext().DoubleTy || - (ET == getContext().LongDoubleTy && - getTarget().getTriple().isOSNaCl())) +} else if (ET == getContext().DoubleTy) { Lo = Hi = SSE; -else if (ET == getContext().LongDoubleTy) - Current = ComplexX87; +} else if (ET == getContext().LongDoubleTy) { + const llvm::fltSemantics *LDF = &getTarget().getLongDoubleFormat(); + if (LDF == &llvm::APFloat::IEEEquad) +Current = Memory; + else if (LDF == &llvm::APFloat::x87DoubleExtended) +Current = ComplexX87; + else if (LDF == &llvm::APFloat::IEEEdouble) +Lo = Hi = SSE; + else +llvm_unreachable("unexpected long double representation!"); +} // If this complex type crosses an eightbyte boundary then it // should be split. @@ -2249,7 +2263,8 @@ llvm::Type *X86_64ABIInfo::GetByteVector Ty = QualType(InnerTy, 0); llvm::Type *IRType = CGT.ConvertType(Ty); - if(isa(IRType)) + if (isa(IRType) || + IRType->getTypeID() == llvm::Type::FP128TyID) return IRType; // We couldn't find the preferred IR vector type for 'Ty'. Added: cfe/trunk/test/CodeGen/x86_64-fp128.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_64-fp128.c?rev=244468&view=auto == --- cfe/trunk/test/CodeGen/x86_64-fp128.c (added) +++ cfe/trunk/test/CodeGen/x86_64-fp128.c Mon Aug 10 12:33:31 2015 @@ -0,0 +1,116 @@ +// RUN: %clang_cc1 -triple x86_64-linux-android -emit-llvm -O -o - %s \ +// RUN:| FileCheck %s --check-prefix=ANDROID --check-prefix=CHECK +// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -O -o - %s \ +// RUN:| FileCheck %s --check-prefix=GNU --check-prefix=CHECK +// RUN: %clang_cc1 -triple x86_64 -emit-llvm -O -o - %s \ +// RUN:| FileCheck %s --check-prefix=GNU --check-prefix=CHECK + +// Android uses fp128 for long double but other x86_64 targets use x86_fp80. + +long double dataLD = 1.0L; +// ANDROID: @dataLD = global fp128 0xL3FFF, align 16 +// GNU: @dataLD = global x86_fp80 0xK3FFF8000, align 16 + +long double _Complex dataLDC = {1.0L, 1.0L}; +// ANDROID: @dataLDC = global { fp128, fp128 } { fp128 0xL3FFF, fp128 0xL3FFF }, align 16 +// GNU: @dataLDC = global { x86_fp80, x86_fp80 } { x86_fp80 0xK3FFF8000, x86_fp80 0xK3FFF8000 },
Re: [PATCH] D11437: Correct x86_64 fp128 calling convention
This revision was automatically updated to reflect the committed changes. Closed by commit rL244468: Correct x86_64 fp128 calling convention (authored by chh). Changed prior to commit: http://reviews.llvm.org/D11437?vs=31457&id=31687#toc Repository: rL LLVM http://reviews.llvm.org/D11437 Files: cfe/trunk/lib/CodeGen/TargetInfo.cpp cfe/trunk/test/CodeGen/x86_64-fp128.c Index: cfe/trunk/test/CodeGen/x86_64-fp128.c === --- cfe/trunk/test/CodeGen/x86_64-fp128.c +++ cfe/trunk/test/CodeGen/x86_64-fp128.c @@ -0,0 +1,116 @@ +// RUN: %clang_cc1 -triple x86_64-linux-android -emit-llvm -O -o - %s \ +// RUN:| FileCheck %s --check-prefix=ANDROID --check-prefix=CHECK +// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -O -o - %s \ +// RUN:| FileCheck %s --check-prefix=GNU --check-prefix=CHECK +// RUN: %clang_cc1 -triple x86_64 -emit-llvm -O -o - %s \ +// RUN:| FileCheck %s --check-prefix=GNU --check-prefix=CHECK + +// Android uses fp128 for long double but other x86_64 targets use x86_fp80. + +long double dataLD = 1.0L; +// ANDROID: @dataLD = global fp128 0xL3FFF, align 16 +// GNU: @dataLD = global x86_fp80 0xK3FFF8000, align 16 + +long double _Complex dataLDC = {1.0L, 1.0L}; +// ANDROID: @dataLDC = global { fp128, fp128 } { fp128 0xL3FFF, fp128 0xL3FFF }, align 16 +// GNU: @dataLDC = global { x86_fp80, x86_fp80 } { x86_fp80 0xK3FFF8000, x86_fp80 0xK3FFF8000 }, align 16 + +long double TestLD(long double x) { + return x * x; +// ANDROID: define fp128 @TestLD(fp128 %x) +// GNU: define x86_fp80 @TestLD(x86_fp80 %x) +} + +long double _Complex TestLDC(long double _Complex x) { + return x * x; +// ANDROID: define void @TestLDC({ fp128, fp128 }* {{.*}}, { fp128, fp128 }* {{.*}} %x) +// GNU: define { x86_fp80, x86_fp80 } @TestLDC({ x86_fp80, x86_fp80 }* {{.*}} %x) +} + +typedef __builtin_va_list va_list; + +int TestGetVarInt(va_list ap) { + return __builtin_va_arg(ap, int); +// Since int can be passed in memory or in register there is a branch and a phi. +// CHECK: define i32 @TestGetVarInt( +// CHECK: br +// CHECK: load {{.*}} %overflow_arg_area_p +// CHECK: = phi +// CHECK: ret i32 +} + +double TestGetVarDouble(va_list ap) { + return __builtin_va_arg(ap, double); +// Since double can be passed in memory or in register there is a branch and a phi. +// CHECK: define double @TestGetVarDouble( +// CHECK: br +// CHECK: load {{.*}} %overflow_arg_area_p +// CHECK: = phi +// CHECK: ret double +} + +long double TestGetVarLD(va_list ap) { + return __builtin_va_arg(ap, long double); +// fp128 can be passed in memory or in register, but x86_fp80 is in memory. +// ANDROID: define fp128 @TestGetVarLD( +// GNU: define x86_fp80 @TestGetVarLD( +// ANDROID: br +// GNU-NOT: br +// CHECK: load {{.*}} %overflow_arg_area_p +// ANDROID: = phi +// GNU-NOT: = phi +// ANDROID: ret fp128 +// GNU: ret x86_fp80 +} + +long double _Complex TestGetVarLDC(va_list ap) { + return __builtin_va_arg(ap, long double _Complex); +// Pair of fp128 or x86_fp80 are passed as struct in memory. +// ANDROID: define void @TestGetVarLDC({ fp128, fp128 }* {{.*}}, %struct.__va_list_tag* +// GNU: define { x86_fp80, x86_fp80 } @TestGetVarLDC( +// CHECK-NOT: br +// CHECK: load {{.*}} %overflow_arg_area_p +// CHECK-NOT: phi +// ANDROID: ret void +// GNU: ret { x86_fp80, x86_fp80 } +} + +void TestVarArg(const char *s, ...); + +void TestPassVarInt(int x) { + TestVarArg("A", x); +// CHECK: define void @TestPassVarInt(i32 %x) +// CHECK: call {{.*}} @TestVarArg(i8* {{.*}}, i32 %x) +} + +void TestPassVarFloat(float x) { + TestVarArg("A", x); +// CHECK: define void @TestPassVarFloat(float %x) +// CHECK: call {{.*}} @TestVarArg(i8* {{.*}}, double % +} + +void TestPassVarDouble(double x) { + TestVarArg("A", x); +// CHECK: define void @TestPassVarDouble(double %x) +// CHECK: call {{.*}} @TestVarArg(i8* {{.*}}, double %x +} + +void TestPassVarLD(long double x) { + TestVarArg("A", x); +// ANDROID: define void @TestPassVarLD(fp128 %x) +// ANDROID: call {{.*}} @TestVarArg(i8* {{.*}}, fp128 %x +// GNU: define void @TestPassVarLD(x86_fp80 %x) +// GNU: call {{.*}} @TestVarArg(i8* {{.*}}, x86_fp80 %x +} + +void TestPassVarLDC(long double _Complex x) { + TestVarArg("A", x); +// ANDROID: define void @TestPassVarLDC({ fp128, fp128 }* {{.*}} %x) +// ANDROID: store fp128 %x.{{.*}}, fp128* % +// ANDROID-NEXT: store fp128 %x.{{.*}}, fp128* % +// ANDROID-NEXT: call {{.*}} @TestVarArg(i8* {{.*}}, { fp128, fp128 }* {{.*}} % +// GNU: define void @TestPassVarLDC({ x86_fp80, x86_fp80 }* {{.*}} %x) +// GNU: store x86_fp80 %x.{{.*}}, x86_fp80* % +// GNU-NEXT: store x86_fp80 %x.{{.*}}, x86_fp80* % +// GNGNU-NEXT: call {{.*}} @TestVarArg(i8* {{.*}}, { x86_fp80, x86_fp80 }* {{.*}} % +} Index: cfe/trunk/lib/CodeG
r267832 - [analyzer] Move Checkers.inc to clang/include/...
Author: chh Date: Wed Apr 27 20:09:09 2016 New Revision: 267832 URL: http://llvm.org/viewvc/llvm-project?rev=267832&view=rev Log: [analyzer] Move Checkers.inc to clang/include/... Simplify sharing of Checkers.inc with other files like ClangTidy.cpp. Differential Revision: http://reviews.llvm.org/19393 Added: cfe/trunk/include/clang/StaticAnalyzer/Checkers/CMakeLists.txt cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td - copied unchanged from r266687, cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td Removed: cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td Modified: cfe/trunk/include/clang/CMakeLists.txt cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt cfe/trunk/lib/StaticAnalyzer/Checkers/ClangCheckers.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/ClangSACheckers.h Modified: cfe/trunk/include/clang/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CMakeLists.txt?rev=267832&r1=267831&r2=267832&view=diff == --- cfe/trunk/include/clang/CMakeLists.txt (original) +++ cfe/trunk/include/clang/CMakeLists.txt Wed Apr 27 20:09:09 2016 @@ -4,3 +4,4 @@ add_subdirectory(Driver) add_subdirectory(Parse) add_subdirectory(Sema) add_subdirectory(Serialization) +add_subdirectory(StaticAnalyzer/Checkers) Added: cfe/trunk/include/clang/StaticAnalyzer/Checkers/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Checkers/CMakeLists.txt?rev=267832&view=auto == --- cfe/trunk/include/clang/StaticAnalyzer/Checkers/CMakeLists.txt (added) +++ cfe/trunk/include/clang/StaticAnalyzer/Checkers/CMakeLists.txt Wed Apr 27 20:09:09 2016 @@ -0,0 +1,4 @@ +clang_tablegen(Checkers.inc -gen-clang-sa-checkers + -I ${CMAKE_CURRENT_SOURCE_DIR}/../../../ + SOURCE Checkers.td + TARGET ClangSACheckers) Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt?rev=267832&r1=267831&r2=267832&view=diff == --- cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt (original) +++ cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt Wed Apr 27 20:09:09 2016 @@ -1,8 +1,3 @@ -clang_tablegen(Checkers.inc -gen-clang-sa-checkers - -I ${CMAKE_CURRENT_SOURCE_DIR}/../../../include - SOURCE Checkers.td - TARGET ClangSACheckers) - set(LLVM_LINK_COMPONENTS Support ) Removed: cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td?rev=267831&view=auto == --- cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td (original) +++ cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td (removed) @@ -1,651 +0,0 @@ -//===--- Checkers.td - Static Analyzer Checkers -===---===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===--===// - -include "clang/StaticAnalyzer/Checkers/CheckerBase.td" - -//===--===// -// Packages. -//===--===// - -// The Alpha package is for checkers that have too many false positives to be -// turned on by default. The hierarchy under Alpha should be organized in the -// hierarchy checkers would have had if they were truly at the top level. -// (For example, a Cocoa-specific checker that is alpha should be in -// alpha.osx.cocoa). -def Alpha : Package<"alpha">; - -def Core : Package<"core">; -def CoreBuiltin : Package<"builtin">, InPackage; -def CoreUninitialized : Package<"uninitialized">, InPackage; -def CoreAlpha : Package<"core">, InPackage, Hidden; - -// The OptIn package is for checkers that are not alpha and that would normally -// be on by default but where the driver does not have enough information to -// determine when they are applicable. For example, localizability checkers fit -// this criterion because the driver cannot determine whether a project is -// localized or not -- this is best determined at the IDE or build-system level. -// -// The checker hierarchy under OptIn should mirror that in Alpha: checkers -// should be organized as if they were at the top level. -// -// Note: OptIn is *not* intended for checkers that are too noisy to be on by -// default. Such checkers belong in the alpha package. -def OptIn : Package<"optin">; - -def Nullability : Package<"nullability">; - -def Cplusplus : Package<"cplusplus">; -def CplusplusAlpha : Package<"cplusplus">, InPa
Re: [PATCH] D19393: Move Checkers.inc to clang/include/.../Checkers
chh closed this revision. chh added a comment. Was submitted in r267832 | chh | 2016-04-27 18:09:09 -0700 (Wed, 27 Apr 2016) http://reviews.llvm.org/D19393 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D19249: Fix include path in ClangTidy.cpp.
chh created this revision. chh added reviewers: srhines, alexfh. chh added a subscriber: cfe-commits. Herald added subscribers: danalbert, tberghammer. https://llvm.org/bugs/show_bug.cgi?id=27355 To compile with other binary output directory structures in build systems like Android. http://reviews.llvm.org/D19249 Files: clang-tidy/CMakeLists.txt clang-tidy/ClangTidy.cpp Index: clang-tidy/ClangTidy.cpp === --- clang-tidy/ClangTidy.cpp +++ clang-tidy/ClangTidy.cpp @@ -58,7 +58,7 @@ #define GET_CHECKERS #define CHECKER(FULLNAME, CLASS, DESCFILE, HELPTEXT, GROUPINDEX, HIDDEN) \ FULLNAME, -#include "../../../lib/StaticAnalyzer/Checkers/Checkers.inc" +#include "Checkers.inc" #undef CHECKER #undef GET_CHECKERS }; Index: clang-tidy/CMakeLists.txt === --- clang-tidy/CMakeLists.txt +++ clang-tidy/CMakeLists.txt @@ -2,6 +2,10 @@ Support ) +include_directories( + "${CMAKE_CURRENT_BINARY_DIR}/../../../lib/StaticAnalyzer/Checkers" + ) + add_clang_library(clangTidy ClangTidy.cpp ClangTidyModule.cpp Index: clang-tidy/ClangTidy.cpp === --- clang-tidy/ClangTidy.cpp +++ clang-tidy/ClangTidy.cpp @@ -58,7 +58,7 @@ #define GET_CHECKERS #define CHECKER(FULLNAME, CLASS, DESCFILE, HELPTEXT, GROUPINDEX, HIDDEN) \ FULLNAME, -#include "../../../lib/StaticAnalyzer/Checkers/Checkers.inc" +#include "Checkers.inc" #undef CHECKER #undef GET_CHECKERS }; Index: clang-tidy/CMakeLists.txt === --- clang-tidy/CMakeLists.txt +++ clang-tidy/CMakeLists.txt @@ -2,6 +2,10 @@ Support ) +include_directories( + "${CMAKE_CURRENT_BINARY_DIR}/../../../lib/StaticAnalyzer/Checkers" + ) + add_clang_library(clangTidy ClangTidy.cpp ClangTidyModule.cpp ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D19393: Move Checkers.inc to clang/include/.../Checkers
chh created this revision. chh added reviewers: srhines, alexfh. chh added a subscriber: cfe-commits. Herald added subscribers: danalbert, tberghammer. https://llvm.org/bugs/show_bug.cgi?id=27355 To compile with other binary output directory structures in build systems like Android. Allow clang-tidy/ClangTidy.cpp and other files to include Checkers.inc like other .inc files, with a relative path to clang/include. http://reviews.llvm.org/D19393 Files: include/clang/CMakeLists.txt include/clang/StaticAnalyzer/Checkers/CMakeLists.txt lib/StaticAnalyzer/Checkers/CMakeLists.txt lib/StaticAnalyzer/Checkers/ClangCheckers.cpp lib/StaticAnalyzer/Checkers/ClangSACheckers.h Index: lib/StaticAnalyzer/Checkers/ClangSACheckers.h === --- lib/StaticAnalyzer/Checkers/ClangSACheckers.h +++ lib/StaticAnalyzer/Checkers/ClangSACheckers.h @@ -26,7 +26,7 @@ #define GET_CHECKERS #define CHECKER(FULLNAME,CLASS,CXXFILE,HELPTEXT,GROUPINDEX,HIDDEN)\ void register##CLASS(CheckerManager &mgr); -#include "Checkers.inc" +#include "clang/StaticAnalyzer/Checkers/Checkers.inc" #undef CHECKER #undef GET_CHECKERS Index: lib/StaticAnalyzer/Checkers/ClangCheckers.cpp === --- lib/StaticAnalyzer/Checkers/ClangCheckers.cpp +++ lib/StaticAnalyzer/Checkers/ClangCheckers.cpp @@ -27,6 +27,6 @@ #define GET_CHECKERS #define CHECKER(FULLNAME,CLASS,DESCFILE,HELPTEXT,GROUPINDEX,HIDDEN)\ registry.addChecker(register##CLASS, FULLNAME, HELPTEXT); -#include "Checkers.inc" +#include "clang/StaticAnalyzer/Checkers/Checkers.inc" #undef GET_CHECKERS } Index: lib/StaticAnalyzer/Checkers/CMakeLists.txt === --- lib/StaticAnalyzer/Checkers/CMakeLists.txt +++ lib/StaticAnalyzer/Checkers/CMakeLists.txt @@ -1,8 +1,3 @@ -clang_tablegen(Checkers.inc -gen-clang-sa-checkers - -I ${CMAKE_CURRENT_SOURCE_DIR}/../../../include - SOURCE Checkers.td - TARGET ClangSACheckers) - set(LLVM_LINK_COMPONENTS Support ) Index: include/clang/StaticAnalyzer/Checkers/CMakeLists.txt === --- include/clang/StaticAnalyzer/Checkers/CMakeLists.txt +++ include/clang/StaticAnalyzer/Checkers/CMakeLists.txt @@ -0,0 +1,4 @@ +clang_tablegen(Checkers.inc -gen-clang-sa-checkers + -I ${CMAKE_CURRENT_SOURCE_DIR}/../../../ + SOURCE ../../../../lib/StaticAnalyzer/Checkers/Checkers.td + TARGET ClangSACheckers) Index: include/clang/CMakeLists.txt === --- include/clang/CMakeLists.txt +++ include/clang/CMakeLists.txt @@ -4,3 +4,4 @@ add_subdirectory(Parse) add_subdirectory(Sema) add_subdirectory(Serialization) +add_subdirectory(StaticAnalyzer/Checkers) Index: lib/StaticAnalyzer/Checkers/ClangSACheckers.h === --- lib/StaticAnalyzer/Checkers/ClangSACheckers.h +++ lib/StaticAnalyzer/Checkers/ClangSACheckers.h @@ -26,7 +26,7 @@ #define GET_CHECKERS #define CHECKER(FULLNAME,CLASS,CXXFILE,HELPTEXT,GROUPINDEX,HIDDEN)\ void register##CLASS(CheckerManager &mgr); -#include "Checkers.inc" +#include "clang/StaticAnalyzer/Checkers/Checkers.inc" #undef CHECKER #undef GET_CHECKERS Index: lib/StaticAnalyzer/Checkers/ClangCheckers.cpp === --- lib/StaticAnalyzer/Checkers/ClangCheckers.cpp +++ lib/StaticAnalyzer/Checkers/ClangCheckers.cpp @@ -27,6 +27,6 @@ #define GET_CHECKERS #define CHECKER(FULLNAME,CLASS,DESCFILE,HELPTEXT,GROUPINDEX,HIDDEN)\ registry.addChecker(register##CLASS, FULLNAME, HELPTEXT); -#include "Checkers.inc" +#include "clang/StaticAnalyzer/Checkers/Checkers.inc" #undef GET_CHECKERS } Index: lib/StaticAnalyzer/Checkers/CMakeLists.txt === --- lib/StaticAnalyzer/Checkers/CMakeLists.txt +++ lib/StaticAnalyzer/Checkers/CMakeLists.txt @@ -1,8 +1,3 @@ -clang_tablegen(Checkers.inc -gen-clang-sa-checkers - -I ${CMAKE_CURRENT_SOURCE_DIR}/../../../include - SOURCE Checkers.td - TARGET ClangSACheckers) - set(LLVM_LINK_COMPONENTS Support ) Index: include/clang/StaticAnalyzer/Checkers/CMakeLists.txt === --- include/clang/StaticAnalyzer/Checkers/CMakeLists.txt +++ include/clang/StaticAnalyzer/Checkers/CMakeLists.txt @@ -0,0 +1,4 @@ +clang_tablegen(Checkers.inc -gen-clang-sa-checkers + -I ${CMAKE_CURRENT_SOURCE_DIR}/../../../ + SOURCE ../../../../lib/StaticAnalyzer/Checkers/Checkers.td + TARGET ClangSACheckers) Index: include/clang/CMakeLists.txt === --- include/clang/CMakeLists.txt +++ include/clang/CMakeLists.txt @@ -4,3 +4,4 @@ add_subdirectory(Parse) add_subdirectory(Sema) add_subdirectory(Serializatio
Re: [PATCH] D19249: Fix include path in ClangTidy.cpp.
chh updated this revision to Diff 54587. http://reviews.llvm.org/D19249 Files: clang-tidy/ClangTidy.cpp Index: clang-tidy/ClangTidy.cpp === --- clang-tidy/ClangTidy.cpp +++ clang-tidy/ClangTidy.cpp @@ -58,7 +58,7 @@ #define GET_CHECKERS #define CHECKER(FULLNAME, CLASS, DESCFILE, HELPTEXT, GROUPINDEX, HIDDEN) \ FULLNAME, -#include "../../../lib/StaticAnalyzer/Checkers/Checkers.inc" +#include "clang/StaticAnalyzer/Checkers/Checkers.inc" #undef CHECKER #undef GET_CHECKERS }; Index: clang-tidy/ClangTidy.cpp === --- clang-tidy/ClangTidy.cpp +++ clang-tidy/ClangTidy.cpp @@ -58,7 +58,7 @@ #define GET_CHECKERS #define CHECKER(FULLNAME, CLASS, DESCFILE, HELPTEXT, GROUPINDEX, HIDDEN) \ FULLNAME, -#include "../../../lib/StaticAnalyzer/Checkers/Checkers.inc" +#include "clang/StaticAnalyzer/Checkers/Checkers.inc" #undef CHECKER #undef GET_CHECKERS }; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19249: Fix include path in ClangTidy.cpp.
chh added a comment. This change depends on http://reviews.llvm.org/D19393. http://reviews.llvm.org/D19249 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19393: Move Checkers.inc to clang/include/.../Checkers
chh added a comment. See dependent change of ClangTidy.cpp in http://reviews.llvm.org/D19393. http://reviews.llvm.org/D19393 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19393: Move Checkers.inc to clang/include/.../Checkers
chh updated this revision to Diff 54758. chh added a comment. Also move Checkers.td to clang/include/.../Checkers. http://reviews.llvm.org/D19393 Files: include/clang/CMakeLists.txt include/clang/StaticAnalyzer/Checkers/CMakeLists.txt include/clang/StaticAnalyzer/Checkers/Checkers.td lib/StaticAnalyzer/Checkers/CMakeLists.txt lib/StaticAnalyzer/Checkers/Checkers.td lib/StaticAnalyzer/Checkers/ClangCheckers.cpp lib/StaticAnalyzer/Checkers/ClangSACheckers.h Index: lib/StaticAnalyzer/Checkers/ClangSACheckers.h === --- lib/StaticAnalyzer/Checkers/ClangSACheckers.h +++ lib/StaticAnalyzer/Checkers/ClangSACheckers.h @@ -26,7 +26,7 @@ #define GET_CHECKERS #define CHECKER(FULLNAME,CLASS,CXXFILE,HELPTEXT,GROUPINDEX,HIDDEN)\ void register##CLASS(CheckerManager &mgr); -#include "Checkers.inc" +#include "clang/StaticAnalyzer/Checkers/Checkers.inc" #undef CHECKER #undef GET_CHECKERS Index: lib/StaticAnalyzer/Checkers/ClangCheckers.cpp === --- lib/StaticAnalyzer/Checkers/ClangCheckers.cpp +++ lib/StaticAnalyzer/Checkers/ClangCheckers.cpp @@ -27,6 +27,6 @@ #define GET_CHECKERS #define CHECKER(FULLNAME,CLASS,DESCFILE,HELPTEXT,GROUPINDEX,HIDDEN)\ registry.addChecker(register##CLASS, FULLNAME, HELPTEXT); -#include "Checkers.inc" +#include "clang/StaticAnalyzer/Checkers/Checkers.inc" #undef GET_CHECKERS } Index: lib/StaticAnalyzer/Checkers/Checkers.td === --- lib/StaticAnalyzer/Checkers/Checkers.td +++ lib/StaticAnalyzer/Checkers/Checkers.td @@ -1,651 +0,0 @@ -//===--- Checkers.td - Static Analyzer Checkers -===---===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===--===// - -include "clang/StaticAnalyzer/Checkers/CheckerBase.td" - -//===--===// -// Packages. -//===--===// - -// The Alpha package is for checkers that have too many false positives to be -// turned on by default. The hierarchy under Alpha should be organized in the -// hierarchy checkers would have had if they were truly at the top level. -// (For example, a Cocoa-specific checker that is alpha should be in -// alpha.osx.cocoa). -def Alpha : Package<"alpha">; - -def Core : Package<"core">; -def CoreBuiltin : Package<"builtin">, InPackage; -def CoreUninitialized : Package<"uninitialized">, InPackage; -def CoreAlpha : Package<"core">, InPackage, Hidden; - -// The OptIn package is for checkers that are not alpha and that would normally -// be on by default but where the driver does not have enough information to -// determine when they are applicable. For example, localizability checkers fit -// this criterion because the driver cannot determine whether a project is -// localized or not -- this is best determined at the IDE or build-system level. -// -// The checker hierarchy under OptIn should mirror that in Alpha: checkers -// should be organized as if they were at the top level. -// -// Note: OptIn is *not* intended for checkers that are too noisy to be on by -// default. Such checkers belong in the alpha package. -def OptIn : Package<"optin">; - -def Nullability : Package<"nullability">; - -def Cplusplus : Package<"cplusplus">; -def CplusplusAlpha : Package<"cplusplus">, InPackage, Hidden; - -def DeadCode : Package<"deadcode">; -def DeadCodeAlpha : Package<"deadcode">, InPackage, Hidden; - -def Performance : Package<"performance">, InPackage; - -def Security : Package <"security">; -def InsecureAPI : Package<"insecureAPI">, InPackage; -def SecurityAlpha : Package<"security">, InPackage, Hidden; -def Taint : Package<"taint">, InPackage, Hidden; - -def Unix : Package<"unix">; -def UnixAlpha : Package<"unix">, InPackage, Hidden; -def CString : Package<"cstring">, InPackage, Hidden; -def CStringAlpha : Package<"cstring">, InPackage, Hidden; - -def OSX : Package<"osx">; -def OSXAlpha : Package<"osx">, InPackage, Hidden; -def OSXOptIn : Package<"osx">, InPackage; - -def Cocoa : Package<"cocoa">, InPackage; -def CocoaAlpha : Package<"cocoa">, InPackage, Hidden; -def CocoaOptIn : Package<"cocoa">, InPackage; - -def CoreFoundation : Package<"coreFoundation">, InPackage; -def Containers : Package<"containers">, InPackage; - -def LocalizabilityAlpha : Package<"localizability">, InPackage; -def LocalizabilityOptIn : Package<"localizability">, InPackage; - -def LLVM : Package<"llvm">; -def Debug : Package<"debug">; - -//===--===// -// Core Checkers. -//===--
Re: [PATCH] D19393: Move Checkers.inc to clang/include/.../Checkers
chh marked 2 inline comments as done. chh added a comment. I used "svn mv" to move the file and "svn diff --show-copies-as-adds" to generate the diff. If I didn't use "--show-copies-as-adds", the new file was not included/shown by phabricator at all. Please let me know if there is better way to generate and display such diff in phabricator. Thanks. http://reviews.llvm.org/D19393 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r271427 - [driver][arm] add armv7 and thumb include and lib paths
Author: chh Date: Wed Jun 1 15:48:46 2016 New Revision: 271427 URL: http://llvm.org/viewvc/llvm-project?rev=271427&view=rev Log: [driver][arm] add armv7 and thumb include and lib paths Add a new test android-ndk-standalone.cpp with new Android NDK release tree structure. Detect armv7 sub architecture and thumb mode, to add system include and link search paths. Differential Revision: http://reviews.llvm.org/D20600 Added: cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/aarch64-linux-android/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/aarch64-linux-android/bin/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/aarch64-linux-android/bin/ld cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/aarch64-linux-android/bin/ld.bfd cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/aarch64-linux-android/bin/ld.gold cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/aarch64-linux-android/lib/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/aarch64-linux-android/lib/.keep cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/bin/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/bin/ld cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/bin/ld.bfd cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/bin/ld.gold cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/lib/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/lib/armv7-a/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/lib/armv7-a/thumb/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/lib/armv7-a/thumb/.keep cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/lib/thumb/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/lib/thumb/.keep cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/aarch64-linux-android-ld cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/aarch64-linux-android-ld.bfd cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/aarch64-linux-android-ld.gold cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/arm-linux-androideabi-ld cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/arm-linux-androideabi-ld.bfd cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/arm-linux-androideabi-ld.gold cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/i686-linux-android-ld cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/i686-linux-android-ld.bfd cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/i686-linux-android-ld.gold cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/mipsel-linux-android-ld cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/mipsel-linux-android-ld.bfd cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/mipsel-linux-android-ld.gold cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/i686-linux-android/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/i686-linux-android/bin/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/i686-linux-android/bin/ld cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/i686-linux-android/bin/ld.bfd cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/i686-linux-android/bin/ld.gold cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/i686-linux-android/lib/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/i686-linux-android/lib/.keep cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/aarch64-linux-android/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/aarch64-linux-android/.keep cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/arm-linux-androideabi/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/arm-linux-androideabi/armv7-a/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb/.keep cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/arm-linux-androideabi/thumb/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/arm-linux-androideabi/thumb/.keep cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/backward/ cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/backward/.keep cfe/tr
r271438 - [driver][arm] change regular expression to work on Windows
Author: chh Date: Wed Jun 1 17:53:59 2016 New Revision: 271438 URL: http://llvm.org/viewvc/llvm-project?rev=271438&view=rev Log: [driver][arm] change regular expression to work on Windows Differential Revision: http://reviews.llvm.org/D20600 Modified: cfe/trunk/test/Driver/android-ndk-standalone.cpp Modified: cfe/trunk/test/Driver/android-ndk-standalone.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/android-ndk-standalone.cpp?rev=271438&r1=271437&r2=271438&view=diff == --- cfe/trunk/test/Driver/android-ndk-standalone.cpp (original) +++ cfe/trunk/test/Driver/android-ndk-standalone.cpp Wed Jun 1 17:53:59 2016 @@ -17,7 +17,7 @@ // CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb" // CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" // CHECK: "-internal-isystem" "{{.*}}/sysroot/usr/local/include" -// CHECK: "-internal-isystem" "{{.*}}/lib/clang/{{[^/]*}}/include" +// CHECK: "-internal-isystem" "{{.*}}/lib/clang/{{[^"]+}}/include" // CHECK: "-internal-externc-isystem" "{{.*}}/sysroot/include" // CHECK: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include" // CHECK: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" @@ -53,7 +53,7 @@ // CHECK-ARMV7-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi" // CHECK-ARMV7: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" // CHECK-ARMV7: "-internal-isystem" "{{.*}}/sysroot/usr/local/include" -// CHECK-ARMV7: "-internal-isystem" "{{.*}}/lib/clang/{{[^/]*}}/include" +// CHECK-ARMV7: "-internal-isystem" "{{.*}}/lib/clang/{{[^"]+}}/include" // CHECK-ARMV7: "-internal-externc-isystem" "{{.*}}/sysroot/include" // CHECK-ARMV7: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include" // CHECK-ARMV7: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" @@ -111,7 +111,7 @@ // CHECK-THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi" // CHECK-THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" // CHECK-THUMB: "-internal-isystem" "{{.*}}/sysroot/usr/local/include" -// CHECK-THUMB: "-internal-isystem" "{{.*}}/lib/clang/{{[^/]*}}/include" +// CHECK-THUMB: "-internal-isystem" "{{.*}}/lib/clang/{{[^"]+}}/include" // CHECK-THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/include" // CHECK-THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include" // CHECK-THUMB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" @@ -149,7 +149,7 @@ // CHECK-ARMV7THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi" // CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" // CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/sysroot/usr/local/include" -// CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/lib/clang/{{[^/]*}}/include" +// CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/lib/clang/{{[^"]+}}/include" // CHECK-ARMV7THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/include" // CHECK-ARMV7THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include" // CHECK-ARMV7THUMB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r271427 - [driver][arm] add armv7 and thumb include and lib paths
Ismail, I saw that android-ndk-standalone.cpp has already -stdlib=libstdc++. Could you tell me or just go ahead and make the necessary change? Thanks. On Thu, Jun 2, 2016 at 9:52 AM, Ismail Donmez wrote: > Hi, > > On Wed, Jun 1, 2016 at 11:48 PM, Chih-Hung Hsieh via cfe-commits > wrote: > > Author: chh > > Date: Wed Jun 1 15:48:46 2016 > > New Revision: 271427 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=271427&view=rev > > Log: > > [driver][arm] add armv7 and thumb include and lib paths > > > > Add a new test android-ndk-standalone.cpp > > with new Android NDK release tree structure. > > Detect armv7 sub architecture and thumb mode, > > to add system include and link search paths. > > > > Differential Revision: http://reviews.llvm.org/D20600 > > > > android-ndk-standalone.cpp needs -stdlib=libstdc++ to fix test on > libc++ default systems. > > ismail > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r264164 - [analyzer] Fix typo s/initalize/initialize/
Author: chh Date: Wed Mar 23 11:14:12 2016 New Revision: 264164 URL: http://llvm.org/viewvc/llvm-project?rev=264164&view=rev Log: [analyzer] Fix typo s/initalize/initialize/ Differential Revision: http://reviews.llvm.org/D18363 Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp?rev=264164&r1=264163&r2=264164&view=diff == --- cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp Wed Mar 23 11:14:12 2016 @@ -313,7 +313,7 @@ void CallAndMessageChecker::checkPreStmt if (L.isUndef()) { if (!BT_call_undef) BT_call_undef.reset(new BuiltinBug( - this, "Called function pointer is an uninitalized pointer value")); + this, "Called function pointer is an uninitialized pointer value")); emitBadCall(BT_call_undef.get(), C, Callee); return; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D18363: Fix typo s/initalize/initialize/
This revision was automatically updated to reflect the committed changes. Closed by commit rL264164: [analyzer] Fix typo s/initalize/initialize/ (authored by chh). Changed prior to commit: http://reviews.llvm.org/D18363?vs=51307&id=51429#toc Repository: rL LLVM http://reviews.llvm.org/D18363 Files: cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp Index: cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp === --- cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp +++ cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp @@ -313,7 +313,7 @@ if (L.isUndef()) { if (!BT_call_undef) BT_call_undef.reset(new BuiltinBug( - this, "Called function pointer is an uninitalized pointer value")); + this, "Called function pointer is an uninitialized pointer value")); emitBadCall(BT_call_undef.get(), C, Callee); return; } Index: cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp === --- cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp +++ cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp @@ -313,7 +313,7 @@ if (L.isUndef()) { if (!BT_call_undef) BT_call_undef.reset(new BuiltinBug( - this, "Called function pointer is an uninitalized pointer value")); + this, "Called function pointer is an uninitialized pointer value")); emitBadCall(BT_call_undef.get(), C, Callee); return; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [Diffusion] rL257984: [Cygwin] Use -femulated-tls by default since r257718 introduced the new pass.
Glad to see that emutls is useful for Cygwin too. The diff in rL257984 do not look like depending on rL257718. It might work with my earlier implementation of emutls, before rL257718. Anyway, I did not test on Cygwin, and don't care if rL257984 is in 3.8 or not. Thanks. On Tue, Jan 19, 2016 at 4:01 PM, NAKAMURA Takumi wrote: > Ah yes, I was confused. No need to pick up r257984. Sorry for the noise. > > On Wed, Jan 20, 2016 at 8:54 AM Hans Wennborg wrote: > >> On Tue, Jan 19, 2016 at 3:43 PM, NAKAMURA Takumi >> wrote: >> > May I push it (llvm and clang) into release_38? >> > It depends on r257718. >> >> r257718 was committed after the branch. Are you suggesting we merge that >> too? >> >> This looks like a pretty significant change. Can't it wait until 3.9? >> >> >> > 2016-01-16 12:48 GMT+09:00 NAKAMURA Takumi : >> >> chapuni committed rL257984: [Cygwin] Use -femulated-tls by default >> since r257718 introduced the new pass.. >> >> >> >> [Cygwin] Use -femulated-tls by default since r257718 introduced the >> new pass. >> >> >> >> FIXME: Add more targets to use emutls into >> clang/test/Driver/emulated-tls.cpp. >> >> FIXME: Add cygwin tests into llvm/test/CodeGen/X86. Working in >> progress. >> >> >> >> >> >> Files: >> >> /cfe/trunk/docs/ReleaseNotes.rst >> >> /cfe/trunk/lib/Driver/Tools.cpp >> >> /cfe/trunk/test/Driver/emulated-tls.cpp >> >> /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp >> >> >> >> PATCH >> >> >> >> Index: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp >> >> === >> >> --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (revision >> 257983) >> >> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (revision >> 257984) >> >> @@ -12477,17 +12477,13 @@ >> >> >> >>GlobalAddressSDNode *GA = cast(Op); >> >> >> >> - // Cygwin uses emutls. >> >> - // FIXME: It may be EmulatedTLS-generic also for X86-Android. >> >> - if (Subtarget->isTargetWindowsCygwin()) >> >> + if (DAG.getTarget().Options.EmulatedTLS) >> >> return LowerToTLSEmulatedModel(GA, DAG); >> >> >> >>const GlobalValue *GV = GA->getGlobal(); >> >>auto PtrVT = getPointerTy(DAG.getDataLayout()); >> >> >> >>if (Subtarget->isTargetELF()) { >> >> -if (DAG.getTarget().Options.EmulatedTLS) >> >> - return LowerToTLSEmulatedModel(GA, DAG); >> >> TLSModel::Model model = DAG.getTarget().getTLSModel(GV); >> >> switch (model) { >> >>case TLSModel::GeneralDynamic: >> >> Index: cfe/trunk/test/Driver/emulated-tls.cpp >> >> === >> >> --- cfe/trunk/test/Driver/emulated-tls.cpp (revision 0) >> >> +++ cfe/trunk/test/Driver/emulated-tls.cpp (revision 257984) >> >> @@ -0,0 +1,5 @@ >> >> +// Cygwin uses emutls. Clang should pass -femulated-tls to cc1 and >> cc1 should pass EmulatedTLS to LLVM CodeGen. >> >> +// FIXME: Add more targets here to use emutls. >> >> +// RUN: %clang -### -std=c++11 -target i686-pc-cygwin %s 2>&1 | >> FileCheck %s >> >> + >> >> +// CHECK: "-cc1" {{.*}}"-femulated-tls" >> >> Index: cfe/trunk/docs/ReleaseNotes.rst >> >> === >> >> --- cfe/trunk/docs/ReleaseNotes.rst (revision 257983) >> >> +++ cfe/trunk/docs/ReleaseNotes.rst (revision 257984) >> >> @@ -74,6 +74,8 @@ >> >> >> >> Clang's support for building native Windows programs ... >> >> >> >> +TLS is enabled for Cygwin defaults to -femulated-tls. >> >> + >> >> >> >> C Language Changes in Clang >> >> --- >> >> Index: cfe/trunk/lib/Driver/Tools.cpp >> >> === >> >> --- cfe/trunk/lib/Driver/Tools.cpp (revision 257983) >> >> +++ cfe/trunk/lib/Driver/Tools.cpp (revision 257984) >> >> @@ -4597,7 +4597,7 @@ >> >>Args.AddLastArg(CmdArgs, options::OPT_fno_operator_names); >> >>// Emulated TLS is enabled by default on Android, and can be >> enabled manually >> >>// with -femulated-tls. >> >> - bool EmulatedTLSDefault = Triple.isAndroid(); >> >> + bool EmulatedTLSDefault = Triple.isAndroid() || >> Triple.isWindowsCygwinEnvironment(); >> >>if (Args.hasFlag(options::OPT_femulated_tls, >> options::OPT_fno_emulated_tls, >> >> EmulatedTLSDefault)) >> >> CmdArgs.push_back("-femulated-tls"); >> >> >> >> Users: >> >> chapuni (Author) >> >> >> >> http://reviews.llvm.org/rL257984 >> >> >> >> >> >> >> > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits