[PATCH] D26966: [clang-move] Add some options allowing to add old/new.h to new/old.h respectively.
hokein updated this revision to Diff 79043. hokein marked 8 inline comments as done. hokein added a comment. Update comments. https://reviews.llvm.org/D26966 Files: clang-move/ClangMove.cpp clang-move/ClangMove.h clang-move/tool/ClangMoveMain.cpp unittests/clang-move/ClangMoveTests.cpp Index: unittests/clang-move/ClangMoveTests.cpp === --- unittests/clang-move/ClangMoveTests.cpp +++ unittests/clang-move/ClangMoveTests.cpp @@ -419,6 +419,54 @@ EXPECT_EQ(ExpectedNewHeader, Results[Spec.NewHeader]); } +TEST(ClangMove, AddDependentNewHeader) { + const char TestHeader[] = "class A {};\n" + "class B {};\n"; + const char TestCode[] = "#include \"foo.h\"\n"; + const char ExpectedOldHeader[] = "#include \"new_foo.h\"\nclass B {};\n"; + const char ExpectedNewHeader[] = "#ifndef NEW_FOO_H\n" + "#define NEW_FOO_H\n" + "\n" + "class A {};\n" + "\n" + "#endif // NEW_FOO_H\n"; + move::ClangMoveTool::MoveDefinitionSpec Spec; + Spec.Names.push_back("A"); + Spec.OldHeader = "foo.h"; + Spec.OldCC = "foo.cc"; + Spec.NewHeader = "new_foo.h"; + Spec.NewCC = "new_foo.cc"; + Spec.OldDependOnNew = true; + auto Results = runClangMoveOnCode(Spec, TestHeader, TestCode); + EXPECT_EQ(ExpectedOldHeader, Results[Spec.OldHeader]); + EXPECT_EQ(ExpectedNewHeader, Results[Spec.NewHeader]); +} + +TEST(ClangMove, AddDependentOldHeader) { + const char TestHeader[] = "class A {};\n" +"class B {};\n"; + const char TestCode[] = "#include \"foo.h\"\n"; + const char ExpectedNewHeader[] = "#ifndef NEW_FOO_H\n" + "#define NEW_FOO_H\n" + "\n" + "#include \"foo.h\"\n" + "\n" + "class B {};\n" + "\n" + "#endif // NEW_FOO_H\n"; + const char ExpectedOldHeader[] = "class A {};\n"; + move::ClangMoveTool::MoveDefinitionSpec Spec; + Spec.Names.push_back("B"); + Spec.OldHeader = "foo.h"; + Spec.OldCC = "foo.cc"; + Spec.NewHeader = "new_foo.h"; + Spec.NewCC = "new_foo.cc"; + Spec.NewDependOnOld = true; + auto Results = runClangMoveOnCode(Spec, TestHeader, TestCode); + EXPECT_EQ(ExpectedNewHeader, Results[Spec.NewHeader]); + EXPECT_EQ(ExpectedOldHeader, Results[Spec.OldHeader]); +} + } // namespace } // namespce move } // namespace clang Index: clang-move/tool/ClangMoveMain.cpp === --- clang-move/tool/ClangMoveMain.cpp +++ clang-move/tool/ClangMoveMain.cpp @@ -61,6 +61,20 @@ NewCC("new_cc", cl::desc("The relative/absolute file path of new cc."), cl::cat(ClangMoveCategory)); +cl::opt OldDependOnNew( +"old_depend_on_new", +cl::desc( +"Whether old header will depend on new header. If true, clang-move will " +"add #include of new header to old header."), +cl::init(false), cl::cat(ClangMoveCategory)); + +cl::opt NewDependOnOld( +"new_depend_on_old", +cl::desc( +"Whether new header will depend on old header. If true, clang-move will " +"add #include of old header to new header."), +cl::init(false), cl::cat(ClangMoveCategory)); + cl::opt Style("style", cl::desc("The style name used for reformatting. Default is \"llvm\""), @@ -87,14 +101,23 @@ tooling::CommonOptionsParser OptionsParser(Argc, RawExtraArgs.get(), ClangMoveCategory); + if (OldDependOnNew && NewDependOnOld) { +llvm::errs() << "Provide either --old_depend_on_new or " +"--new_depend_on_old. clang-move doesn't support these two " +"options at same time (It will introduce include cycle).\n"; +return 1; + } + tooling::RefactoringTool Tool(OptionsParser.getCompilations(), OptionsParser.getSourcePathList()); move::ClangMoveTool::MoveDefinitionSpec Spec; Spec.Names = {Names.begin(), Names.end()}; Spec.OldHeader = OldHeader; Spec.NewHeader = NewHeader; Spec.OldCC = OldCC; Spec.NewCC = NewCC; + Spec.OldDependOnNew = OldDependOnNew; + Spec.NewDependOnOld = NewDependOnOld; llvm::SmallString<128> InitialDirectory; if (std::error_code EC = llvm::sys::fs::current_path(InitialDirectory)) Index: clang-move/ClangMove.h === --- clang-move/ClangMove.h +++ clang-move/ClangMove.h @@ -15,6 +15,7 @@ #include "clang/Tooling/Core/Replacement.h" #include "clang/Tooling/Tooling.h" #include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/StringMap.h" #include #include #include @@ -52
[libcxx] r287749 - Fix __hash_table::max_size() on 32 bit systems
Author: ericwf Date: Wed Nov 23 03:16:12 2016 New Revision: 287749 URL: http://llvm.org/viewvc/llvm-project?rev=287749&view=rev Log: Fix __hash_table::max_size() on 32 bit systems Modified: libcxx/trunk/include/__hash_table libcxx/trunk/test/support/test_allocator.h Modified: libcxx/trunk/include/__hash_table URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__hash_table?rev=287749&r1=287748&r2=287749&view=diff == --- libcxx/trunk/include/__hash_table (original) +++ libcxx/trunk/include/__hash_table Wed Nov 23 03:16:12 2016 @@ -1005,8 +1005,7 @@ public: size_type max_size() const _NOEXCEPT { return std::min( -allocator_traits<__pointer_allocator>::max_size( - __bucket_list_.get_deleter().__alloc()), +__node_traits::max_size(__node_alloc()), numeric_limits::max() ); } Modified: libcxx/trunk/test/support/test_allocator.h URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_allocator.h?rev=287749&r1=287748&r2=287749&view=diff == --- libcxx/trunk/test/support/test_allocator.h (original) +++ libcxx/trunk/test/support/test_allocator.h Wed Nov 23 03:16:12 2016 @@ -21,7 +21,8 @@ #include "test_macros.h" template -inline size_t alloc_max_size(Alloc const &a) { +inline typename std::allocator_traits::size_type +alloc_max_size(Alloc const &a) { typedef std::allocator_traits AT; return AT::max_size(a); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27005: [lit] Support custom parsers in parseIntegratedTestScript
EricWF added a comment. In https://reviews.llvm.org/D27005#603692, @jroelofs wrote: > Should probably add a testcase in lit/tests that exercises the new CUSTOM > parser stuff, so people working on LIT don't have to build/test libc++ in > order to know whether they've broken its testsuite. I plan to implement tests. I just wanted to ensure the approach was agreeable first. https://reviews.llvm.org/D27005 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26587: [AVX512][inline-asm] Fix AVX512 inline assembly instruction resolution when the size qualifier of a memory operand is not specified explicitly.
myatsina accepted this revision. myatsina added a comment. This revision is now accepted and ready to land. LGTM Please emphasize in you commit message that this the test case for the llvm commit (and even better if you add the commit number of the llvm commit), Repository: rL LLVM https://reviews.llvm.org/D26587 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26904: [astimporter] Support importing CXXDependentScopeMemberExpr and FunctionTemplateDecl
a.sidorin requested changes to this revision. a.sidorin added a subscriber: aaron.ballman. a.sidorin added a comment. This revision now requires changes to proceed. Hello Kareem, Thank you for working on it! You can find my comments below. Comment at: include/clang/ASTMatchers/ASTMatchers.h:5459 +/// \endcode +const internal::VariadicDynCastAllOfMatcher + cxxDependentScopeMemberExpr; I'd prefer to have a discussion with ASTMatcher developers (@aaron.ballman, @klimek) first. Maybe it is better to place this matcher into ASTImporterTest.cpp - as I understand, it will be used very rarely. Comment at: lib/AST/ASTImporter.cpp:3495 +return nullptr; + if (!DC) +return nullptr; If `DC` is `nullptr`, we should return on the previous line - `ImportDeclParts` returns `true` in this case. We may turn it into an assertion, however. Comment at: lib/AST/ASTImporter.cpp:3509 + + return FunctionTemplateDecl::Create(Importer.getToContext(), DC, Loc, + Name, Params, ToDecl); Seems like we don't attempt to lookup an existing declaration first. This may lead to appearance of multiple definitions of same decl. I'd also prefer to see a functional test for this in test/ASTMerge. You can also refer to https://github.com/haoNoQ/clang/blob/summary-ipa-draft/lib/AST/ASTImporter.cpp#L3594 because some important parts (setting of lexical decl context, adding a decl to the imported map) are missed here. https://reviews.llvm.org/D26904 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26934: [libc++] Add _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
EricWF added a comment. There are two usages of `_LIBCPP_DISABLE_DLL_IMPORT_EXPORT` in `CMakeLists.txt` and `__config_site.in` that need to be changed as well. Also what about users of the existing name `_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS`? Should we #error to inform them of the change or should we automatically translate it to the new name for them? https://reviews.llvm.org/D26934 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26896: [libcxx] Make constexpr char_traits and char_traits
EricWF added a comment. Could you please generate this patch with more context? (ie with -U999 or similar). Comment at: include/__config:925 +#if !__has_builtin(__builtin_memcpy) +#define _LIBCPP_HAS_NO_BUILTIN_MEMCPY What about GCC? Surely it implements some if not most of these. https://reviews.llvm.org/D26896 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26896: [libcxx] Make constexpr char_traits and char_traits
EricWF added inline comments. Comment at: include/__string:213 -static inline int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{return __n == 0 ? 0 : memcmp(__s1, __s2, __n);} -static inline size_t length(const char_type* __s) _NOEXCEPT {return strlen(__s);} -static inline const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT -{return __n == 0 ? NULL : (const char_type*) memchr(__s, to_int_type(__a), __n);} +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) +static inline constexpr int wow. This is #ifdef hell. Please find a way to do it with less (or hopefully no) conditional compilation blocks. https://reviews.llvm.org/D26896 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26979: Do not hard-code locale data in unit tests: get it from the OS instead
EricWF added a comment. In https://reviews.llvm.org/D26979#603110, @vangyzen wrote: > @EricWF, would you like to see anything more from me? I could set up an LLVM > development environment on my Mac if you want me to run the unit tests on Mac. Nope. Feel free to commit after adding the requested assertions. Comment at: test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp:65 +{ +expected = *std::localeconv()->thousands_sep; +(void) std::setlocale(LC_NUMERIC, "C"); We should probably assert that `thousands_sep` isn't a multibyte character. https://reviews.llvm.org/D26979 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26966: [clang-move] Add some options allowing to add old/new.h to new/old.h respectively.
ioeric accepted this revision. ioeric added a comment. This revision is now accepted and ready to land. Lg. Comment at: unittests/clang-move/ClangMoveTests.cpp:424 + const char TestHeader[] = "class A {};\n" + "class B {};\n"; + const char TestCode[] = "#include \"foo.h\"\n"; Is this indented correctly? or just phabricator bug? https://reviews.llvm.org/D26966 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26966: [clang-move] Add some options allowing to add old/new.h to new/old.h respectively.
hokein updated this revision to Diff 79046. hokein marked an inline comment as done. hokein added a comment. Fix code indentation. https://reviews.llvm.org/D26966 Files: clang-move/ClangMove.cpp clang-move/ClangMove.h clang-move/tool/ClangMoveMain.cpp unittests/clang-move/ClangMoveTests.cpp Index: unittests/clang-move/ClangMoveTests.cpp === --- unittests/clang-move/ClangMoveTests.cpp +++ unittests/clang-move/ClangMoveTests.cpp @@ -419,6 +419,54 @@ EXPECT_EQ(ExpectedNewHeader, Results[Spec.NewHeader]); } +TEST(ClangMove, AddDependentNewHeader) { + const char TestHeader[] = "class A {};\n" +"class B {};\n"; + const char TestCode[] = "#include \"foo.h\"\n"; + const char ExpectedOldHeader[] = "#include \"new_foo.h\"\nclass B {};\n"; + const char ExpectedNewHeader[] = "#ifndef NEW_FOO_H\n" + "#define NEW_FOO_H\n" + "\n" + "class A {};\n" + "\n" + "#endif // NEW_FOO_H\n"; + move::ClangMoveTool::MoveDefinitionSpec Spec; + Spec.Names.push_back("A"); + Spec.OldHeader = "foo.h"; + Spec.OldCC = "foo.cc"; + Spec.NewHeader = "new_foo.h"; + Spec.NewCC = "new_foo.cc"; + Spec.OldDependOnNew = true; + auto Results = runClangMoveOnCode(Spec, TestHeader, TestCode); + EXPECT_EQ(ExpectedOldHeader, Results[Spec.OldHeader]); + EXPECT_EQ(ExpectedNewHeader, Results[Spec.NewHeader]); +} + +TEST(ClangMove, AddDependentOldHeader) { + const char TestHeader[] = "class A {};\n" +"class B {};\n"; + const char TestCode[] = "#include \"foo.h\"\n"; + const char ExpectedNewHeader[] = "#ifndef NEW_FOO_H\n" + "#define NEW_FOO_H\n" + "\n" + "#include \"foo.h\"\n" + "\n" + "class B {};\n" + "\n" + "#endif // NEW_FOO_H\n"; + const char ExpectedOldHeader[] = "class A {};\n"; + move::ClangMoveTool::MoveDefinitionSpec Spec; + Spec.Names.push_back("B"); + Spec.OldHeader = "foo.h"; + Spec.OldCC = "foo.cc"; + Spec.NewHeader = "new_foo.h"; + Spec.NewCC = "new_foo.cc"; + Spec.NewDependOnOld = true; + auto Results = runClangMoveOnCode(Spec, TestHeader, TestCode); + EXPECT_EQ(ExpectedNewHeader, Results[Spec.NewHeader]); + EXPECT_EQ(ExpectedOldHeader, Results[Spec.OldHeader]); +} + } // namespace } // namespce move } // namespace clang Index: clang-move/tool/ClangMoveMain.cpp === --- clang-move/tool/ClangMoveMain.cpp +++ clang-move/tool/ClangMoveMain.cpp @@ -61,6 +61,20 @@ NewCC("new_cc", cl::desc("The relative/absolute file path of new cc."), cl::cat(ClangMoveCategory)); +cl::opt OldDependOnNew( +"old_depend_on_new", +cl::desc( +"Whether old header will depend on new header. If true, clang-move will " +"add #include of new header to old header."), +cl::init(false), cl::cat(ClangMoveCategory)); + +cl::opt NewDependOnOld( +"new_depend_on_old", +cl::desc( +"Whether new header will depend on old header. If true, clang-move will " +"add #include of old header to new header."), +cl::init(false), cl::cat(ClangMoveCategory)); + cl::opt Style("style", cl::desc("The style name used for reformatting. Default is \"llvm\""), @@ -87,14 +101,23 @@ tooling::CommonOptionsParser OptionsParser(Argc, RawExtraArgs.get(), ClangMoveCategory); + if (OldDependOnNew && NewDependOnOld) { +llvm::errs() << "Provide either --old_depend_on_new or " +"--new_depend_on_old. clang-move doesn't support these two " +"options at same time (It will introduce include cycle).\n"; +return 1; + } + tooling::RefactoringTool Tool(OptionsParser.getCompilations(), OptionsParser.getSourcePathList()); move::ClangMoveTool::MoveDefinitionSpec Spec; Spec.Names = {Names.begin(), Names.end()}; Spec.OldHeader = OldHeader; Spec.NewHeader = NewHeader; Spec.OldCC = OldCC; Spec.NewCC = NewCC; + Spec.OldDependOnNew = OldDependOnNew; + Spec.NewDependOnOld = NewDependOnOld; llvm::SmallString<128> InitialDirectory; if (std::error_code EC = llvm::sys::fs::current_path(InitialDirectory)) Index: clang-move/ClangMove.h === --- clang-move/ClangMove.h +++ clang-move/ClangMove.h @@ -15,6 +15,7 @@ #include "clang/Tooling/Core/Replacement.h" #include "clang/Tooling/Tooling.h" #include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/StringMap.h" #include #include #include @@ -52
[clang-tools-extra] r287752 - [clang-move] Add some options allowing to add old/new.h to new/old.h respectively.
Author: hokein Date: Wed Nov 23 04:04:19 2016 New Revision: 287752 URL: http://llvm.org/viewvc/llvm-project?rev=287752&view=rev Log: [clang-move] Add some options allowing to add old/new.h to new/old.h respectively. Summary: * --new_depend_on_old: new header will include old header * --old_depend_on_new: old header will include new header. Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26966 Modified: clang-tools-extra/trunk/clang-move/ClangMove.cpp clang-tools-extra/trunk/clang-move/ClangMove.h clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp Modified: clang-tools-extra/trunk/clang-move/ClangMove.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/ClangMove.cpp?rev=287752&r1=287751&r2=287752&view=diff == --- clang-tools-extra/trunk/clang-move/ClangMove.cpp (original) +++ clang-tools-extra/trunk/clang-move/ClangMove.cpp Wed Nov 23 04:04:19 2016 @@ -150,7 +150,7 @@ public: MoveTool->getMovedDecls().emplace_back(D, &Result.Context->getSourceManager()); MoveTool->getUnremovedDeclsInOldHeader().erase(D); -MoveTool->getRemovedDecls().push_back(MoveTool->getMovedDecls().back()); +MoveTool->addRemovedDecl(MoveTool->getMovedDecls().back()); } private: @@ -181,7 +181,7 @@ private: // case. if (!CMD->isInlined()) { MoveTool->getMovedDecls().emplace_back(CMD, SM); - MoveTool->getRemovedDecls().push_back(MoveTool->getMovedDecls().back()); + MoveTool->addRemovedDecl(MoveTool->getMovedDecls().back()); // Get template class method from its method declaration as // UnremovedDecls stores template class method. if (const auto *FTD = CMD->getDescribedFunctionTemplate()) @@ -194,7 +194,7 @@ private: void MatchClassStaticVariable(const clang::NamedDecl *VD, clang::SourceManager* SM) { MoveTool->getMovedDecls().emplace_back(VD, SM); -MoveTool->getRemovedDecls().push_back(MoveTool->getMovedDecls().back()); +MoveTool->addRemovedDecl(MoveTool->getMovedDecls().back()); MoveTool->getUnremovedDeclsInOldHeader().erase(VD); } @@ -206,7 +206,7 @@ private: MoveTool->getMovedDecls().emplace_back(TC, SM); else MoveTool->getMovedDecls().emplace_back(CD, SM); -MoveTool->getRemovedDecls().push_back(MoveTool->getMovedDecls().back()); +MoveTool->addRemovedDecl(MoveTool->getMovedDecls().back()); MoveTool->getUnremovedDeclsInOldHeader().erase( MoveTool->getMovedDecls().back().Decl); } @@ -305,7 +305,8 @@ std::vector GetNamespaces(c clang::tooling::Replacements createInsertedReplacements(const std::vector &Includes, const std::vector &Decls, - llvm::StringRef FileName, bool IsHeader = false) { + llvm::StringRef FileName, bool IsHeader = false, + StringRef OldHeaderInclude = "") { std::string NewCode; std::string GuardName(FileName); if (IsHeader) { @@ -318,6 +319,7 @@ createInsertedReplacements(const std::ve NewCode += "#define " + GuardName + "\n\n"; } + NewCode += OldHeaderInclude; // Add #Includes. for (const auto &Include : Includes) NewCode += Include; @@ -410,6 +412,14 @@ ClangMoveTool::ClangMoveTool( CCIncludes.push_back("#include \"" + Spec.NewHeader + "\"\n"); } +void ClangMoveTool::addRemovedDecl(const MovedDecl &Decl) { + const auto &SM = *Decl.SM; + auto Loc = Decl.Decl->getLocation(); + StringRef FilePath = SM.getFilename(Loc); + FilePathToFileID[FilePath] = SM.getFileID(Loc); + RemovedDecls.push_back(Decl); +} + void ClangMoveTool::registerMatchers(ast_matchers::MatchFinder *Finder) { Optional> HasAnySymbolNames; for (StringRef SymbolName: Spec.Names) { @@ -575,22 +585,40 @@ void ClangMoveTool::addIncludes(llvm::St } void ClangMoveTool::removeClassDefinitionInOldFiles() { + if (RemovedDecls.empty()) return; for (const auto &MovedDecl : RemovedDecls) { const auto &SM = *MovedDecl.SM; auto Range = GetFullRange(&SM, MovedDecl.Decl); clang::tooling::Replacement RemoveReplacement( -*MovedDecl.SM, +SM, clang::CharSourceRange::getCharRange(Range.getBegin(), Range.getEnd()), ""); std::string FilePath = RemoveReplacement.getFilePath().str(); auto Err = FileToReplacements[FilePath].add(RemoveReplacement); -if (Err) { +if (Err) llvm::errs() << llvm::toString(std::move(Err)) << "\n"; - continue; + } + const SourceManager* SM = RemovedDecls[0].SM; + + // Post process of cleanup around all the replacements. + for (auto& FileAndReplacements: FileToReplacements) { +StringRef FilePath = FileAndReplacements.first; +// Add #include of new he
[PATCH] D26966: [clang-move] Add some options allowing to add old/new.h to new/old.h respectively.
This revision was automatically updated to reflect the committed changes. Closed by commit rL287752: [clang-move] Add some options allowing to add old/new.h to new/old.h… (authored by hokein). Changed prior to commit: https://reviews.llvm.org/D26966?vs=79046&id=79047#toc Repository: rL LLVM https://reviews.llvm.org/D26966 Files: clang-tools-extra/trunk/clang-move/ClangMove.cpp clang-tools-extra/trunk/clang-move/ClangMove.h clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp Index: clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp === --- clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp +++ clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp @@ -419,6 +419,54 @@ EXPECT_EQ(ExpectedNewHeader, Results[Spec.NewHeader]); } +TEST(ClangMove, AddDependentNewHeader) { + const char TestHeader[] = "class A {};\n" +"class B {};\n"; + const char TestCode[] = "#include \"foo.h\"\n"; + const char ExpectedOldHeader[] = "#include \"new_foo.h\"\nclass B {};\n"; + const char ExpectedNewHeader[] = "#ifndef NEW_FOO_H\n" + "#define NEW_FOO_H\n" + "\n" + "class A {};\n" + "\n" + "#endif // NEW_FOO_H\n"; + move::ClangMoveTool::MoveDefinitionSpec Spec; + Spec.Names.push_back("A"); + Spec.OldHeader = "foo.h"; + Spec.OldCC = "foo.cc"; + Spec.NewHeader = "new_foo.h"; + Spec.NewCC = "new_foo.cc"; + Spec.OldDependOnNew = true; + auto Results = runClangMoveOnCode(Spec, TestHeader, TestCode); + EXPECT_EQ(ExpectedOldHeader, Results[Spec.OldHeader]); + EXPECT_EQ(ExpectedNewHeader, Results[Spec.NewHeader]); +} + +TEST(ClangMove, AddDependentOldHeader) { + const char TestHeader[] = "class A {};\n" +"class B {};\n"; + const char TestCode[] = "#include \"foo.h\"\n"; + const char ExpectedNewHeader[] = "#ifndef NEW_FOO_H\n" + "#define NEW_FOO_H\n" + "\n" + "#include \"foo.h\"\n" + "\n" + "class B {};\n" + "\n" + "#endif // NEW_FOO_H\n"; + const char ExpectedOldHeader[] = "class A {};\n"; + move::ClangMoveTool::MoveDefinitionSpec Spec; + Spec.Names.push_back("B"); + Spec.OldHeader = "foo.h"; + Spec.OldCC = "foo.cc"; + Spec.NewHeader = "new_foo.h"; + Spec.NewCC = "new_foo.cc"; + Spec.NewDependOnOld = true; + auto Results = runClangMoveOnCode(Spec, TestHeader, TestCode); + EXPECT_EQ(ExpectedNewHeader, Results[Spec.NewHeader]); + EXPECT_EQ(ExpectedOldHeader, Results[Spec.OldHeader]); +} + } // namespace } // namespce move } // namespace clang Index: clang-tools-extra/trunk/clang-move/ClangMove.h === --- clang-tools-extra/trunk/clang-move/ClangMove.h +++ clang-tools-extra/trunk/clang-move/ClangMove.h @@ -15,6 +15,7 @@ #include "clang/Tooling/Core/Replacement.h" #include "clang/Tooling/Tooling.h" #include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/StringMap.h" #include #include #include @@ -52,6 +53,12 @@ std::string NewHeader; // The file path of new cc, can be relative path and absolute path. std::string NewCC; +// Whether old.h depends on new.h. If true, #include "new.h" will be added +// in old.h. +bool OldDependOnNew = false; +// Whether new.h depends on old.h. If true, #include "old.h" will be added +// in new.h. +bool NewDependOnOld = false; }; ClangMoveTool( @@ -83,7 +90,10 @@ std::vector &getMovedDecls() { return MovedDecls; } - std::vector &getRemovedDecls() { return RemovedDecls; } + /// Add declarations being removed from old.h/cc. For each declarations, the + /// method also records the mapping relationship between the corresponding + /// FilePath and its FileID. + void addRemovedDecl(const MovedDecl &Decl); llvm::SmallPtrSet &getUnremovedDeclsInOldHeader() { return UnremovedDeclsInOldHeader; @@ -127,6 +137,9 @@ /// #include "old.h") in old.cc, including the enclosing quotes or angle /// brackets. clang::CharSourceRange OldHeaderIncludeRange; + /// Mapping from FilePath to FileID, which can be used in post processes like + /// cleanup around replacements. + llvm::StringMap FilePathToFileID; }; class ClangMoveAction : public clang::ASTFrontendAction { Index: clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp === --- clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp +++ clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cp
[PATCH] D27033: [ASTImporter] Support importing UnresolvedLookupExpr nodes
a.sidorin requested changes to this revision. a.sidorin added a reviewer: a.sidorin. a.sidorin added a comment. This revision now requires changes to proceed. Hi Kareem! I'll be happy to see this changes in upstream. Please see my comments inline. Comment at: lib/AST/ASTImporter.cpp:6492 + UnresolvedSet<8> ToDecls; + for (UnresolvedLookupExpr::decls_iterator S = E->decls_begin(), +F = E->decls_end(); `auto` will look nice here. Comment at: lib/AST/ASTImporter.cpp:6501 + + return UnresolvedLookupExpr::Create(Importer.getToContext(), NamingClass, + E->getQualifierLoc(), NameInfo, UnresolvedLookupExpr::Create is overloaded for different use cases and it seems like some of them are not covered here. You may refer to https://github.com/haoNoQ/clang/blob/summary-ipa-draft/lib/AST/ASTImporter.cpp#L7499 for some implementation details. Comment at: lib/AST/ASTImporter.cpp:6502 + return UnresolvedLookupExpr::Create(Importer.getToContext(), NamingClass, + E->getQualifierLoc(), NameInfo, + E->requiresADL(), E->isOverloaded(), QualifierLoc needs to be imported: it may refer to decls in the "from" context. https://reviews.llvm.org/D27033 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27039: [CodeCompletion] Autocomplete NS_DESIGNATED_INITIALIZER in initializers with arguments
arphaman created this revision. arphaman added reviewers: manmanren, akyrtzi. arphaman added a subscriber: cfe-commits. arphaman set the repository for this revision to rL LLVM. This patch ensures that clang provides NS_DESIGNATED_INITIALIZER code completion result for an initializer method with arguments. Repository: rL LLVM https://reviews.llvm.org/D27039 Files: lib/Sema/SemaCodeComplete.cpp test/Index/complete-designated-initializer.m Index: test/Index/complete-designated-initializer.m === --- /dev/null +++ test/Index/complete-designated-initializer.m @@ -0,0 +1,43 @@ +// Note: the run lines follow their respective tests, since line/column +// matter in this test. + +// rdar://21014571 + +#define NS_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) + +@interface DesignatedInitializerCompletion + +- (instancetype)init ; +- (instancetype)initWithFoo:(int)foo ; +- (instancetype)initWithX:(int)x andY:(int)y ; + +@end + +@implementation DesignatedInitializerCompletion + +- (instancetype)init { +} + +- (instancetype)initWithFoo:(int)foo { +} + +- (instancetype)initWithX:(int)x andY:(int)y { +} + +@end + +// RUN: c-index-test -code-completion-at=%s:10:22 %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:11:38 %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:11:29 %s | FileCheck -check-prefix=CHECK-NONE %s +// RUN: c-index-test -code-completion-at=%s:11:34 %s | FileCheck -check-prefix=CHECK-NONE %s +// RUN: c-index-test -code-completion-at=%s:12:34 %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:12:46 %s | FileCheck %s + +// RUN: c-index-test -code-completion-at=%s:18:22 %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:21:38 %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:24:34 %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:24:46 %s | FileCheck %s + +// CHECK: macro definition:{TypedText NS_DESIGNATED_INITIALIZER} (70) + +// CHECK-NONE-NOT: NS_DESIGNATED_INITIALIZER Index: lib/Sema/SemaCodeComplete.cpp === --- lib/Sema/SemaCodeComplete.cpp +++ lib/Sema/SemaCodeComplete.cpp @@ -7420,6 +7420,24 @@ } Results.ExitScope(); + + if (!AtParameterName && !SelIdents.empty() && + SelIdents.front()->getName().startswith("init") && + (!CodeCompleter || CodeCompleter->includeMacros())) { +for (const auto &M : PP.macros()) { + if (M.first->getName() != "NS_DESIGNATED_INITIALIZER") +continue; + Results.EnterNewScope(); + CodeCompletionBuilder Builder(Results.getAllocator(), +Results.getCodeCompletionTUInfo()); + Builder.AddTypedTextChunk( + Builder.getAllocator().CopyString(M.first->getName())); + Results.AddResult(CodeCompletionResult(Builder.TakeString(), CCP_Macro, + CXCursor_MacroDefinition)); + Results.ExitScope(); +} + } + HandleCodeCompleteResults(this, CodeCompleter, CodeCompletionContext::CCC_Other, Results.data(),Results.size()); Index: test/Index/complete-designated-initializer.m === --- /dev/null +++ test/Index/complete-designated-initializer.m @@ -0,0 +1,43 @@ +// Note: the run lines follow their respective tests, since line/column +// matter in this test. + +// rdar://21014571 + +#define NS_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) + +@interface DesignatedInitializerCompletion + +- (instancetype)init ; +- (instancetype)initWithFoo:(int)foo ; +- (instancetype)initWithX:(int)x andY:(int)y ; + +@end + +@implementation DesignatedInitializerCompletion + +- (instancetype)init { +} + +- (instancetype)initWithFoo:(int)foo { +} + +- (instancetype)initWithX:(int)x andY:(int)y { +} + +@end + +// RUN: c-index-test -code-completion-at=%s:10:22 %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:11:38 %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:11:29 %s | FileCheck -check-prefix=CHECK-NONE %s +// RUN: c-index-test -code-completion-at=%s:11:34 %s | FileCheck -check-prefix=CHECK-NONE %s +// RUN: c-index-test -code-completion-at=%s:12:34 %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:12:46 %s | FileCheck %s + +// RUN: c-index-test -code-completion-at=%s:18:22 %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:21:38 %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:24:34 %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:24:46 %s | FileCheck %s + +// CHECK: macro definition:{TypedText NS_DESIGNATED_INITIALIZER} (70) + +// CHECK-NONE-NOT: NS_DESIGNATED_INITIALIZER Index: lib/Sema/SemaCodeComplete.cpp === --- lib/Sema/SemaCodeComplete.cpp
r287754 - [CodeGen] Simplify code. No functionality change intended.
Author: d0k Date: Wed Nov 23 05:20:27 2016 New Revision: 287754 URL: http://llvm.org/viewvc/llvm-project?rev=287754&view=rev Log: [CodeGen] Simplify code. No functionality change intended. Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=287754&r1=287753&r2=287754&view=diff == --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original) +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Wed Nov 23 05:20:27 2016 @@ -818,14 +818,7 @@ llvm::ConstantInt *CodeGenModule::Create llvm::MDString *MDS = dyn_cast(MD); if (!MDS) return nullptr; - llvm::MD5 md5; - llvm::MD5::MD5Result result; - md5.update(MDS->getString()); - md5.final(result); - uint64_t id = 0; - for (int i = 0; i < 8; ++i) -id |= static_cast(result[i]) << (i * 8); - return llvm::ConstantInt::get(Int64Ty, id); + return llvm::ConstantInt::get(Int64Ty, llvm::MD5Hash(MDS->getString())); } void CodeGenModule::setFunctionDefinitionAttributes(const FunctionDecl *D, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r287755 - [X86][AVX512VL] Add missing _mm256_maskz_alignr_epi64 shufflevector check
Author: rksimon Date: Wed Nov 23 05:38:52 2016 New Revision: 287755 URL: http://llvm.org/viewvc/llvm-project?rev=287755&view=rev Log: [X86][AVX512VL] Add missing _mm256_maskz_alignr_epi64 shufflevector check Missed in rL287733 Modified: cfe/trunk/test/CodeGen/avx512vl-builtins.c Modified: cfe/trunk/test/CodeGen/avx512vl-builtins.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512vl-builtins.c?rev=287755&r1=287754&r2=287755&view=diff == --- cfe/trunk/test/CodeGen/avx512vl-builtins.c (original) +++ cfe/trunk/test/CodeGen/avx512vl-builtins.c Wed Nov 23 05:38:52 2016 @@ -7007,6 +7007,7 @@ __m256i test_mm256_mask_alignr_epi64(__m __m256i test_mm256_maskz_alignr_epi64(__mmask8 __U, __m256i __A, __m256i __B) { // CHECK-LABEL: @test_mm256_maskz_alignr_epi64 + // CHECK: shufflevector <4 x i64> %{{.*}}, <4 x i64> %{{.*}}, <4 x i32> // CHECK: select <4 x i1> %{{.*}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}} return _mm256_maskz_alignr_epi64(__U, __A, __B, 1); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26753: ASTImporter: improve support for C++ templates
a.sidorin updated this revision to Diff 79054. a.sidorin added a comment. Add a simple test for import of complex `NestedNameSpecifierLoc`s. https://reviews.llvm.org/D26753 Files: include/clang/AST/TemplateBase.h lib/AST/ASTImporter.cpp test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp test/ASTMerge/class-template-partial-spec/test.cpp Index: test/ASTMerge/class-template-partial-spec/test.cpp === --- /dev/null +++ test/ASTMerge/class-template-partial-spec/test.cpp @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -emit-pch -std=c++1z -o %t.1.ast %S/Inputs/class-template-partial-spec1.cpp +// RUN: %clang_cc1 -emit-pch -std=c++1z -o %t.2.ast %S/Inputs/class-template-partial-spec2.cpp +// RUN: not %clang_cc1 -std=c++1z -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only %s 2>&1 | FileCheck %s + +static_assert(sizeof(**SingleSource.member) == sizeof(**SingleDest.member)); +static_assert(sizeof(SecondDoubleSource.member) == sizeof(SecondDoubleDest.member)); +static_assert(NumberSource.val == 42); +static_assert(sizeof(Z0Source.member) == sizeof(char)); +static_assert(sizeof(Dst::Z0Dst.member) == sizeof(double)); +static_assert(sizeof(One::Child1>::member) == sizeof(double)); + +// CHECK: /media/build/smrc-llvm/master/llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp:21:32: error: external variable 'X1' declared with incompatible types in different translation units ('TwoOptionTemplate' vs. 'TwoOptionTemplate') +// CHECK: /media/build/smrc-llvm/master/llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp:21:31: note: declared here with type 'TwoOptionTemplate' + +// CHECK: /media/build/smrc-llvm/master/llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp:24:29: error: external variable 'X4' declared with incompatible types in different translation units ('TwoOptionTemplate' vs. 'TwoOptionTemplate') +// CHECK: /media/build/smrc-llvm/master/llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp:24:33: note: declared here with type 'TwoOptionTemplate' + +// CHECK: /media/build/smrc-llvm/master/llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp:38:8: warning: type 'IntTemplateSpec<5, void *>' has incompatible definitions in different translation units +// CHECK: /media/build/smrc-llvm/master/llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp:39:7: note: field 'member' has type 'int' here +// CHECK: /media/build/smrc-llvm/master/llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp:39:10: note: field 'member' has type 'double' here + +// CHECK: /media/build/smrc-llvm/master/llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp:52:25: error: external variable 'Y3' declared with incompatible types in different translation units ('IntTemplateSpec<2, int>' vs. 'IntTemplateSpec<3, int>') +// CHECK: /media/build/smrc-llvm/master/llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp:52:25: note: declared here with type 'IntTemplateSpec<3, int>' + +// CHECK-NOT: static_assert Index: test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp === --- /dev/null +++ test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp @@ -0,0 +1,79 @@ +template +struct TwoOptionTemplate {}; + +template +struct TwoOptionTemplate { + int member; +}; + + +template +struct TwoOptionTemplate { + float member; +}; + +template +struct TwoOptionTemplate { + T** member; +}; + +TwoOptionTemplate X0; +TwoOptionTemplate X1; +TwoOptionTemplate X2; +TwoOptionTemplate X3; +TwoOptionTemplate X4; +TwoOptionTemplate SingleDest; +TwoOptionTemplate SecondDoubleDest; + + +template +struct IntTemplateSpec {}; + +template +struct IntTemplateSpec<4, C> { + C member; +}; + +template +struct IntTemplateSpec { + double member; + static constexpr int val = I; +}; + +template +struct IntTemplateSpec { + char member; + static constexpr int val = I; +}; + +IntTemplateSpec<4, wchar_t>Y0; +IntTemplateSpec<5, void *> Y1; +IntTemplateSpec<1, int> Y2; +IntTemplateSpec<2, int> Y3; +IntTemplateSpec<43, double> NumberDest; + +namespace One { +namespace Two { +namespace Three { + +template +class Parent {}; + +} // namespace Three + +} // namespace Two + +template +struct Child1: public Two::Three::Parent { + char member; +}; + +template +struct Child1> { + T member; +}; + +} // namespace One + +namespace Dst { One::Child1> Z0Dst; } +One::Child1 Z1; Index: test/ASTMerge/cla
[clang-tools-extra] r287758 - [clang-rename] Fix non-functional offset check.
Author: d0k Date: Wed Nov 23 07:10:07 2016 New Revision: 287758 URL: http://llvm.org/viewvc/llvm-project?rev=287758&view=rev Log: [clang-rename] Fix non-functional offset check. Adding something to a SourceLocation will only produce an invalid SourceLocation in edge cases (overflow or adding 0 to an invalid one). Check that the offset is inside the file instead and add a test case to verify that the error message works. Modified: clang-tools-extra/trunk/clang-rename/USRFindingAction.cpp Modified: clang-tools-extra/trunk/clang-rename/USRFindingAction.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-rename/USRFindingAction.cpp?rev=287758&r1=287757&r2=287758&view=diff == --- clang-tools-extra/trunk/clang-rename/USRFindingAction.cpp (original) +++ clang-tools-extra/trunk/clang-rename/USRFindingAction.cpp Wed Nov 23 07:10:07 2016 @@ -150,21 +150,20 @@ private: bool FindSymbol(ASTContext &Context, const SourceManager &SourceMgr, unsigned SymbolOffset, const std::string &QualifiedName) { DiagnosticsEngine &Engine = Context.getDiagnostics(); +const FileID MainFileID = SourceMgr.getMainFileID(); -const SourceLocation Point = -SourceMgr.getLocForStartOfFile(SourceMgr.getMainFileID()) -.getLocWithOffset(SymbolOffset); - -if (!Point.isValid()) { +if (SymbolOffset >= SourceMgr.getFileIDSize(MainFileID)) { ErrorOccurred = true; unsigned InvalidOffset = Engine.getCustomDiagID( DiagnosticsEngine::Error, "SourceLocation in file %0 at offset %1 is invalid"); - Engine.Report(Point, InvalidOffset) << SourceMgr.getFilename(Point) - << SymbolOffset; + Engine.Report(SourceLocation(), InvalidOffset) + << SourceMgr.getFileEntryForID(MainFileID)->getName() << SymbolOffset; return false; } +const SourceLocation Point = SourceMgr.getLocForStartOfFile(MainFileID) + .getLocWithOffset(SymbolOffset); const NamedDecl *FoundDecl = QualifiedName.empty() ? getNamedDeclAt(Context, Point) : getNamedDeclFor(Context, QualifiedName); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r287759 - [clang-rename] Add test case for r287758.
Author: d0k Date: Wed Nov 23 07:14:19 2016 New Revision: 287759 URL: http://llvm.org/viewvc/llvm-project?rev=287759&view=rev Log: [clang-rename] Add test case for r287758. Added: clang-tools-extra/trunk/test/clang-rename/InvalidOffset.cpp Added: clang-tools-extra/trunk/test/clang-rename/InvalidOffset.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/InvalidOffset.cpp?rev=287759&view=auto == --- clang-tools-extra/trunk/test/clang-rename/InvalidOffset.cpp (added) +++ clang-tools-extra/trunk/test/clang-rename/InvalidOffset.cpp Wed Nov 23 07:14:19 2016 @@ -0,0 +1,9 @@ +#include "Inputs/HeaderWithSymbol.h" +#define FOO int bar; +FOO + +int foo; + +// RUN: not clang-rename -new-name=qux -offset=259 %s -- 2>&1 | FileCheck %s +// CHECK-NOT: CHECK +// CHECK: error: SourceLocation in file {{.*}}InvalidOffset.cpp at offset 259 is invalid ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26328: [ASTImporter] Added ability to import AtomicType nodes
xazax.hun added a comment. Can he commit this? In case he is too busy, I can also commit this for you. https://reviews.llvm.org/D26328 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26838: [analyzer] Enforce super-region classes for various memory regions through compile-time and run-time type checks.
xazax.hun added a comment. In general I really like this change. See some of my comments inline. Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1279 /// associated element type, index, and super region. const ElementRegion *getElementRegion(QualType elementType, NonLoc Idx, +const SubRegion *superRegion, a.sidorin wrote: > I think we should perform a `cast<>` to `SubRegion` internally in order to > keep API simple and do not force clients to introduce casts in their code. > This will still allow us to keep nice suggestions about SubRegions/MemSpaces > in our hierarchy. I prefer having a stricter static type. Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1347 private: - template - RegionTy* getSubRegion(const A1 a1, const MemRegion* superRegion); + template + RegionTy* getSubRegion(const A1 a1, const SuperTy* superRegion); a.sidorin wrote: > Maybe we should give types and paramers some more meaningful names as a part > of refactoring? At least, the number in `A1` is not needed now. Agreed. Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:238 protected: - const MemRegion *MakeElementRegion(const MemRegion *baseRegion, + const MemRegion *MakeElementRegion(const SubRegion *baseRegion, QualType pointeeTy, uint64_t index = 0); Shouldn't the return value be at least a SubRegion as well? Comment at: lib/StaticAnalyzer/Core/ExprEngineCXX.cpp:492 +const SubRegion *NewReg = +cast(symVal.castAs().getRegion()); QualType ObjTy = CNE->getType()->getAs()->getPointeeType(); Maybe using getRegionAs would be shorter? Comment at: lib/StaticAnalyzer/Core/Store.cpp:439 + const SubRegion *BaseRegion = + cast(Base.castAs().getRegion()); Also consider getRegionAs. https://reviews.llvm.org/D26838 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26837: [analyzer] Litter the SVal/SymExpr/MemRegion class hierarchy with asserts.
xazax.hun added a comment. LGTM! https://reviews.llvm.org/D26837 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27043: Remove assertion on analysis of rvalue vector
FlameTop created this revision. FlameTop added reviewers: zaks.anna, dcoughlin. FlameTop added a subscriber: cfe-commits. ExprEngine::VisitLvalArraySubscriptExpr contains an assert to ensure it is passed either a GLvalue or a small number of C exemptions. This change adds vector types to the assert as these also can be rvalues. A provided test ensures the assertion no longer fires for vector rvalues. https://reviews.llvm.org/D27043 Files: llvm/tools/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp llvm/tools/clang/test/Analysis/crash-vector-rvalue.c Index: llvm/tools/clang/test/Analysis/crash-vector-rvalue.c === --- /dev/null +++ llvm/tools/clang/test/Analysis/crash-vector-rvalue.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify %s +typedef int vec __attribute__((__vector_size__(4)));; +vec bar(); +int foo() { + int op = bar()[2]; + return op; +} Index: llvm/tools/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp === --- llvm/tools/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ llvm/tools/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -1973,7 +1973,8 @@ StmtNodeBuilder Bldr(checkerPreStmt, Dst, *currBldrCtx); assert(A->isGLValue() || - (!AMgr.getLangOpts().CPlusPlus && + A->getBase()->getType()->isVectorType() || + (!AMgr.getLangOpts().CPlusPlus && A->getType().isCForbiddenLValueType())); for (ExplodedNodeSet::iterator it = checkerPreStmt.begin(), Index: llvm/tools/clang/test/Analysis/crash-vector-rvalue.c === --- /dev/null +++ llvm/tools/clang/test/Analysis/crash-vector-rvalue.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify %s +typedef int vec __attribute__((__vector_size__(4)));; +vec bar(); +int foo() { + int op = bar()[2]; + return op; +} Index: llvm/tools/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp === --- llvm/tools/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ llvm/tools/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -1973,7 +1973,8 @@ StmtNodeBuilder Bldr(checkerPreStmt, Dst, *currBldrCtx); assert(A->isGLValue() || - (!AMgr.getLangOpts().CPlusPlus && + A->getBase()->getType()->isVectorType() || + (!AMgr.getLangOpts().CPlusPlus && A->getType().isCForbiddenLValueType())); for (ExplodedNodeSet::iterator it = checkerPreStmt.begin(), ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26835: [analyzer] Minor fixes and improvements to debug.ExprInspection
xazax.hun added a comment. LGTM! https://reviews.llvm.org/D26835 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r287343 - [OpenCL] Introduce ReadPipeType and WritePipeType.
Hi Yaron, I have changed how I implemented this, will open a review soon. Thanks, Joey On 21 November 2016 at 14:42, Yaron Keren wrote: > Hi Joey, > > In order for ReadPipeType and WritePipeType to work with LLVM type system > (isa, dyn_cast), you need to modify the existing TypeClass::Pipe kind into > TypeClass::ReadPipe and TypeClass::WritePipe, have Pipe::classof recognize > both kinds and have ReadPipe::classof and WritePipe::classof recognize their > respective kinds. > > See rule 4 in http://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html > > Good example is how ConstantArrayType, IncompleteArrayType, > VariableArrayType, DependentSizedArrayType inherit from ArrayType. > > Yaron > > > > 2016-11-18 16:10 GMT+02:00 Joey Gouly via cfe-commits > : >> >> Author: joey >> Date: Fri Nov 18 08:10:54 2016 >> New Revision: 287343 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=287343&view=rev >> Log: >> [OpenCL] Introduce ReadPipeType and WritePipeType. >> >> This allows Sema to diagnose passing a read_only pipe to a >> write_only pipe argument. >> >> Modified: >> cfe/trunk/include/clang/AST/ASTContext.h >> cfe/trunk/include/clang/AST/Type.h >> cfe/trunk/include/clang/Sema/Sema.h >> cfe/trunk/include/clang/Serialization/ASTBitCodes.h >> cfe/trunk/lib/AST/ASTContext.cpp >> cfe/trunk/lib/AST/TypePrinter.cpp >> cfe/trunk/lib/Sema/SemaType.cpp >> cfe/trunk/lib/Sema/TreeTransform.h >> cfe/trunk/lib/Serialization/ASTReader.cpp >> cfe/trunk/lib/Serialization/ASTWriter.cpp >> cfe/trunk/test/Misc/ast-dump-pipe.cl >> cfe/trunk/test/SemaOpenCL/access-qualifier.cl >> cfe/trunk/test/SemaOpenCL/invalid-pipes-cl2.0.cl >> >> Modified: cfe/trunk/include/clang/AST/ASTContext.h >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=287343&r1=287342&r2=287343&view=diff >> >> == >> --- cfe/trunk/include/clang/AST/ASTContext.h (original) >> +++ cfe/trunk/include/clang/AST/ASTContext.h Fri Nov 18 08:10:54 2016 >> @@ -135,7 +135,8 @@ class ASTContext : public RefCountedBase >>mutable llvm::FoldingSet AutoTypes; >>mutable llvm::FoldingSet AtomicTypes; >>llvm::FoldingSet AttributedTypes; >> - mutable llvm::FoldingSet PipeTypes; >> + mutable llvm::FoldingSet ReadPipeTypes; >> + mutable llvm::FoldingSet WritePipeTypes; >> >>mutable llvm::FoldingSet QualifiedTemplateNames; >>mutable llvm::FoldingSet DependentTemplateNames; >> @@ -1120,8 +1121,10 @@ public: >>/// blocks. >>QualType getBlockDescriptorType() const; >> >> - /// \brief Return pipe type for the specified type. >> - QualType getPipeType(QualType T) const; >> + /// \brief Return a read_only pipe type for the specified type. >> + QualType getReadPipeType(QualType T) const; >> + /// \brief Return a write_only pipe type for the specified type. >> + QualType getWritePipeType(QualType T) const; >> >>/// Gets the struct used to keep track of the extended descriptor for >>/// pointer to blocks. >> >> Modified: cfe/trunk/include/clang/AST/Type.h >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=287343&r1=287342&r2=287343&view=diff >> >> == >> --- cfe/trunk/include/clang/AST/Type.h (original) >> +++ cfe/trunk/include/clang/AST/Type.h Fri Nov 18 08:10:54 2016 >> @@ -5285,18 +5285,18 @@ class AtomicType : public Type, public l >> >> /// PipeType - OpenCL20. >> class PipeType : public Type, public llvm::FoldingSetNode { >> +protected: >>QualType ElementType; >> + bool isRead; >> >> - PipeType(QualType elemType, QualType CanonicalPtr) : >> + PipeType(QualType elemType, QualType CanonicalPtr, bool isRead) : >> Type(Pipe, CanonicalPtr, elemType->isDependentType(), >> elemType->isInstantiationDependentType(), >> elemType->isVariablyModifiedType(), >> elemType->containsUnexpandedParameterPack()), >> -ElementType(elemType) {} >> - friend class ASTContext; // ASTContext creates these. >> +ElementType(elemType), isRead(isRead) {} >> >> public: >> - >>QualType getElementType() const { return ElementType; } >> >>bool isSugared() const { return false; } >> @@ -5311,11 +5311,23 @@ public: >> ID.AddPointer(T.getAsOpaquePtr()); >>} >> >> - >>static bool classof(const Type *T) { >> return T->getTypeClass() == Pipe; >>} >> >> + bool isReadOnly() const { return isRead; } >> +}; >> + >> +class ReadPipeType : public PipeType { >> + ReadPipeType(QualType elemType, QualType CanonicalPtr) : >> +PipeType(elemType, CanonicalPtr, true) {} >> + friend class ASTContext; // ASTContext creates these. >> +}; >> + >> +class WritePipeType : public PipeType { >> + WritePipeType(QualType elemType, QualType CanonicalPtr) : >> +PipeType(elemType, CanonicalPtr, false) {} >> + friend class ASTContext; // ASTConte
[PATCH] D18860: [analyzer] Fix the "Zombie symbols" issue.
xazax.hun added a comment. What is the status of this patch? Is there a consensus? https://reviews.llvm.org/D18860 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26979: Do not hard-code locale data in unit tests: get it from the OS instead
vangyzen added a comment. In https://reviews.llvm.org/D26979#604013, @EricWF wrote: > Nope. Feel free to commit after adding the requested assertions. I would gladly commit it, but I don't have commit access. I'm quite new here. Comment at: test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp:65 +{ +expected = *std::localeconv()->thousands_sep; +(void) std::setlocale(LC_NUMERIC, "C"); EricWF wrote: > We should probably assert that `thousands_sep` isn't a multibyte character. I don't quite follow. C defines it as `char*`. Are you concerned about an implementation defining it as `wchar_t*`? https://reviews.llvm.org/D26979 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26328: [ASTImporter] Added ability to import AtomicType nodes
khazem added a comment. Thanks, Gábor! Please do commit this (it's currently Thanksgiving week in the US). https://reviews.llvm.org/D26328 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r287763 - [ASTImporter] Added ability to import AtomicType nodes
Author: xazax Date: Wed Nov 23 09:24:23 2016 New Revision: 287763 URL: http://llvm.org/viewvc/llvm-project?rev=287763&view=rev Log: [ASTImporter] Added ability to import AtomicType nodes Patch by: Kareem Khazem Differential Revision: https://reviews.llvm.org/D26328 Modified: cfe/trunk/lib/AST/ASTImporter.cpp cfe/trunk/unittests/AST/ASTImporterTest.cpp Modified: cfe/trunk/lib/AST/ASTImporter.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=287763&r1=287762&r2=287763&view=diff == --- cfe/trunk/lib/AST/ASTImporter.cpp (original) +++ cfe/trunk/lib/AST/ASTImporter.cpp Wed Nov 23 09:24:23 2016 @@ -39,6 +39,7 @@ namespace clang { // Importing types QualType VisitType(const Type *T); +QualType VisitAtomicType(const AtomicType *T); QualType VisitBuiltinType(const BuiltinType *T); QualType VisitDecayedType(const DecayedType *T); QualType VisitComplexType(const ComplexType *T); @@ -1600,6 +1601,14 @@ QualType ASTNodeImporter::VisitType(cons return QualType(); } +QualType ASTNodeImporter::VisitAtomicType(const AtomicType *T){ + QualType UnderlyingType = Importer.Import(T->getValueType()); + if(UnderlyingType.isNull()) +return QualType(); + + return Importer.getToContext().getAtomicType(UnderlyingType); +} + QualType ASTNodeImporter::VisitBuiltinType(const BuiltinType *T) { switch (T->getKind()) { #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ Modified: cfe/trunk/unittests/AST/ASTImporterTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/ASTImporterTest.cpp?rev=287763&r1=287762&r2=287763&view=diff == --- cfe/trunk/unittests/AST/ASTImporterTest.cpp (original) +++ cfe/trunk/unittests/AST/ASTImporterTest.cpp Wed Nov 23 09:24:23 2016 @@ -474,5 +474,20 @@ TEST(ImportExpr, ImportVAArgExpr) { } +TEST(ImportType, ImportAtomicType) { + MatchVerifier Verifier; + EXPECT_TRUE(testImport("void declToImport() { typedef _Atomic(int) a_int; }", + Lang_CXX11, "", Lang_CXX11, Verifier, + functionDecl( + hasBody( + compoundStmt( + has( + declStmt( + has( + typedefDecl( + has(atomicType())); +} + + } // end namespace ast_matchers } // end namespace clang ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26328: [ASTImporter] Added ability to import AtomicType nodes
This revision was automatically updated to reflect the committed changes. Closed by commit rL287763: [ASTImporter] Added ability to import AtomicType nodes (authored by xazax). Changed prior to commit: https://reviews.llvm.org/D26328?vs=76976&id=79080#toc Repository: rL LLVM https://reviews.llvm.org/D26328 Files: cfe/trunk/lib/AST/ASTImporter.cpp cfe/trunk/unittests/AST/ASTImporterTest.cpp Index: cfe/trunk/lib/AST/ASTImporter.cpp === --- cfe/trunk/lib/AST/ASTImporter.cpp +++ cfe/trunk/lib/AST/ASTImporter.cpp @@ -39,6 +39,7 @@ // Importing types QualType VisitType(const Type *T); +QualType VisitAtomicType(const AtomicType *T); QualType VisitBuiltinType(const BuiltinType *T); QualType VisitDecayedType(const DecayedType *T); QualType VisitComplexType(const ComplexType *T); @@ -1600,6 +1601,14 @@ return QualType(); } +QualType ASTNodeImporter::VisitAtomicType(const AtomicType *T){ + QualType UnderlyingType = Importer.Import(T->getValueType()); + if(UnderlyingType.isNull()) +return QualType(); + + return Importer.getToContext().getAtomicType(UnderlyingType); +} + QualType ASTNodeImporter::VisitBuiltinType(const BuiltinType *T) { switch (T->getKind()) { #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ Index: cfe/trunk/unittests/AST/ASTImporterTest.cpp === --- cfe/trunk/unittests/AST/ASTImporterTest.cpp +++ cfe/trunk/unittests/AST/ASTImporterTest.cpp @@ -474,5 +474,20 @@ } +TEST(ImportType, ImportAtomicType) { + MatchVerifier Verifier; + EXPECT_TRUE(testImport("void declToImport() { typedef _Atomic(int) a_int; }", + Lang_CXX11, "", Lang_CXX11, Verifier, + functionDecl( + hasBody( + compoundStmt( + has( + declStmt( + has( + typedefDecl( + has(atomicType())); +} + + } // end namespace ast_matchers } // end namespace clang Index: cfe/trunk/lib/AST/ASTImporter.cpp === --- cfe/trunk/lib/AST/ASTImporter.cpp +++ cfe/trunk/lib/AST/ASTImporter.cpp @@ -39,6 +39,7 @@ // Importing types QualType VisitType(const Type *T); +QualType VisitAtomicType(const AtomicType *T); QualType VisitBuiltinType(const BuiltinType *T); QualType VisitDecayedType(const DecayedType *T); QualType VisitComplexType(const ComplexType *T); @@ -1600,6 +1601,14 @@ return QualType(); } +QualType ASTNodeImporter::VisitAtomicType(const AtomicType *T){ + QualType UnderlyingType = Importer.Import(T->getValueType()); + if(UnderlyingType.isNull()) +return QualType(); + + return Importer.getToContext().getAtomicType(UnderlyingType); +} + QualType ASTNodeImporter::VisitBuiltinType(const BuiltinType *T) { switch (T->getKind()) { #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ Index: cfe/trunk/unittests/AST/ASTImporterTest.cpp === --- cfe/trunk/unittests/AST/ASTImporterTest.cpp +++ cfe/trunk/unittests/AST/ASTImporterTest.cpp @@ -474,5 +474,20 @@ } +TEST(ImportType, ImportAtomicType) { + MatchVerifier Verifier; + EXPECT_TRUE(testImport("void declToImport() { typedef _Atomic(int) a_int; }", + Lang_CXX11, "", Lang_CXX11, Verifier, + functionDecl( + hasBody( + compoundStmt( + has( + declStmt( + has( + typedefDecl( + has(atomicType())); +} + + } // end namespace ast_matchers } // end namespace clang ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27049: [OpenCL] Refactor out ReadPipe/WritePipe
joey created this revision. joey added reviewers: yaron.keren, bader. joey added a subscriber: cfe-commits. joey set the repository for this revision to rL LLVM. Herald added a subscriber: yaxunl. This patch to keep the pipe access qualifier inside PipeType itself looks cleaner overall than my previous approach. Yaron had a post-commit comment, which lead me to re-think the original code. Repository: rL LLVM https://reviews.llvm.org/D27049 Files: include/clang/AST/ASTContext.h include/clang/AST/Type.h include/clang/Serialization/ASTBitCodes.h lib/AST/ASTContext.cpp lib/Serialization/ASTReader.cpp lib/Serialization/ASTWriter.cpp Index: lib/Serialization/ASTWriter.cpp === --- lib/Serialization/ASTWriter.cpp +++ lib/Serialization/ASTWriter.cpp @@ -516,10 +516,8 @@ void ASTTypeWriter::VisitPipeType(const PipeType *T) { Record.AddTypeRef(T->getElementType()); - if (T->isReadOnly()) -Code = TYPE_READ_PIPE; - else -Code = TYPE_WRITE_PIPE; + Record.push_back(T->isReadOnly()); + Code = TYPE_PIPE; } namespace { Index: lib/Serialization/ASTReader.cpp === --- lib/Serialization/ASTReader.cpp +++ lib/Serialization/ASTReader.cpp @@ -5793,27 +5793,21 @@ return Context.getAtomicType(ValueType); } - case TYPE_READ_PIPE: { -if (Record.size() != 1) { + case TYPE_PIPE: { +if (Record.size() != 2) { Error("Incorrect encoding of pipe type"); return QualType(); } // Reading the pipe element type. QualType ElementType = readType(*Loc.F, Record, Idx); -return Context.getReadPipeType(ElementType); +unsigned ReadOnly = Record[1]; +if (ReadOnly) + return Context.getReadPipeType(ElementType); +else + return Context.getWritePipeType(ElementType); } - case TYPE_WRITE_PIPE: { -if (Record.size() != 1) { - Error("Incorrect encoding of pipe type"); - return QualType(); -} - -// Reading the pipe element type. -QualType ElementType = readType(*Loc.F, Record, Idx); -return Context.getWritePipeType(ElementType); - } } llvm_unreachable("Invalid TypeCode!"); } Index: lib/AST/ASTContext.cpp === --- lib/AST/ASTContext.cpp +++ lib/AST/ASTContext.cpp @@ -3338,54 +3338,37 @@ return QualType(FTP, 0); } -QualType ASTContext::getReadPipeType(QualType T) const { +QualType ASTContext::getPipeType(QualType T, bool ReadOnly) const { llvm::FoldingSetNodeID ID; - ReadPipeType::Profile(ID, T); + PipeType::Profile(ID, T, ReadOnly); void *InsertPos = 0; - if (ReadPipeType *PT = ReadPipeTypes.FindNodeOrInsertPos(ID, InsertPos)) + if (PipeType *PT = PipeTypes.FindNodeOrInsertPos(ID, InsertPos)) return QualType(PT, 0); // If the pipe element type isn't canonical, this won't be a canonical type // either, so fill in the canonical type field. QualType Canonical; if (!T.isCanonical()) { -Canonical = getReadPipeType(getCanonicalType(T)); +Canonical = getPipeType(getCanonicalType(T), ReadOnly); // Get the new insert position for the node we care about. -ReadPipeType *NewIP = ReadPipeTypes.FindNodeOrInsertPos(ID, InsertPos); +PipeType *NewIP = PipeTypes.FindNodeOrInsertPos(ID, InsertPos); assert(!NewIP && "Shouldn't be in the map!"); (void)NewIP; } - ReadPipeType *New = new (*this, TypeAlignment) ReadPipeType(T, Canonical); + PipeType *New = new (*this, TypeAlignment) PipeType(T, Canonical, ReadOnly); Types.push_back(New); - ReadPipeTypes.InsertNode(New, InsertPos); + PipeTypes.InsertNode(New, InsertPos); return QualType(New, 0); } -QualType ASTContext::getWritePipeType(QualType T) const { - llvm::FoldingSetNodeID ID; - WritePipeType::Profile(ID, T); - - void *InsertPos = 0; - if (WritePipeType *PT = WritePipeTypes.FindNodeOrInsertPos(ID, InsertPos)) -return QualType(PT, 0); - - // If the pipe element type isn't canonical, this won't be a canonical type - // either, so fill in the canonical type field. - QualType Canonical; - if (!T.isCanonical()) { -Canonical = getWritePipeType(getCanonicalType(T)); +QualType ASTContext::getReadPipeType(QualType T) const { + return getPipeType(T, true); +} -// Get the new insert position for the node we care about. -WritePipeType *NewIP = WritePipeTypes.FindNodeOrInsertPos(ID, InsertPos); -assert(!NewIP && "Shouldn't be in the map!"); -(void)NewIP; - } - WritePipeType *New = new (*this, TypeAlignment) WritePipeType(T, Canonical); - Types.push_back(New); - WritePipeTypes.InsertNode(New, InsertPos); - return QualType(New, 0); +QualType ASTContext::getWritePipeType(QualType T) const { + return getPipeType(T, false); } #ifndef NDEBUG @@ -8272,8 +8255,9 @@ return LHS; if (getCanonicalType(RHSValue) == getCanonicalType(ResultType)) return RHS; -
[PATCH] D27005: [lit] Support custom parsers in parseIntegratedTestScript
jroelofs added a comment. In https://reviews.llvm.org/D27005#603979, @EricWF wrote: > In https://reviews.llvm.org/D27005#603692, @jroelofs wrote: > > > Should probably add a testcase in lit/tests that exercises the new CUSTOM > > parser stuff, so people working on LIT don't have to build/test libc++ in > > order to know whether they've broken its testsuite. > > > I plan to implement tests. I just wanted to ensure the approach was agreeable > first. Looks like a good approach to me. https://reviews.llvm.org/D27005 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r287768 - [libc++] Remove unneeded visibility pragmas
Author: smeenai Date: Wed Nov 23 10:11:15 2016 New Revision: 287768 URL: http://llvm.org/viewvc/llvm-project?rev=287768&view=rev Log: [libc++] Remove unneeded visibility pragmas The function definitions being guarded by the pragma were all static, so they wouldn't be exported anyway. In any case, we should prefer the visibility macros. No functional change. Differential Revision: https://reviews.llvm.org/D26940 Modified: libcxx/trunk/src/chrono.cpp Modified: libcxx/trunk/src/chrono.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/chrono.cpp?rev=287768&r1=287767&r2=287768&view=diff == --- libcxx/trunk/src/chrono.cpp (original) +++ libcxx/trunk/src/chrono.cpp Wed Nov 23 10:11:15 2016 @@ -90,8 +90,6 @@ steady_clock::now() _NOEXCEPT // MachInfo.numer / MachInfo.denom is often 1 on the latest equipment. Specialize // for that case as an optimization. -#pragma GCC visibility push(hidden) - static steady_clock::rep steady_simplified() @@ -129,8 +127,6 @@ init_steady_clock() return &steady_full; } -#pragma GCC visibility pop - steady_clock::time_point steady_clock::now() _NOEXCEPT { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26940: [libc++] Remove unneeded visibility pragmas
This revision was automatically updated to reflect the committed changes. Closed by commit rL287768: [libc++] Remove unneeded visibility pragmas (authored by smeenai). Changed prior to commit: https://reviews.llvm.org/D26940?vs=78792&id=79090#toc Repository: rL LLVM https://reviews.llvm.org/D26940 Files: libcxx/trunk/src/chrono.cpp Index: libcxx/trunk/src/chrono.cpp === --- libcxx/trunk/src/chrono.cpp +++ libcxx/trunk/src/chrono.cpp @@ -90,8 +90,6 @@ // MachInfo.numer / MachInfo.denom is often 1 on the latest equipment. Specialize // for that case as an optimization. -#pragma GCC visibility push(hidden) - static steady_clock::rep steady_simplified() @@ -129,8 +127,6 @@ return &steady_full; } -#pragma GCC visibility pop - steady_clock::time_point steady_clock::now() _NOEXCEPT { Index: libcxx/trunk/src/chrono.cpp === --- libcxx/trunk/src/chrono.cpp +++ libcxx/trunk/src/chrono.cpp @@ -90,8 +90,6 @@ // MachInfo.numer / MachInfo.denom is often 1 on the latest equipment. Specialize // for that case as an optimization. -#pragma GCC visibility push(hidden) - static steady_clock::rep steady_simplified() @@ -129,8 +127,6 @@ return &steady_full; } -#pragma GCC visibility pop - steady_clock::time_point steady_clock::now() _NOEXCEPT { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26934: [libc++] Add _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
smeenai added a comment. In https://reviews.llvm.org/D26934#603997, @EricWF wrote: > There are two usages of `_LIBCPP_DISABLE_DLL_IMPORT_EXPORT` in > `CMakeLists.txt` and `__config_site.in` that need to be changed as well. Oops, will fix. > Also what about users of the existing name > `_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS`? Should we #error to inform them of > the change or should we automatically translate it to the new name for them? I'd prefer `#error`; that way we can eventually just drop the macro. Ideally there wouldn't be too many users to begin with, since it was only introduced two months ago, and it hasn't made its way to a release yet. I'll upload a new diff with those changes later today. https://reviews.llvm.org/D26934 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r287771 - [CodeCompletion] Fix incorrect Objective-C block parameter formatting
Author: arphaman Date: Wed Nov 23 10:28:34 2016 New Revision: 287771 URL: http://llvm.org/viewvc/llvm-project?rev=287771&view=rev Log: [CodeCompletion] Fix incorrect Objective-C block parameter formatting This commit fixes an incorrectly formatted Objective-C block parameter placeholder in a code completion result. The incorrect parameter had a redundant leading parenthesis. rdar://25224416 Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp cfe/trunk/test/Index/complete-block-properties.m Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=287771&r1=287770&r2=287771&view=diff == --- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original) +++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Wed Nov 23 10:28:34 2016 @@ -2264,9 +2264,13 @@ static std::string FormatFunctionParamet QualType Type = Param->getType().getUnqualifiedType(); if (ObjCMethodParam) { - Result = "(" + formatObjCParamQualifiers(Param->getObjCDeclQualifier(), - Type); - Result += Type.getAsString(Policy) + Result + ")"; + Result = Type.getAsString(Policy); + std::string Quals = + formatObjCParamQualifiers(Param->getObjCDeclQualifier(), Type); + if (!Quals.empty()) +Result = "(" + Quals + " " + Result + ")"; + if (Result.back() != ')') +Result += " "; if (Param->getIdentifier()) Result += Param->getIdentifier()->getName(); } else { @@ -2275,7 +2279,7 @@ static std::string FormatFunctionParamet return Result; } - + // We have the function prototype behind the block pointer type, as it was // written in the source. return formatBlockPlaceholder(Policy, Param, Block, BlockProto, Modified: cfe/trunk/test/Index/complete-block-properties.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-block-properties.m?rev=287771&r1=287770&r2=287771&view=diff == --- cfe/trunk/test/Index/complete-block-properties.m (original) +++ cfe/trunk/test/Index/complete-block-properties.m Wed Nov 23 10:28:34 2016 @@ -51,3 +51,22 @@ typedef int (^BarBlock)(int *); //CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType int}{TypedText performB}{LeftParen (}{Placeholder int x}{Comma , }{Placeholder int y}{RightParen )} (35) @end + +// rdar://25224416 + +@interface NoQualifierParens + +@property(copy) void (^blockProperty)(void); +@property BarBlock blockProperty2; + +@end + +void noQualifierParens(NoQualifierParens *f) { + [f setBlockProperty: ^{}]; +} + +// RUN: c-index-test -code-completion-at=%s:65:6 %s | FileCheck -check-prefix=CHECK-CC2 %s +//CHECK-CC2: ObjCInstanceMethodDecl:{ResultType void (^)(void)}{TypedText blockProperty} (35) +//CHECK-CC2-NEXT: ObjCInstanceMethodDecl:{ResultType BarBlock}{TypedText blockProperty2} (35) +//CHECK-CC2-NEXT: ObjCInstanceMethodDecl:{ResultType void}{TypedText setBlockProperty2:}{Placeholder BarBlock blockProperty2} (35) +//CHECK-CC2-NEXT: ObjCInstanceMethodDecl:{ResultType void}{TypedText setBlockProperty:}{Placeholder void (^)(void)blockProperty} (35) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27053: [CodeCompletion] Provide Objective-C class property completion results
arphaman created this revision. arphaman added reviewers: manmanren, akyrtzi. arphaman added a subscriber: cfe-commits. arphaman set the repository for this revision to rL LLVM. This patch provides class property code completion results. It supports explicit and implicit class properties, but the special block completion is done only for explicit properties right now (I will address this deficiency in a follow-up patch). Repository: rL LLVM https://reviews.llvm.org/D27053 Files: include/clang/Sema/Sema.h lib/Parse/ParseExpr.cpp lib/Sema/SemaCodeComplete.cpp test/Index/complete-block-properties.m test/Index/complete-properties.m Index: test/Index/complete-properties.m === --- test/Index/complete-properties.m +++ test/Index/complete-properties.m @@ -94,3 +94,84 @@ // RUN: c-index-test -code-completion-at=%s:57:13 -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC8 %s // CHECK-CC8: ObjCPropertyDecl:{ResultType int}{TypedText Prop5} (35) + +@interface ClassProperties + +@property int instanceProperty; +@property(class) int explicit; +@property(class, readonly) int explicitReadonly; + ++ (int)implicit; ++ (int)setImplicit:(int)x; + ++ (int)implicitReadonly; + ++ (void)noProperty; + +- (int)implicitInstance; + ++ (int)shadowedImplicit; + +@end + +@interface ClassProperties (Category) + ++ (int)implicitInCategory; + +@end + +@protocol ProtocolClassProperties + +@property(class, readonly) int explicitInProtocol; + +@end + +@interface SubClassProperties: ClassProperties + +@property(class) ClassProperties *shadowedImplicit; + +@end + +@implementation SubClassProperties + +-(void) foo { + super.instanceProperty; +} + +@end + +void classProperties() { + (void)ClassProperties.implicit; + (void)SubClassProperties.explicit; +} + +// RUN: c-index-test -code-completion-at=%s:144:25 -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC9 %s +// CHECK-CC9: ObjCPropertyDecl:{ResultType int}{TypedText explicit} (35) +// CHECK-CC9-NEXT: ObjCPropertyDecl:{ResultType int}{TypedText explicitReadonly} (35) +// CHECK-CC9-NEXT: ObjCClassMethodDecl:{ResultType int}{TypedText implicit} (37) +// CHECK-CC9-NEXT: ObjCClassMethodDecl:{ResultType int}{TypedText implicitInCategory} (37) +// CHECK-CC9-NEXT: ObjCClassMethodDecl:{ResultType int}{TypedText implicitReadonly} (37) +// CHECK-CC9-NEXT: ObjCClassMethodDecl:{ResultType int}{TypedText shadowedImplicit} (37) +// CHECK-CC9-NOT: implicitInstance +// CHECK-CC9-NOT: noProperty +// CHECK-CC9-NOT: instanceProperty + +// RUN: c-index-test -code-completion-at=%s:145:28 -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC10 %s +// CHECK-CC10: ObjCPropertyDecl:{ResultType int}{TypedText explicit} (35) +// CHECK-CC10-NEXT: ObjCPropertyDecl:{ResultType int}{TypedText explicitInProtocol} (35) +// CHECK-CC10-NEXT: ObjCPropertyDecl:{ResultType int}{TypedText explicitReadonly} (35) +// CHECK-CC10-NEXT: ObjCClassMethodDecl:{ResultType int}{TypedText implicit} (37) +// CHECK-CC10-NEXT: ObjCClassMethodDecl:{ResultType int}{TypedText implicitInCategory} (37) +// CHECK-CC10-NEXT: ObjCClassMethodDecl:{ResultType int}{TypedText implicitReadonly} (37) +// CHECK-CC10-NEXT: ObjCPropertyDecl:{ResultType ClassProperties *}{TypedText shadowedImplicit} (35) +// CHECK-CC10-NOT: implicitInstance +// CHECK-CC10-NOT: noProperty +// CHECK-CC10-NOT: instanceProperty + +// RUN: c-index-test -code-completion-at=%s:138:9 -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC11 %s +// CHECK-CC11-NOT: explicit +// CHECK-CC11-NOT: explicitReadonly +// CHECK-CC11-NOT: implicit +// CHECK-CC11-NOT: implicitReadonly +// CHECK-CC11-NOT: shadowedImplicit +// CHECK-CC11-NOT: implicitInCategory Index: test/Index/complete-block-properties.m === --- test/Index/complete-block-properties.m +++ test/Index/complete-block-properties.m @@ -70,3 +70,19 @@ //CHECK-CC2-NEXT: ObjCInstanceMethodDecl:{ResultType BarBlock}{TypedText blockProperty2} (35) //CHECK-CC2-NEXT: ObjCInstanceMethodDecl:{ResultType void}{TypedText setBlockProperty2:}{Placeholder BarBlock blockProperty2} (35) //CHECK-CC2-NEXT: ObjCInstanceMethodDecl:{ResultType void}{TypedText setBlockProperty:}{Placeholder void (^)(void)blockProperty} (35) + +@interface ClassProperties + +@property(class) void (^explicit)(); +@property(class, readonly) void (^explicitReadonly)(); + +@end + +void classBlockProperties() { + ClassProperties.explicit; +} + +// RUN: c-index-test -code-completion-at=%s:82:19 %s | FileCheck -check-prefix=CHECK-CC3 %s +//CHECK-CC3: ObjCPropertyDecl:{ResultType void}{TypedText explicit}{LeftParen (}{RightParen )} (35) +//CHECK-CC3-NEXT: ObjCPropertyDecl:{ResultType void (^)()}{TypedText explicit}{Equal = }{Placeholder ^(void)} (38) +//CHECK-CC3-NEXT: ObjCPropertyDecl:{ResultType void}{TypedText explicitReadonly}{LeftParen (}{RightParen )} (35) Index: lib/Sema/SemaCodeComplete.cpp ===
r287772 - [PPC] support for arithmetic builtins in the FE
Author: amehsan Date: Wed Nov 23 10:32:05 2016 New Revision: 287772 URL: http://llvm.org/viewvc/llvm-project?rev=287772&view=rev Log: [PPC] support for arithmetic builtins in the FE This adds various overloads of the following builtins to altivec.h: vec_neg vec_nabs vec_adde vec_addec vec_sube vec_subec vec_subc Note that for vec_sub builtins on 32 bit integers, the semantics is similar to what ISA describes for instructions like vsubecuq that work on quadwords: the first operand is added to the one's complement of the second operand. (As opposed to two's complement which I expected). Modified: cfe/trunk/lib/Headers/altivec.h cfe/trunk/test/CodeGen/builtins-ppc-altivec.c cfe/trunk/test/CodeGen/builtins-ppc-p8vector.c cfe/trunk/test/CodeGen/builtins-ppc-quadword.c cfe/trunk/test/CodeGen/builtins-ppc-vsx.c Modified: cfe/trunk/lib/Headers/altivec.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/altivec.h?rev=287772&r1=287771&r2=287772&view=diff == --- cfe/trunk/lib/Headers/altivec.h (original) +++ cfe/trunk/lib/Headers/altivec.h Wed Nov 23 10:32:05 2016 @@ -157,7 +157,7 @@ static __inline__ vector float __ATTRS_o #endif } -#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) +#ifdef __VSX__ static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) { return __builtin_vsx_xvabsdp(__a); } @@ -348,6 +348,22 @@ vec_adde(vector unsigned __int128 __a, v } #endif +static __inline__ vector signed int __ATTRS_o_ai +vec_adde(vector signed int __a, vector signed int __b, + vector signed int __c) { + vector signed int __mask = {1, 1, 1, 1}; + vector signed int __carry = __c & __mask; + return vec_add(vec_add(__a, __b), __carry); +} + +static __inline__ vector unsigned int __ATTRS_o_ai +vec_adde(vector unsigned int __a, vector unsigned int __b, + vector unsigned int __c) { + vector unsigned int __mask = {1, 1, 1, 1}; + vector unsigned int __carry = __c & __mask; + return vec_add(vec_add(__a, __b), __carry); +} + /* vec_addec */ #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) @@ -362,6 +378,50 @@ vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __c) { return __builtin_altivec_vaddecuq(__a, __b, __c); } + +static __inline__ vector signed int __ATTRS_o_ai +vec_addec(vector signed int __a, vector signed int __b, + vector signed int __c) { + + signed int __result[4]; + for (int i = 0; i < 4; i++) { +unsigned int __tempa = (unsigned int) __a[i]; +unsigned int __tempb = (unsigned int) __b[i]; +unsigned int __tempc = (unsigned int) __c[i]; +__tempc = __tempc & 0x0001; +unsigned long long __longa = (unsigned long long) __tempa; +unsigned long long __longb = (unsigned long long) __tempb; +unsigned long long __longc = (unsigned long long) __tempc; +unsigned long long __sum = __longa + __longb + __longc; +unsigned long long __res = (__sum >> 32) & 0x01; +unsigned long long __tempres = (unsigned int) __res; +__result[i] = (signed int) __tempres; + } + + vector signed int ret = { __result[0], __result[1], __result[2], __result[3] }; + return ret; +} + +static __inline__ vector unsigned int __ATTRS_o_ai +vec_addec(vector unsigned int __a, vector unsigned int __b, + vector unsigned int __c) { + + unsigned int __result[4]; + for (int i = 0; i < 4; i++) { +unsigned int __tempc = __c[i] & 1; +unsigned long long __longa = (unsigned long long) __a[i]; +unsigned long long __longb = (unsigned long long) __b[i]; +unsigned long long __longc = (unsigned long long) __tempc; +unsigned long long __sum = __longa + __longb + __longc; +unsigned long long __res = (__sum >> 32) & 0x01; +unsigned long long __tempres = (unsigned int) __res; +__result[i] = (signed int) __tempres; + } + + vector unsigned int ret = { __result[0], __result[1], __result[2], __result[3] }; + return ret; +} + #endif /* vec_vaddubm */ @@ -11089,6 +11149,11 @@ vec_vsubfp(vector float __a, vector floa /* vec_subc */ +static __inline__ vector signed int __ATTRS_o_ai +vec_subc(vector signed int __a, vector signed int __b) { + return __builtin_altivec_vsubcuw(__a, __b); +} + static __inline__ vector unsigned int __ATTRS_o_ai vec_subc(vector unsigned int __a, vector unsigned int __b) { return __builtin_altivec_vsubcuw(__a, __b); @@ -11322,6 +11387,7 @@ vec_vsubuqm(vector unsigned __int128 __a /* vec_vsubeuqm */ + static __inline__ vector signed __int128 __ATTRS_o_ai vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b, vector signed __int128 __c) { @@ -11334,6 +11400,18 @@ vec_vsubeuqm(vector unsigned __int128 __ return __builtin_altivec_vsubeuqm(__a, __b, __c); } +static __inline__ vector signed __int128 __ATTRS_o_ai +vec_sube(vector signed __int128 __a, vector signed __int128 __b, +
[PATCH] D27054: Introducing clang::tooling::EditList for refactoring tools.
ioeric created this revision. ioeric added a reviewer: klimek. ioeric added subscribers: djasper, cfe-commits. Herald added a subscriber: mgorny. An edit list is used to create and group a set of source edits, e.g. replacements or header insertions. Edits in an EditList should be related, e.g. replacements for the same type reference and the corresponding header insertion/deletion. An EditList is uniquely identified by a key position and will either be fully applied or not applied at all. The key position should be the location of the key syntactical element that is being changed, e.g. the call to a refactored method. https://reviews.llvm.org/D27054 Files: include/clang/Tooling/Refactoring/EditList.h lib/Tooling/CMakeLists.txt lib/Tooling/Refactoring/CMakeLists.txt lib/Tooling/Refactoring/EditList.cpp unittests/Tooling/CMakeLists.txt unittests/Tooling/RefactoringTest.cpp Index: unittests/Tooling/RefactoringTest.cpp === --- unittests/Tooling/RefactoringTest.cpp +++ unittests/Tooling/RefactoringTest.cpp @@ -26,6 +26,7 @@ #include "clang/Frontend/TextDiagnosticPrinter.h" #include "clang/Rewrite/Core/Rewriter.h" #include "clang/Tooling/Refactoring.h" +#include "clang/Tooling/Refactoring/EditList.h" #include "clang/Tooling/Tooling.h" #include "llvm/ADT/SmallString.h" #include "gtest/gtest.h" @@ -102,10 +103,10 @@ // Checks that an llvm::Error instance contains a ReplacementError with expected // error code, expected new replacement, and expected existing replacement. -static bool checkReplacementError( -llvm::Error&& Error, replacement_error ExpectedErr, -llvm::Optional ExpectedExisting, -llvm::Optional ExpectedNew) { +static bool checkReplacementError(llvm::Error &&Error, + replacement_error ExpectedErr, + llvm::Optional ExpectedExisting, + llvm::Optional ExpectedNew) { if (!Error) { llvm::errs() << "Error is a success."; return false; @@ -1089,5 +1090,183 @@ EXPECT_TRUE(FileToReplaces.empty()); } +class EditListTest : public ::testing::Test { + protected: +void setUp() { + DefaultFileID = Context.createInMemoryFile("input.cpp", DefaultCode); + DefaultLoc = Context.Sources.getLocForStartOfFile(DefaultFileID) + .getLocWithOffset(20); + assert(DefaultLoc.isValid() && "Default location must be valid."); +} + +RewriterTestContext Context; +std::string DefaultCode = std::string(100, 'a'); +unsigned DefaultOffset = 20; +SourceLocation DefaultLoc; +FileID DefaultFileID; +}; + +TEST_F(EditListTest, EditListToYAML) { + setUp(); + EditList Edit(Context.Sources, DefaultLoc); + llvm::Error Err = Edit.insertBefore(Context.Sources, DefaultLoc, "aa"); + EXPECT_TRUE(!Err); + Err = + Edit.insertBefore(Context.Sources, DefaultLoc.getLocWithOffset(10), "bb"); + EXPECT_TRUE(!Err); + Edit.addHeader("a.h"); + Edit.removeHeader("b.h"); + std::string YAMLString = Edit.toYAMLString(); + + // NOTE: If this test starts to fail for no obvious reason, check whitespace. + ASSERT_STREQ("---\n" + "Key: 'input.cpp:20'\n" + "FilePath:input.cpp\n" + "Error: ''\n" + "InsertedHeaders: [ a.h ]\n" + "RemovedHeaders: [ b.h ]\n" + "Replacements:\n" // Extra whitespace here! + " - FilePath:input.cpp\n" + "Offset: 20\n" + "Length: 0\n" + "ReplacementText: aa\n" + " - FilePath:input.cpp\n" + "Offset: 30\n" + "Length: 0\n" + "ReplacementText: bb\n" + "...\n", + YAMLString.c_str()); +} + +TEST_F(EditListTest, YAMLToEditList) { + setUp(); + std::string YamlContent = "---\n" +"Key: 'input.cpp:20'\n" +"FilePath:input.cpp\n" +"Error: 'ok'\n" +"InsertedHeaders: [ a.h ]\n" +"RemovedHeaders: [ b.h ]\n" +"Replacements:\n" // Extra whitespace here! +" - FilePath:input.cpp\n" +"Offset: 20\n" +"Length: 0\n" +"ReplacementText: aa\n" +" - FilePath:input.cpp\n" +"Offset: 30\n" +"Length: 0\n" +"ReplacementText: bb\n" +"...\n"; + EditList ExpectedEdit(Context.Sources, DefaultLoc); + llvm::Error Err = + Expected
r287774 - Remove C++ default arg side table for MS ABI ctor closures
Author: rnk Date: Wed Nov 23 10:51:30 2016 New Revision: 287774 URL: http://llvm.org/viewvc/llvm-project?rev=287774&view=rev Log: Remove C++ default arg side table for MS ABI ctor closures Summary: We don't need a side table in ASTContext to hold CXXDefaultArgExprs. The important part of building the CXXDefaultArgExprs was to ODR use the default argument expressions, not to make AST nodes. Refactor the code to only check the default argument, and remove the side table in ASTContext which wasn't being serialized. Fixes PR31121 Reviewers: thakis, rsmith, majnemer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27007 Added: cfe/trunk/test/SemaCXX/default-arg-closures.cpp Modified: cfe/trunk/include/clang/AST/ASTContext.h cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/AST/ASTContext.cpp cfe/trunk/lib/AST/CXXABI.h cfe/trunk/lib/AST/ItaniumCXXABI.cpp cfe/trunk/lib/AST/MicrosoftCXXABI.cpp cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp cfe/trunk/lib/Sema/SemaDeclCXX.cpp cfe/trunk/lib/Sema/SemaExpr.cpp cfe/trunk/lib/Sema/SemaExprCXX.cpp Modified: cfe/trunk/include/clang/AST/ASTContext.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=287774&r1=287773&r2=287774&view=diff == --- cfe/trunk/include/clang/AST/ASTContext.h (original) +++ cfe/trunk/include/clang/AST/ASTContext.h Wed Nov 23 10:51:30 2016 @@ -2452,12 +2452,6 @@ public: void addCopyConstructorForExceptionObject(CXXRecordDecl *RD, CXXConstructorDecl *CD); - void addDefaultArgExprForConstructor(const CXXConstructorDecl *CD, - unsigned ParmIdx, Expr *DAE); - - Expr *getDefaultArgExprForConstructor(const CXXConstructorDecl *CD, -unsigned ParmIdx); - void addTypedefNameForUnnamedTagDecl(TagDecl *TD, TypedefNameDecl *TND); TypedefNameDecl *getTypedefNameForUnnamedTagDecl(const TagDecl *TD); Modified: cfe/trunk/include/clang/Sema/Sema.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=287774&r1=287773&r2=287774&view=diff == --- cfe/trunk/include/clang/Sema/Sema.h (original) +++ cfe/trunk/include/clang/Sema/Sema.h Wed Nov 23 10:51:30 2016 @@ -4408,6 +4408,12 @@ public: ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field); + + /// Instantiate or parse a C++ default argument expression as necessary. + /// Return true on error. + bool CheckCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, + ParmVarDecl *Param); + /// BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating /// the default expr if needed. ExprResult BuildCXXDefaultArgExpr(SourceLocation CallLoc, Modified: cfe/trunk/lib/AST/ASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=287774&r1=287773&r2=287774&view=diff == --- cfe/trunk/lib/AST/ASTContext.cpp (original) +++ cfe/trunk/lib/AST/ASTContext.cpp Wed Nov 23 10:51:30 2016 @@ -9172,18 +9172,6 @@ void ASTContext::addCopyConstructorForEx cast(CD->getFirstDecl())); } -void ASTContext::addDefaultArgExprForConstructor(const CXXConstructorDecl *CD, - unsigned ParmIdx, Expr *DAE) { - ABI->addDefaultArgExprForConstructor( - cast(CD->getFirstDecl()), ParmIdx, DAE); -} - -Expr *ASTContext::getDefaultArgExprForConstructor(const CXXConstructorDecl *CD, - unsigned ParmIdx) { - return ABI->getDefaultArgExprForConstructor( - cast(CD->getFirstDecl()), ParmIdx); -} - void ASTContext::addTypedefNameForUnnamedTagDecl(TagDecl *TD, TypedefNameDecl *DD) { return ABI->addTypedefNameForUnnamedTagDecl(TD, DD); Modified: cfe/trunk/lib/AST/CXXABI.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CXXABI.h?rev=287774&r1=287773&r2=287774&view=diff == --- cfe/trunk/lib/AST/CXXABI.h (original) +++ cfe/trunk/lib/AST/CXXABI.h Wed Nov 23 10:51:30 2016 @@ -54,12 +54,6 @@ public: virtual const CXXConstructorDecl * getCopyConstructorForExceptionObject(CXXRecordDecl *) = 0; - virtual void addDefaultArgExprForConstructor(const CXXConstructorDecl *CD, - unsigned ParmIdx, Expr *DAE) = 0; - - virtual Expr *getDefaultArgExprForConstructor(const CXXConstructorDecl *CD, -unsigned ParmIdx) = 0; - virtual void addTypedefNameForUnnamedTagDecl(TagDecl *TD, Typ
[PATCH] D27007: Remove C++ default arg side table for MS ABI ctor closures
This revision was automatically updated to reflect the committed changes. Closed by commit rL287774: Remove C++ default arg side table for MS ABI ctor closures (authored by rnk). Changed prior to commit: https://reviews.llvm.org/D27007?vs=78965&id=79105#toc Repository: rL LLVM https://reviews.llvm.org/D27007 Files: cfe/trunk/include/clang/AST/ASTContext.h cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/AST/ASTContext.cpp cfe/trunk/lib/AST/CXXABI.h cfe/trunk/lib/AST/ItaniumCXXABI.cpp cfe/trunk/lib/AST/MicrosoftCXXABI.cpp cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp cfe/trunk/lib/Sema/SemaDeclCXX.cpp cfe/trunk/lib/Sema/SemaExpr.cpp cfe/trunk/lib/Sema/SemaExprCXX.cpp cfe/trunk/test/SemaCXX/default-arg-closures.cpp Index: cfe/trunk/test/SemaCXX/default-arg-closures.cpp === --- cfe/trunk/test/SemaCXX/default-arg-closures.cpp +++ cfe/trunk/test/SemaCXX/default-arg-closures.cpp @@ -0,0 +1,45 @@ +// RUN: %clang_cc1 -triple x86_64-windows-msvc -fexceptions -fcxx-exceptions -fms-extensions -verify %s -std=c++11 + +// The MS ABI has a few ways to generate constructor closures, which require +// instantiating and checking the semantics of default arguments. Make sure we +// do that right. + +// FIXME: Don't diagnose this issue twice. +template +struct DependentDefaultCtorArg { // expected-note {{in instantiation of default function argument}} + // expected-error@+1 2 {{type 'int' cannot be used prior to '::' because it has no members}} + DependentDefaultCtorArg(int n = T::error); +}; +struct +__declspec(dllexport) // expected-note {{due to 'ExportDefaultCtorClosure' being dllexported}} +ExportDefaultCtorClosure // expected-note {{implicit default constructor for 'ExportDefaultCtorClosure' first required here}} +: DependentDefaultCtorArg // expected-note {{in instantiation of template class}} +{}; + +template +struct DependentDefaultCopyArg { + DependentDefaultCopyArg() {} + // expected-error@+1 {{type 'int' cannot be used prior to '::' because it has no members}} + DependentDefaultCopyArg(const DependentDefaultCopyArg &o, int n = T::member) {} +}; + +struct HasMember { + enum { member = 0 }; +}; +void UseDependentArg() { throw DependentDefaultCopyArg(); } + +void ErrorInDependentArg() { + throw DependentDefaultCopyArg(); // expected-note {{required here}} +} + +struct HasCleanup { + ~HasCleanup(); +}; + +struct Default { + Default(const Default &o, int d = (HasCleanup(), 42)); +}; + +void f(const Default &d) { + throw d; +} Index: cfe/trunk/lib/AST/ItaniumCXXABI.cpp === --- cfe/trunk/lib/AST/ItaniumCXXABI.cpp +++ cfe/trunk/lib/AST/ItaniumCXXABI.cpp @@ -142,14 +142,6 @@ void addCopyConstructorForExceptionObject(CXXRecordDecl *RD, CXXConstructorDecl *CD) override {} - void addDefaultArgExprForConstructor(const CXXConstructorDecl *CD, - unsigned ParmIdx, Expr *DAE) override {} - - Expr *getDefaultArgExprForConstructor(const CXXConstructorDecl *CD, -unsigned ParmIdx) override { -return nullptr; - } - void addTypedefNameForUnnamedTagDecl(TagDecl *TD, TypedefNameDecl *DD) override {} Index: cfe/trunk/lib/AST/MicrosoftCXXABI.cpp === --- cfe/trunk/lib/AST/MicrosoftCXXABI.cpp +++ cfe/trunk/lib/AST/MicrosoftCXXABI.cpp @@ -67,8 +67,6 @@ class MicrosoftCXXABI : public CXXABI { ASTContext &Context; llvm::SmallDenseMap RecordToCopyCtor; - llvm::SmallDenseMap, Expr *> - CtorToDefaultArgExpr; llvm::SmallDenseMap UnnamedTagDeclToDeclaratorDecl; @@ -92,16 +90,6 @@ llvm_unreachable("unapplicable to the MS ABI"); } - void addDefaultArgExprForConstructor(const CXXConstructorDecl *CD, - unsigned ParmIdx, Expr *DAE) override { -CtorToDefaultArgExpr[std::make_pair(CD, ParmIdx)] = DAE; - } - - Expr *getDefaultArgExprForConstructor(const CXXConstructorDecl *CD, -unsigned ParmIdx) override { -return CtorToDefaultArgExpr[std::make_pair(CD, ParmIdx)]; - } - const CXXConstructorDecl * getCopyConstructorForExceptionObject(CXXRecordDecl *RD) override { return RecordToCopyCtor[RD]; Index: cfe/trunk/lib/AST/ASTContext.cpp === --- cfe/trunk/lib/AST/ASTContext.cpp +++ cfe/trunk/lib/AST/ASTContext.cpp @@ -9172,18 +9172,6 @@ cast(CD->getFirstDecl())); } -void ASTContext::addDefaultArgExprForConstructor(const CXXConstructorDecl *CD, - unsigned ParmIdx, Expr *DAE) { - ABI->addDefaultArgExprForConstructor( - cast(CD->getFirstDecl()), ParmIdx, DAE); -} - -Expr *ASTContext::getDefaultArgExprFor
r287775 - [PPC] Reverting r287772
Author: amehsan Date: Wed Nov 23 10:56:03 2016 New Revision: 287775 URL: http://llvm.org/viewvc/llvm-project?rev=287775&view=rev Log: [PPC] Reverting r287772 Due to buildbot failure, I revert. Will recommit after investigation. Modified: cfe/trunk/lib/Headers/altivec.h cfe/trunk/test/CodeGen/builtins-ppc-altivec.c cfe/trunk/test/CodeGen/builtins-ppc-p8vector.c cfe/trunk/test/CodeGen/builtins-ppc-quadword.c cfe/trunk/test/CodeGen/builtins-ppc-vsx.c Modified: cfe/trunk/lib/Headers/altivec.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/altivec.h?rev=287775&r1=287774&r2=287775&view=diff == --- cfe/trunk/lib/Headers/altivec.h (original) +++ cfe/trunk/lib/Headers/altivec.h Wed Nov 23 10:56:03 2016 @@ -157,7 +157,7 @@ static __inline__ vector float __ATTRS_o #endif } -#ifdef __VSX__ +#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) { return __builtin_vsx_xvabsdp(__a); } @@ -348,22 +348,6 @@ vec_adde(vector unsigned __int128 __a, v } #endif -static __inline__ vector signed int __ATTRS_o_ai -vec_adde(vector signed int __a, vector signed int __b, - vector signed int __c) { - vector signed int __mask = {1, 1, 1, 1}; - vector signed int __carry = __c & __mask; - return vec_add(vec_add(__a, __b), __carry); -} - -static __inline__ vector unsigned int __ATTRS_o_ai -vec_adde(vector unsigned int __a, vector unsigned int __b, - vector unsigned int __c) { - vector unsigned int __mask = {1, 1, 1, 1}; - vector unsigned int __carry = __c & __mask; - return vec_add(vec_add(__a, __b), __carry); -} - /* vec_addec */ #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) @@ -378,50 +362,6 @@ vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __c) { return __builtin_altivec_vaddecuq(__a, __b, __c); } - -static __inline__ vector signed int __ATTRS_o_ai -vec_addec(vector signed int __a, vector signed int __b, - vector signed int __c) { - - signed int __result[4]; - for (int i = 0; i < 4; i++) { -unsigned int __tempa = (unsigned int) __a[i]; -unsigned int __tempb = (unsigned int) __b[i]; -unsigned int __tempc = (unsigned int) __c[i]; -__tempc = __tempc & 0x0001; -unsigned long long __longa = (unsigned long long) __tempa; -unsigned long long __longb = (unsigned long long) __tempb; -unsigned long long __longc = (unsigned long long) __tempc; -unsigned long long __sum = __longa + __longb + __longc; -unsigned long long __res = (__sum >> 32) & 0x01; -unsigned long long __tempres = (unsigned int) __res; -__result[i] = (signed int) __tempres; - } - - vector signed int ret = { __result[0], __result[1], __result[2], __result[3] }; - return ret; -} - -static __inline__ vector unsigned int __ATTRS_o_ai -vec_addec(vector unsigned int __a, vector unsigned int __b, - vector unsigned int __c) { - - unsigned int __result[4]; - for (int i = 0; i < 4; i++) { -unsigned int __tempc = __c[i] & 1; -unsigned long long __longa = (unsigned long long) __a[i]; -unsigned long long __longb = (unsigned long long) __b[i]; -unsigned long long __longc = (unsigned long long) __tempc; -unsigned long long __sum = __longa + __longb + __longc; -unsigned long long __res = (__sum >> 32) & 0x01; -unsigned long long __tempres = (unsigned int) __res; -__result[i] = (signed int) __tempres; - } - - vector unsigned int ret = { __result[0], __result[1], __result[2], __result[3] }; - return ret; -} - #endif /* vec_vaddubm */ @@ -11149,11 +11089,6 @@ vec_vsubfp(vector float __a, vector floa /* vec_subc */ -static __inline__ vector signed int __ATTRS_o_ai -vec_subc(vector signed int __a, vector signed int __b) { - return __builtin_altivec_vsubcuw(__a, __b); -} - static __inline__ vector unsigned int __ATTRS_o_ai vec_subc(vector unsigned int __a, vector unsigned int __b) { return __builtin_altivec_vsubcuw(__a, __b); @@ -11387,7 +11322,6 @@ vec_vsubuqm(vector unsigned __int128 __a /* vec_vsubeuqm */ - static __inline__ vector signed __int128 __ATTRS_o_ai vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b, vector signed __int128 __c) { @@ -11400,18 +11334,6 @@ vec_vsubeuqm(vector unsigned __int128 __ return __builtin_altivec_vsubeuqm(__a, __b, __c); } -static __inline__ vector signed __int128 __ATTRS_o_ai -vec_sube(vector signed __int128 __a, vector signed __int128 __b, - vector signed __int128 __c) { - return __builtin_altivec_vsubeuqm(__a, __b, __c); -} - -static __inline__ vector unsigned __int128 __ATTRS_o_ai -vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b, - vector unsigned __int128 __c) { - return __builtin_altivec_vsubeuqm(__a, __b, __c); -} - /* vec_vsubcuq */ static __inline__ vector signed __int128
Re: r287774 - Remove C++ default arg side table for MS ABI ctor closures
Cool, thanks! Should we also have a test for using a default arg with a pch? Now that ASTContext doesn't have this table any more, it'll work, but maybe it's good to have a regression test for the issue in the PR? On Wed, Nov 23, 2016 at 11:51 AM, Reid Kleckner via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: rnk > Date: Wed Nov 23 10:51:30 2016 > New Revision: 287774 > > URL: http://llvm.org/viewvc/llvm-project?rev=287774&view=rev > Log: > Remove C++ default arg side table for MS ABI ctor closures > > Summary: > We don't need a side table in ASTContext to hold CXXDefaultArgExprs. The > important part of building the CXXDefaultArgExprs was to ODR use the > default argument expressions, not to make AST nodes. Refactor the code > to only check the default argument, and remove the side table in > ASTContext which wasn't being serialized. > > Fixes PR31121 > > Reviewers: thakis, rsmith, majnemer > > Subscribers: cfe-commits > > Differential Revision: https://reviews.llvm.org/D27007 > > Added: > cfe/trunk/test/SemaCXX/default-arg-closures.cpp > Modified: > cfe/trunk/include/clang/AST/ASTContext.h > cfe/trunk/include/clang/Sema/Sema.h > cfe/trunk/lib/AST/ASTContext.cpp > cfe/trunk/lib/AST/CXXABI.h > cfe/trunk/lib/AST/ItaniumCXXABI.cpp > cfe/trunk/lib/AST/MicrosoftCXXABI.cpp > cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp > cfe/trunk/lib/Sema/SemaDeclCXX.cpp > cfe/trunk/lib/Sema/SemaExpr.cpp > cfe/trunk/lib/Sema/SemaExprCXX.cpp > > Modified: cfe/trunk/include/clang/AST/ASTContext.h > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/ > clang/AST/ASTContext.h?rev=287774&r1=287773&r2=287774&view=diff > > == > --- cfe/trunk/include/clang/AST/ASTContext.h (original) > +++ cfe/trunk/include/clang/AST/ASTContext.h Wed Nov 23 10:51:30 2016 > @@ -2452,12 +2452,6 @@ public: >void addCopyConstructorForExceptionObject(CXXRecordDecl *RD, > CXXConstructorDecl *CD); > > - void addDefaultArgExprForConstructor(const CXXConstructorDecl *CD, > - unsigned ParmIdx, Expr *DAE); > - > - Expr *getDefaultArgExprForConstructor(const CXXConstructorDecl *CD, > -unsigned ParmIdx); > - >void addTypedefNameForUnnamedTagDecl(TagDecl *TD, TypedefNameDecl > *TND); > >TypedefNameDecl *getTypedefNameForUnnamedTagDecl(const TagDecl *TD); > > Modified: cfe/trunk/include/clang/Sema/Sema.h > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/ > clang/Sema/Sema.h?rev=287774&r1=287773&r2=287774&view=diff > > == > --- cfe/trunk/include/clang/Sema/Sema.h (original) > +++ cfe/trunk/include/clang/Sema/Sema.h Wed Nov 23 10:51:30 2016 > @@ -4408,6 +4408,12 @@ public: > >ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl > *Field); > > + > + /// Instantiate or parse a C++ default argument expression as necessary. > + /// Return true on error. > + bool CheckCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, > + ParmVarDecl *Param); > + >/// BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating >/// the default expr if needed. >ExprResult BuildCXXDefaultArgExpr(SourceLocation CallLoc, > > Modified: cfe/trunk/lib/AST/ASTContext.cpp > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ > ASTContext.cpp?rev=287774&r1=287773&r2=287774&view=diff > > == > --- cfe/trunk/lib/AST/ASTContext.cpp (original) > +++ cfe/trunk/lib/AST/ASTContext.cpp Wed Nov 23 10:51:30 2016 > @@ -9172,18 +9172,6 @@ void ASTContext::addCopyConstructorForEx >cast(CD->getFirstDecl())); > } > > -void ASTContext::addDefaultArgExprForConstructor(const > CXXConstructorDecl *CD, > - unsigned ParmIdx, Expr > *DAE) { > - ABI->addDefaultArgExprForConstructor( > - cast(CD->getFirstDecl()), ParmIdx, DAE); > -} > - > -Expr *ASTContext::getDefaultArgExprForConstructor(const > CXXConstructorDecl *CD, > - unsigned ParmIdx) { > - return ABI->getDefaultArgExprForConstructor( > - cast(CD->getFirstDecl()), ParmIdx); > -} > - > void ASTContext::addTypedefNameForUnnamedTagDecl(TagDecl *TD, > TypedefNameDecl *DD) { >return ABI->addTypedefNameForUnnamedTagDecl(TD, DD); > > Modified: cfe/trunk/lib/AST/CXXABI.h > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ > CXXABI.h?rev=287774&r1=287773&r2=287774&view=diff > > == > --- cfe/trunk/lib/AST/CXXABI.h (original) > +++ cfe/trunk/lib/AST/CXXABI.h Wed Nov 23 10:51:30 2016 > @@ -54,12 +54,6 @@
[PATCH] D26978: [Sema][Atomics] Treat expected pointer in compare exchange atomics as _Nonnull
This revision was automatically updated to reflect the committed changes. Closed by commit rL287776: [Sema][Atomics] Treat expected pointer in compare exchange atomics as _Nonnull (authored by arphaman). Changed prior to commit: https://reviews.llvm.org/D26978?vs=78884&id=79107#toc Repository: rL LLVM https://reviews.llvm.org/D26978 Files: cfe/trunk/lib/Sema/SemaChecking.cpp cfe/trunk/test/Sema/atomic-ops.c Index: cfe/trunk/test/Sema/atomic-ops.c === --- cfe/trunk/test/Sema/atomic-ops.c +++ cfe/trunk/test/Sema/atomic-ops.c @@ -174,14 +174,14 @@ __atomic_fetch_or(D, 3, memory_order_seq_cst); // expected-error {{must be a pointer to integer}} __atomic_fetch_and(s1, 3, memory_order_seq_cst); // expected-error {{must be a pointer to integer}} - _Bool cmpexch_1 = __c11_atomic_compare_exchange_strong(i, 0, 1, memory_order_seq_cst, memory_order_seq_cst); - _Bool cmpexch_2 = __c11_atomic_compare_exchange_strong(p, 0, (int*)1, memory_order_seq_cst, memory_order_seq_cst); - _Bool cmpexch_3 = __c11_atomic_compare_exchange_strong(d, (int*)0, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{incompatible pointer types}} + _Bool cmpexch_1 = __c11_atomic_compare_exchange_strong(i, I, 1, memory_order_seq_cst, memory_order_seq_cst); + _Bool cmpexch_2 = __c11_atomic_compare_exchange_strong(p, P, (int*)1, memory_order_seq_cst, memory_order_seq_cst); + _Bool cmpexch_3 = __c11_atomic_compare_exchange_strong(d, I, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{incompatible pointer types}} (void)__c11_atomic_compare_exchange_strong(i, CI, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{passing 'const int *' to parameter of type 'int *' discards qualifiers}} - _Bool cmpexchw_1 = __c11_atomic_compare_exchange_weak(i, 0, 1, memory_order_seq_cst, memory_order_seq_cst); - _Bool cmpexchw_2 = __c11_atomic_compare_exchange_weak(p, 0, (int*)1, memory_order_seq_cst, memory_order_seq_cst); - _Bool cmpexchw_3 = __c11_atomic_compare_exchange_weak(d, (int*)0, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{incompatible pointer types}} + _Bool cmpexchw_1 = __c11_atomic_compare_exchange_weak(i, I, 1, memory_order_seq_cst, memory_order_seq_cst); + _Bool cmpexchw_2 = __c11_atomic_compare_exchange_weak(p, P, (int*)1, memory_order_seq_cst, memory_order_seq_cst); + _Bool cmpexchw_3 = __c11_atomic_compare_exchange_weak(d, I, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{incompatible pointer types}} (void)__c11_atomic_compare_exchange_weak(i, CI, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{passing 'const int *' to parameter of type 'int *' discards qualifiers}} _Bool cmpexch_4 = __atomic_compare_exchange_n(I, I, 5, 1, memory_order_seq_cst, memory_order_seq_cst); @@ -503,4 +503,9 @@ (void)__atomic_compare_exchange_n(p, p, val, 0, memory_order_seq_cst, memory_order_relaxed); } - +void nullPointerWarning(_Atomic(int) *Ap, int *p, int val) { + // The 'expected' pointer shouldn't be NULL. + (void)__c11_atomic_compare_exchange_strong(Ap, NULL, val, memory_order_relaxed, memory_order_relaxed); // expected-warning {{null passed to a callee that requires a non-null argument}} + (void)atomic_compare_exchange_weak(Ap, ((void*)0), val); // expected-warning {{null passed to a callee that requires a non-null argument}} + (void)__atomic_compare_exchange_n(p, NULL, val, 0, memory_order_relaxed, memory_order_relaxed); // expected-warning {{null passed to a callee that requires a non-null argument}} +} Index: cfe/trunk/lib/Sema/SemaChecking.cpp === --- cfe/trunk/lib/Sema/SemaChecking.cpp +++ cfe/trunk/lib/Sema/SemaChecking.cpp @@ -2868,6 +2868,9 @@ Ty = Context.getPointerDiffType(); else { Expr *ValArg = TheCall->getArg(i); + // Treat this argument as _Nonnull as we want to show a warning if + // NULL is passed into it. + CheckNonNullArgument(*this, ValArg, DRE->getLocStart()); unsigned AS = 0; // Keep address space of non-atomic pointer type. if (const PointerType *PtrTy = Index: cfe/trunk/test/Sema/atomic-ops.c === --- cfe/trunk/test/Sema/atomic-ops.c +++ cfe/trunk/test/Sema/atomic-ops.c @@ -174,14 +174,14 @@ __atomic_fetch_or(D, 3, memory_order_seq_cst); // expected-error {{must be a pointer to integer}} __atomic_fetch_and(s1, 3, memory_order_seq_cst); // expected-error {{must be a pointer to integer}} - _Bool cmpexch_1 = __c11_atomic_compare_exchange_strong(i, 0, 1, memory_order_seq_cst, memory_order_seq_cst); - _Bool cmpexch_2 = __c11_atomic_compare_exchange_strong(p, 0, (int*)1, memory_order_seq_cst, memory_order_seq_cst); - _Bool cmpexch_3 = __c11_atom
[PATCH] D27007: Remove C++ default arg side table for MS ABI ctor closures
rnk added inline comments. Comment at: lib/Sema/SemaExprCXX.cpp:861 // friendship or any other means). Context.addCopyConstructorForExceptionObject(Subobject, CD); rsmith wrote: > It would seem a lot more reasonable to actually form an expression to perform > the copy of the exception object, and attach that to the `ThrowExpr` somehow. > > Most of this work should not be MS-ABI-specific -- we're required to check > that a thrown exception object can be copied (from a non-cv-qualified lvalue) > regardless of ABI mode (see [except.throw]/5). In fact, for AST consumers > other than IR generation, we could argue that /none/ of this should be MS-ABI > specific; those consumers might want to find the implied call to the > exception type's copy constructor within the guts of the throw expression, > even if we never happen to use it when targeting Itanium. > > So... how about we just unconditionally store a copy expression on the > `ThrowExpr`? (With an `OpaqueValueExpr` representing the exception itself.) Sounds like a good plan. I'm going to take a shot at that ArrayRef on FunctionDecl thing first, though. Repository: rL LLVM https://reviews.llvm.org/D27007 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r287776 - [Sema][Atomics] Treat expected pointer in compare exchange atomics as _Nonnull
Author: arphaman Date: Wed Nov 23 10:57:03 2016 New Revision: 287776 URL: http://llvm.org/viewvc/llvm-project?rev=287776&view=rev Log: [Sema][Atomics] Treat expected pointer in compare exchange atomics as _Nonnull This commit teaches clang that is has to emit a warning when NULL is passed as the 'expected' pointer parameter into an atomic compare exchange call. rdar://18926650 Differential Revision: https://reviews.llvm.org/D26978 Modified: cfe/trunk/lib/Sema/SemaChecking.cpp cfe/trunk/test/Sema/atomic-ops.c Modified: cfe/trunk/lib/Sema/SemaChecking.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=287776&r1=287775&r2=287776&view=diff == --- cfe/trunk/lib/Sema/SemaChecking.cpp (original) +++ cfe/trunk/lib/Sema/SemaChecking.cpp Wed Nov 23 10:57:03 2016 @@ -2868,6 +2868,9 @@ ExprResult Sema::SemaAtomicOpsOverloaded Ty = Context.getPointerDiffType(); else { Expr *ValArg = TheCall->getArg(i); + // Treat this argument as _Nonnull as we want to show a warning if + // NULL is passed into it. + CheckNonNullArgument(*this, ValArg, DRE->getLocStart()); unsigned AS = 0; // Keep address space of non-atomic pointer type. if (const PointerType *PtrTy = Modified: cfe/trunk/test/Sema/atomic-ops.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/atomic-ops.c?rev=287776&r1=287775&r2=287776&view=diff == --- cfe/trunk/test/Sema/atomic-ops.c (original) +++ cfe/trunk/test/Sema/atomic-ops.c Wed Nov 23 10:57:03 2016 @@ -174,14 +174,14 @@ void f(_Atomic(int) *i, const _Atomic(in __atomic_fetch_or(D, 3, memory_order_seq_cst); // expected-error {{must be a pointer to integer}} __atomic_fetch_and(s1, 3, memory_order_seq_cst); // expected-error {{must be a pointer to integer}} - _Bool cmpexch_1 = __c11_atomic_compare_exchange_strong(i, 0, 1, memory_order_seq_cst, memory_order_seq_cst); - _Bool cmpexch_2 = __c11_atomic_compare_exchange_strong(p, 0, (int*)1, memory_order_seq_cst, memory_order_seq_cst); - _Bool cmpexch_3 = __c11_atomic_compare_exchange_strong(d, (int*)0, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{incompatible pointer types}} + _Bool cmpexch_1 = __c11_atomic_compare_exchange_strong(i, I, 1, memory_order_seq_cst, memory_order_seq_cst); + _Bool cmpexch_2 = __c11_atomic_compare_exchange_strong(p, P, (int*)1, memory_order_seq_cst, memory_order_seq_cst); + _Bool cmpexch_3 = __c11_atomic_compare_exchange_strong(d, I, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{incompatible pointer types}} (void)__c11_atomic_compare_exchange_strong(i, CI, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{passing 'const int *' to parameter of type 'int *' discards qualifiers}} - _Bool cmpexchw_1 = __c11_atomic_compare_exchange_weak(i, 0, 1, memory_order_seq_cst, memory_order_seq_cst); - _Bool cmpexchw_2 = __c11_atomic_compare_exchange_weak(p, 0, (int*)1, memory_order_seq_cst, memory_order_seq_cst); - _Bool cmpexchw_3 = __c11_atomic_compare_exchange_weak(d, (int*)0, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{incompatible pointer types}} + _Bool cmpexchw_1 = __c11_atomic_compare_exchange_weak(i, I, 1, memory_order_seq_cst, memory_order_seq_cst); + _Bool cmpexchw_2 = __c11_atomic_compare_exchange_weak(p, P, (int*)1, memory_order_seq_cst, memory_order_seq_cst); + _Bool cmpexchw_3 = __c11_atomic_compare_exchange_weak(d, I, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{incompatible pointer types}} (void)__c11_atomic_compare_exchange_weak(i, CI, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{passing 'const int *' to parameter of type 'int *' discards qualifiers}} _Bool cmpexch_4 = __atomic_compare_exchange_n(I, I, 5, 1, memory_order_seq_cst, memory_order_seq_cst); @@ -503,4 +503,9 @@ void memory_checks(_Atomic(int) *Ap, int (void)__atomic_compare_exchange_n(p, p, val, 0, memory_order_seq_cst, memory_order_relaxed); } - +void nullPointerWarning(_Atomic(int) *Ap, int *p, int val) { + // The 'expected' pointer shouldn't be NULL. + (void)__c11_atomic_compare_exchange_strong(Ap, NULL, val, memory_order_relaxed, memory_order_relaxed); // expected-warning {{null passed to a callee that requires a non-null argument}} + (void)atomic_compare_exchange_weak(Ap, ((void*)0), val); // expected-warning {{null passed to a callee that requires a non-null argument}} + (void)__atomic_compare_exchange_n(p, NULL, val, 0, memory_order_relaxed, memory_order_relaxed); // expected-warning {{null passed to a callee that requires a non-null argument}} +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lis
[PATCH] D27058: Testing phabricator email
ioeric created this revision. ioeric added a reviewer: hokein. ioeric added a subscriber: cfe-commits. Herald added a subscriber: klimek. Do not submit! https://reviews.llvm.org/D27058 Files: include/clang/Tooling/Refactoring/EditList.h lib/Tooling/Refactoring/EditList.cpp unittests/Tooling/RefactoringTest.cpp Index: unittests/Tooling/RefactoringTest.cpp === --- unittests/Tooling/RefactoringTest.cpp +++ unittests/Tooling/RefactoringTest.cpp @@ -1168,7 +1168,7 @@ ExpectedEdit.removeHeader("b.h"); ExpectedEdit.setError("ok"); - EditList ActualEdit = EditList::ConvertFromYAML(YamlContent); + EditList ActualEdit = EditList::convertFromYAML(YamlContent); EXPECT_EQ(ExpectedEdit.getKey(), ActualEdit.getKey()); EXPECT_EQ(ExpectedEdit.getFilePath(), ActualEdit.getFilePath()); EXPECT_EQ(ExpectedEdit.getError(), ActualEdit.getError()); Index: lib/Tooling/Refactoring/EditList.cpp === --- lib/Tooling/Refactoring/EditList.cpp +++ lib/Tooling/Refactoring/EditList.cpp @@ -1,4 +1,4 @@ -//===--- EditList.h - EditList implementation ---*- C++ -*-===// +//===--- EditList.cpp - EditList implementation -*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -100,7 +100,7 @@ return YamlContent; } -EditList EditList::ConvertFromYAML(llvm::StringRef YAMLContent) { +EditList EditList::convertFromYAML(llvm::StringRef YAMLContent) { EditList Edit; llvm::yaml::Input YAML(YAMLContent); YAML >> Edit; Index: include/clang/Tooling/Refactoring/EditList.h === --- include/clang/Tooling/Refactoring/EditList.h +++ include/clang/Tooling/Refactoring/EditList.h @@ -49,7 +49,7 @@ std::string toYAMLString(); /// \brief Converts a YAML-encoded edit to EditList. - static EditList ConvertFromYAML(llvm::StringRef YAMLContent); + static EditList convertFromYAML(llvm::StringRef YAMLContent); /// \brief Returns the key of this edit, which is a concatenation of the file /// name and position information of the key position. Index: unittests/Tooling/RefactoringTest.cpp === --- unittests/Tooling/RefactoringTest.cpp +++ unittests/Tooling/RefactoringTest.cpp @@ -1168,7 +1168,7 @@ ExpectedEdit.removeHeader("b.h"); ExpectedEdit.setError("ok"); - EditList ActualEdit = EditList::ConvertFromYAML(YamlContent); + EditList ActualEdit = EditList::convertFromYAML(YamlContent); EXPECT_EQ(ExpectedEdit.getKey(), ActualEdit.getKey()); EXPECT_EQ(ExpectedEdit.getFilePath(), ActualEdit.getFilePath()); EXPECT_EQ(ExpectedEdit.getError(), ActualEdit.getError()); Index: lib/Tooling/Refactoring/EditList.cpp === --- lib/Tooling/Refactoring/EditList.cpp +++ lib/Tooling/Refactoring/EditList.cpp @@ -1,4 +1,4 @@ -//===--- EditList.h - EditList implementation ---*- C++ -*-===// +//===--- EditList.cpp - EditList implementation -*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -100,7 +100,7 @@ return YamlContent; } -EditList EditList::ConvertFromYAML(llvm::StringRef YAMLContent) { +EditList EditList::convertFromYAML(llvm::StringRef YAMLContent) { EditList Edit; llvm::yaml::Input YAML(YAMLContent); YAML >> Edit; Index: include/clang/Tooling/Refactoring/EditList.h === --- include/clang/Tooling/Refactoring/EditList.h +++ include/clang/Tooling/Refactoring/EditList.h @@ -49,7 +49,7 @@ std::string toYAMLString(); /// \brief Converts a YAML-encoded edit to EditList. - static EditList ConvertFromYAML(llvm::StringRef YAMLContent); + static EditList convertFromYAML(llvm::StringRef YAMLContent); /// \brief Returns the key of this edit, which is a concatenation of the file /// name and position information of the key position. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27059: [clang-move] Enable dump all declarations in old header.
hokein created this revision. hokein added a reviewer: ioeric. hokein added a subscriber: cfe-commits. - Add -dump_dels option to dump all declarations from old header. It will allow clang-move used as a frontend to get declarations from header. Further more, this will make debugging stuff easier.Currently only support dumpng class/function types. - Refactoring code a little bit by creating a ClangMoveContext which holds all options for ClangMoveTool, which can simplify the code in some degree. https://reviews.llvm.org/D27059 Files: clang-move/ClangMove.cpp clang-move/ClangMove.h clang-move/tool/ClangMoveMain.cpp unittests/clang-move/ClangMoveTests.cpp Index: unittests/clang-move/ClangMoveTests.cpp === --- unittests/clang-move/ClangMoveTests.cpp +++ unittests/clang-move/ClangMoveTests.cpp @@ -180,9 +180,10 @@ "} // namespace a\n"; std::map -runClangMoveOnCode(const move::ClangMoveTool::MoveDefinitionSpec &Spec, +runClangMoveOnCode(const move::MoveDefinitionSpec &Spec, const char *const Header = TestHeader, - const char *const CC = TestCC) { + const char *const CC = TestCC, + DeclarationReporter* const Reporter = nullptr) { clang::RewriterTestContext Context; std::map FileToFileID; @@ -205,8 +206,12 @@ std::error_code EC = llvm::sys::fs::current_path(InitialDirectory); assert(!EC); (void)EC; + ClangMoveContext MoveContext = {Spec, FileToReplacements, + InitialDirectory.str(), "LLVM", + Reporter != nullptr}; + auto Factory = llvm::make_unique( - Spec, FileToReplacements, InitialDirectory.str(), "LLVM"); + &MoveContext, Reporter); tooling::runToolOnCodeWithArgs( Factory->create(), CC, {"-std=c++11", "-fparse-all-comments"}, @@ -223,7 +228,7 @@ } TEST(ClangMove, MoveHeaderAndCC) { - move::ClangMoveTool::MoveDefinitionSpec Spec; + move::MoveDefinitionSpec Spec; Spec.Names = {std::string("a::b::Foo")}; Spec.OldHeader = "foo.h"; Spec.OldCC = "foo.cc"; @@ -238,7 +243,7 @@ } TEST(ClangMove, MoveHeaderOnly) { - move::ClangMoveTool::MoveDefinitionSpec Spec; + move::MoveDefinitionSpec Spec; Spec.Names = {std::string("a::b::Foo")}; Spec.OldHeader = "foo.h"; Spec.NewHeader = "new_foo.h"; @@ -249,7 +254,7 @@ } TEST(ClangMove, MoveCCOnly) { - move::ClangMoveTool::MoveDefinitionSpec Spec; + move::MoveDefinitionSpec Spec; Spec.Names = {std::string("a::b::Foo")}; Spec.OldCC = "foo.cc"; Spec.NewCC = "new_foo.cc"; @@ -261,7 +266,7 @@ } TEST(ClangMove, MoveNonExistClass) { - move::ClangMoveTool::MoveDefinitionSpec Spec; + move::MoveDefinitionSpec Spec; Spec.Names = {std::string("NonExistFoo")}; Spec.OldHeader = "foo.h"; Spec.OldCC = "foo.cc"; @@ -282,7 +287,7 @@ "namespace a {}\nusing namespace a;\nclass A {\npublic:\n int f();\n};", }; const char Code[] = "#include \"foo.h\"\nint A::f() { return 0; }"; - move::ClangMoveTool::MoveDefinitionSpec Spec; + move::MoveDefinitionSpec Spec; Spec.Names.push_back("A"); Spec.OldHeader = "foo.h"; Spec.OldCC = "foo.cc"; @@ -297,7 +302,7 @@ } TEST(ClangMove, MoveAllMultipleClasses) { - move::ClangMoveTool::MoveDefinitionSpec Spec; + move::MoveDefinitionSpec Spec; std::vector TestHeaders = { "class C;\nclass A {\npublic:\n int f();\n};\nclass B {};", "class C;\nclass B;\nclass A {\npublic:\n int f();\n};\nclass B {};", @@ -331,7 +336,7 @@ "void f() {};\nclass A {\npublic:\n int f();\n};\n", "enum Color { RED };\nclass A {\npublic:\n int f();\n};\n", }; - move::ClangMoveTool::MoveDefinitionSpec Spec; + move::MoveDefinitionSpec Spec; Spec.Names.push_back("A"); Spec.OldHeader = "foo.h"; Spec.OldCC = "foo.cc"; @@ -354,7 +359,7 @@ "INT A::f() { return 0; }\n"; const char ExpectedNewCode[] = "#include \"new_foo.h\"\n\n" "INT A::f() { return 0; }\n"; - move::ClangMoveTool::MoveDefinitionSpec Spec; + move::MoveDefinitionSpec Spec; Spec.Names.push_back("A"); Spec.OldHeader = "foo.h"; Spec.OldCC = "foo.cc"; @@ -407,7 +412,7 @@ "\n" "#endif // NEW_FOO_H\n"; const std::string ExpectedNewCC = "#include \"new_foo.h\"\n" + CommonCode; - move::ClangMoveTool::MoveDefinitionSpec Spec; + move::MoveDefinitionSpec Spec; Spec.Names.push_back("a::b::c::A"); Spec.Names.push_back("a::d::e::B"); Spec.OldHeader = "foo.h"; @@ -430,7 +435,7 @@ "class A {};\n" "\n" "#endif // NEW_FOO_H\n"; - move::ClangMoveTool::MoveDefinitionSpec Spec; + move::MoveDefinitionSpec Spec; Spec.Names.push_back("A"); Spec.OldHeader = "foo.h";
[PATCH] D27059: [clang-move] Enable dump all declarations in old header.
hokein updated this revision to Diff 79120. hokein added a comment. Code style. https://reviews.llvm.org/D27059 Files: clang-move/ClangMove.cpp clang-move/ClangMove.h clang-move/tool/ClangMoveMain.cpp unittests/clang-move/ClangMoveTests.cpp Index: unittests/clang-move/ClangMoveTests.cpp === --- unittests/clang-move/ClangMoveTests.cpp +++ unittests/clang-move/ClangMoveTests.cpp @@ -180,9 +180,10 @@ "} // namespace a\n"; std::map -runClangMoveOnCode(const move::ClangMoveTool::MoveDefinitionSpec &Spec, +runClangMoveOnCode(const move::MoveDefinitionSpec &Spec, const char *const Header = TestHeader, - const char *const CC = TestCC) { + const char *const CC = TestCC, + DeclarationReporter *const Reporter = nullptr) { clang::RewriterTestContext Context; std::map FileToFileID; @@ -205,8 +206,12 @@ std::error_code EC = llvm::sys::fs::current_path(InitialDirectory); assert(!EC); (void)EC; + ClangMoveContext MoveContext = {Spec, FileToReplacements, + InitialDirectory.str(), "LLVM", + Reporter != nullptr}; + auto Factory = llvm::make_unique( - Spec, FileToReplacements, InitialDirectory.str(), "LLVM"); + &MoveContext, Reporter); tooling::runToolOnCodeWithArgs( Factory->create(), CC, {"-std=c++11", "-fparse-all-comments"}, @@ -223,7 +228,7 @@ } TEST(ClangMove, MoveHeaderAndCC) { - move::ClangMoveTool::MoveDefinitionSpec Spec; + move::MoveDefinitionSpec Spec; Spec.Names = {std::string("a::b::Foo")}; Spec.OldHeader = "foo.h"; Spec.OldCC = "foo.cc"; @@ -238,7 +243,7 @@ } TEST(ClangMove, MoveHeaderOnly) { - move::ClangMoveTool::MoveDefinitionSpec Spec; + move::MoveDefinitionSpec Spec; Spec.Names = {std::string("a::b::Foo")}; Spec.OldHeader = "foo.h"; Spec.NewHeader = "new_foo.h"; @@ -249,7 +254,7 @@ } TEST(ClangMove, MoveCCOnly) { - move::ClangMoveTool::MoveDefinitionSpec Spec; + move::MoveDefinitionSpec Spec; Spec.Names = {std::string("a::b::Foo")}; Spec.OldCC = "foo.cc"; Spec.NewCC = "new_foo.cc"; @@ -261,7 +266,7 @@ } TEST(ClangMove, MoveNonExistClass) { - move::ClangMoveTool::MoveDefinitionSpec Spec; + move::MoveDefinitionSpec Spec; Spec.Names = {std::string("NonExistFoo")}; Spec.OldHeader = "foo.h"; Spec.OldCC = "foo.cc"; @@ -282,7 +287,7 @@ "namespace a {}\nusing namespace a;\nclass A {\npublic:\n int f();\n};", }; const char Code[] = "#include \"foo.h\"\nint A::f() { return 0; }"; - move::ClangMoveTool::MoveDefinitionSpec Spec; + move::MoveDefinitionSpec Spec; Spec.Names.push_back("A"); Spec.OldHeader = "foo.h"; Spec.OldCC = "foo.cc"; @@ -297,7 +302,7 @@ } TEST(ClangMove, MoveAllMultipleClasses) { - move::ClangMoveTool::MoveDefinitionSpec Spec; + move::MoveDefinitionSpec Spec; std::vector TestHeaders = { "class C;\nclass A {\npublic:\n int f();\n};\nclass B {};", "class C;\nclass B;\nclass A {\npublic:\n int f();\n};\nclass B {};", @@ -331,7 +336,7 @@ "void f() {};\nclass A {\npublic:\n int f();\n};\n", "enum Color { RED };\nclass A {\npublic:\n int f();\n};\n", }; - move::ClangMoveTool::MoveDefinitionSpec Spec; + move::MoveDefinitionSpec Spec; Spec.Names.push_back("A"); Spec.OldHeader = "foo.h"; Spec.OldCC = "foo.cc"; @@ -354,7 +359,7 @@ "INT A::f() { return 0; }\n"; const char ExpectedNewCode[] = "#include \"new_foo.h\"\n\n" "INT A::f() { return 0; }\n"; - move::ClangMoveTool::MoveDefinitionSpec Spec; + move::MoveDefinitionSpec Spec; Spec.Names.push_back("A"); Spec.OldHeader = "foo.h"; Spec.OldCC = "foo.cc"; @@ -407,7 +412,7 @@ "\n" "#endif // NEW_FOO_H\n"; const std::string ExpectedNewCC = "#include \"new_foo.h\"\n" + CommonCode; - move::ClangMoveTool::MoveDefinitionSpec Spec; + move::MoveDefinitionSpec Spec; Spec.Names.push_back("a::b::c::A"); Spec.Names.push_back("a::d::e::B"); Spec.OldHeader = "foo.h"; @@ -430,7 +435,7 @@ "class A {};\n" "\n" "#endif // NEW_FOO_H\n"; - move::ClangMoveTool::MoveDefinitionSpec Spec; + move::MoveDefinitionSpec Spec; Spec.Names.push_back("A"); Spec.OldHeader = "foo.h"; Spec.OldCC = "foo.cc"; @@ -455,7 +460,7 @@ "\n" "#endif // NEW_FOO_H\n"; const char ExpectedOldHeader[] = "class A {};\n"; - move::ClangMoveTool::MoveDefinitionSpec Spec; + move::MoveDefinitionSpec Spec; Spec.Names.push_back("B"); Spec.OldHeader = "foo.h"; Spec.OldCC = "foo.cc"; @@ -467,6 +472,60 @@ EXPECT_EQ(ExpectedOldHeader, Re
r287793 - Add dllexport default ctor closure PCH regression test for PR31121
Author: rnk Date: Wed Nov 23 12:33:54 2016 New Revision: 287793 URL: http://llvm.org/viewvc/llvm-project?rev=287793&view=rev Log: Add dllexport default ctor closure PCH regression test for PR31121 Follow up to r287774 Added: cfe/trunk/test/PCH/dllexport-default-arg-closure.cpp Added: cfe/trunk/test/PCH/dllexport-default-arg-closure.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/dllexport-default-arg-closure.cpp?rev=287793&view=auto == --- cfe/trunk/test/PCH/dllexport-default-arg-closure.cpp (added) +++ cfe/trunk/test/PCH/dllexport-default-arg-closure.cpp Wed Nov 23 12:33:54 2016 @@ -0,0 +1,26 @@ +// Make sure we emit the MS ABI default ctor closure with PCH. +// +// Test this without pch. +// RUN: %clang_cc1 -fms-extensions -triple x86_64-windows-msvc -std=c++11 -include %s -emit-llvm -o - %s | FileCheck %s + +// Test with pch. +// RUN: %clang_cc1 -fms-extensions -triple x86_64-windows-msvc -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fms-extensions -triple x86_64-windows-msvc -std=c++11 -include-pch %t -emit-llvm -o - %s | FileCheck %s + +#ifndef HEADER +#define HEADER + +struct __declspec(dllexport) Foo { + enum E { E0 } e; + Foo(E e = E0) : e(e) {} +}; + +// Demangles as: +// void Foo::`default constructor closure'(void) +// CHECK: define weak_odr dllexport void @"\01??_FFoo@@QEAAXXZ"(%struct.Foo*{{.*}}) +// CHECK: call %struct.Foo* @"\01??0Foo@@QEAA@W4E@0@@Z"(%struct.Foo* {{.*}}, i32 0) + +#else + + +#endif ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r287774 - Remove C++ default arg side table for MS ABI ctor closures
On Wed, Nov 23, 2016 at 9:06 AM, Nico Weber wrote: > Cool, thanks! Should we also have a test for using a default arg with a > pch? Now that ASTContext doesn't have this table any more, it'll work, but > maybe it's good to have a regression test for the issue in the PR? > Sure, r287793. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r287795 - [PPC] support for arithmetic builtins in the FE
Author: amehsan Date: Wed Nov 23 12:36:29 2016 New Revision: 287795 URL: http://llvm.org/viewvc/llvm-project?rev=287795&view=rev Log: [PPC] support for arithmetic builtins in the FE (commit again after fixing the buildbot failures) This adds various overloads of the following builtins to altivec.h: vec_neg vec_nabs vec_adde vec_addec vec_sube vec_subec vec_subc Note that for vec_sub builtins on 32 bit integers, the semantics is similar to what ISA describes for instructions like vsubecuq that work on quadwords: the first operand is added to the one's complement of the second operand. (As opposed to two's complement which I expected). Modified: cfe/trunk/lib/Headers/altivec.h cfe/trunk/test/CodeGen/builtins-ppc-altivec.c cfe/trunk/test/CodeGen/builtins-ppc-p8vector.c cfe/trunk/test/CodeGen/builtins-ppc-quadword.c cfe/trunk/test/CodeGen/builtins-ppc-vsx.c Modified: cfe/trunk/lib/Headers/altivec.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/altivec.h?rev=287795&r1=287794&r2=287795&view=diff == --- cfe/trunk/lib/Headers/altivec.h (original) +++ cfe/trunk/lib/Headers/altivec.h Wed Nov 23 12:36:29 2016 @@ -157,7 +157,7 @@ static __inline__ vector float __ATTRS_o #endif } -#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) +#ifdef __VSX__ static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) { return __builtin_vsx_xvabsdp(__a); } @@ -348,6 +348,22 @@ vec_adde(vector unsigned __int128 __a, v } #endif +static __inline__ vector signed int __ATTRS_o_ai +vec_adde(vector signed int __a, vector signed int __b, + vector signed int __c) { + vector signed int __mask = {1, 1, 1, 1}; + vector signed int __carry = __c & __mask; + return vec_add(vec_add(__a, __b), __carry); +} + +static __inline__ vector unsigned int __ATTRS_o_ai +vec_adde(vector unsigned int __a, vector unsigned int __b, + vector unsigned int __c) { + vector unsigned int __mask = {1, 1, 1, 1}; + vector unsigned int __carry = __c & __mask; + return vec_add(vec_add(__a, __b), __carry); +} + /* vec_addec */ #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) @@ -362,6 +378,50 @@ vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __c) { return __builtin_altivec_vaddecuq(__a, __b, __c); } + +static __inline__ vector signed int __ATTRS_o_ai +vec_addec(vector signed int __a, vector signed int __b, + vector signed int __c) { + + signed int __result[4]; + for (int i = 0; i < 4; i++) { +unsigned int __tempa = (unsigned int) __a[i]; +unsigned int __tempb = (unsigned int) __b[i]; +unsigned int __tempc = (unsigned int) __c[i]; +__tempc = __tempc & 0x0001; +unsigned long long __longa = (unsigned long long) __tempa; +unsigned long long __longb = (unsigned long long) __tempb; +unsigned long long __longc = (unsigned long long) __tempc; +unsigned long long __sum = __longa + __longb + __longc; +unsigned long long __res = (__sum >> 32) & 0x01; +unsigned long long __tempres = (unsigned int) __res; +__result[i] = (signed int) __tempres; + } + + vector signed int ret = { __result[0], __result[1], __result[2], __result[3] }; + return ret; +} + +static __inline__ vector unsigned int __ATTRS_o_ai +vec_addec(vector unsigned int __a, vector unsigned int __b, + vector unsigned int __c) { + + unsigned int __result[4]; + for (int i = 0; i < 4; i++) { +unsigned int __tempc = __c[i] & 1; +unsigned long long __longa = (unsigned long long) __a[i]; +unsigned long long __longb = (unsigned long long) __b[i]; +unsigned long long __longc = (unsigned long long) __tempc; +unsigned long long __sum = __longa + __longb + __longc; +unsigned long long __res = (__sum >> 32) & 0x01; +unsigned long long __tempres = (unsigned int) __res; +__result[i] = (signed int) __tempres; + } + + vector unsigned int ret = { __result[0], __result[1], __result[2], __result[3] }; + return ret; +} + #endif /* vec_vaddubm */ @@ -11089,6 +11149,12 @@ vec_vsubfp(vector float __a, vector floa /* vec_subc */ +static __inline__ vector signed int __ATTRS_o_ai +vec_subc(vector signed int __a, vector signed int __b) { + return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a, + (vector unsigned int) __b); +} + static __inline__ vector unsigned int __ATTRS_o_ai vec_subc(vector unsigned int __a, vector unsigned int __b) { return __builtin_altivec_vsubcuw(__a, __b); @@ -11322,6 +11388,7 @@ vec_vsubuqm(vector unsigned __int128 __a /* vec_vsubeuqm */ + static __inline__ vector signed __int128 __ATTRS_o_ai vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b, vector signed __int128 __c) { @@ -11334,6 +11401,18 @@ vec_vsubeuqm(vector unsigned __int128 __ return __b
r287796 - [PPC] revert r287795
Author: amehsan Date: Wed Nov 23 12:55:17 2016 New Revision: 287796 URL: http://llvm.org/viewvc/llvm-project?rev=287796&view=rev Log: [PPC] revert r287795 A test that passed locally is failing on one of the build bots. Modified: cfe/trunk/lib/Headers/altivec.h cfe/trunk/test/CodeGen/builtins-ppc-altivec.c cfe/trunk/test/CodeGen/builtins-ppc-p8vector.c cfe/trunk/test/CodeGen/builtins-ppc-quadword.c cfe/trunk/test/CodeGen/builtins-ppc-vsx.c Modified: cfe/trunk/lib/Headers/altivec.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/altivec.h?rev=287796&r1=287795&r2=287796&view=diff == --- cfe/trunk/lib/Headers/altivec.h (original) +++ cfe/trunk/lib/Headers/altivec.h Wed Nov 23 12:55:17 2016 @@ -157,7 +157,7 @@ static __inline__ vector float __ATTRS_o #endif } -#ifdef __VSX__ +#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) { return __builtin_vsx_xvabsdp(__a); } @@ -348,22 +348,6 @@ vec_adde(vector unsigned __int128 __a, v } #endif -static __inline__ vector signed int __ATTRS_o_ai -vec_adde(vector signed int __a, vector signed int __b, - vector signed int __c) { - vector signed int __mask = {1, 1, 1, 1}; - vector signed int __carry = __c & __mask; - return vec_add(vec_add(__a, __b), __carry); -} - -static __inline__ vector unsigned int __ATTRS_o_ai -vec_adde(vector unsigned int __a, vector unsigned int __b, - vector unsigned int __c) { - vector unsigned int __mask = {1, 1, 1, 1}; - vector unsigned int __carry = __c & __mask; - return vec_add(vec_add(__a, __b), __carry); -} - /* vec_addec */ #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) @@ -378,50 +362,6 @@ vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __c) { return __builtin_altivec_vaddecuq(__a, __b, __c); } - -static __inline__ vector signed int __ATTRS_o_ai -vec_addec(vector signed int __a, vector signed int __b, - vector signed int __c) { - - signed int __result[4]; - for (int i = 0; i < 4; i++) { -unsigned int __tempa = (unsigned int) __a[i]; -unsigned int __tempb = (unsigned int) __b[i]; -unsigned int __tempc = (unsigned int) __c[i]; -__tempc = __tempc & 0x0001; -unsigned long long __longa = (unsigned long long) __tempa; -unsigned long long __longb = (unsigned long long) __tempb; -unsigned long long __longc = (unsigned long long) __tempc; -unsigned long long __sum = __longa + __longb + __longc; -unsigned long long __res = (__sum >> 32) & 0x01; -unsigned long long __tempres = (unsigned int) __res; -__result[i] = (signed int) __tempres; - } - - vector signed int ret = { __result[0], __result[1], __result[2], __result[3] }; - return ret; -} - -static __inline__ vector unsigned int __ATTRS_o_ai -vec_addec(vector unsigned int __a, vector unsigned int __b, - vector unsigned int __c) { - - unsigned int __result[4]; - for (int i = 0; i < 4; i++) { -unsigned int __tempc = __c[i] & 1; -unsigned long long __longa = (unsigned long long) __a[i]; -unsigned long long __longb = (unsigned long long) __b[i]; -unsigned long long __longc = (unsigned long long) __tempc; -unsigned long long __sum = __longa + __longb + __longc; -unsigned long long __res = (__sum >> 32) & 0x01; -unsigned long long __tempres = (unsigned int) __res; -__result[i] = (signed int) __tempres; - } - - vector unsigned int ret = { __result[0], __result[1], __result[2], __result[3] }; - return ret; -} - #endif /* vec_vaddubm */ @@ -11149,12 +11089,6 @@ vec_vsubfp(vector float __a, vector floa /* vec_subc */ -static __inline__ vector signed int __ATTRS_o_ai -vec_subc(vector signed int __a, vector signed int __b) { - return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a, - (vector unsigned int) __b); -} - static __inline__ vector unsigned int __ATTRS_o_ai vec_subc(vector unsigned int __a, vector unsigned int __b) { return __builtin_altivec_vsubcuw(__a, __b); @@ -11388,7 +11322,6 @@ vec_vsubuqm(vector unsigned __int128 __a /* vec_vsubeuqm */ - static __inline__ vector signed __int128 __ATTRS_o_ai vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b, vector signed __int128 __c) { @@ -11401,18 +11334,6 @@ vec_vsubeuqm(vector unsigned __int128 __ return __builtin_altivec_vsubeuqm(__a, __b, __c); } -static __inline__ vector signed __int128 __ATTRS_o_ai -vec_sube(vector signed __int128 __a, vector signed __int128 __b, - vector signed __int128 __c) { - return __builtin_altivec_vsubeuqm(__a, __b, __c); -} - -static __inline__ vector unsigned __int128 __ATTRS_o_ai -vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b, - vector unsigned __int128 __c) { - return __
[PATCH] D26827: Make tests more robust with Release builds
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. I'm ok with these changes but please check that tests are still working on Windows https://reviews.llvm.org/D26827 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24639: [Sema] Warn when returning a lambda that captures a local variable by reference
erik.pilkington added a comment. Ping! https://reviews.llvm.org/D24639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D22725: [clang-tidy] Add check 'modernize-use-algorithm'
JDevlieghere abandoned this revision. JDevlieghere added a comment. I'm abandoning this revision because I think this check is getting overly complex. There's still the problem of supporting arguments that can have side effects, and then there's also the unaddressed issue of code possibly using the void* return type of these two functions. Any solution to this would require rather inelegant and complex code that is, in my opinion, simply not warranted by the added value of this check. Repository: rL LLVM https://reviews.llvm.org/D22725 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D23765: Fix for clang PR 29087
rsmith accepted this revision. rsmith added a comment. This revision is now accepted and ready to land. Looks good for trunk and 3.9 branch. https://reviews.llvm.org/D23765 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r287822 - [libcxx] [test] D27014: Fix MSVC warning C4018 "signed/unsigned mismatch", part 2/12.
Author: stl_msft Date: Wed Nov 23 16:01:58 2016 New Revision: 287822 URL: http://llvm.org/viewvc/llvm-project?rev=287822&view=rev Log: [libcxx] [test] D27014: Fix MSVC warning C4018 "signed/unsigned mismatch", part 2/12. Add static_cast when comparing int to std::size_t. Also, include when it wasn't already being included. Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.access/iterator.pass.cpp libcxx/trunk/test/std/containers/associative/set/iterator.pass.cpp libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff == --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp Wed Nov 23 16:01:58 2016 @@ -19,6 +19,7 @@ #include #include #include +#include #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include @@ -77,7 +78,7 @@ int main() #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector > v(1000); -for (int i = 0; i < v.size(); ++i) +for (int i = 0; static_cast(i) < v.size(); ++i) v[i].reset(new int(i)); std::nth_element(v.begin(), v.begin() + v.size()/2, v.end(), indirect_less()); assert(*v[v.size()/2] == v.size()/2); Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff == --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp Wed Nov 23 16:01:58 2016 @@ -19,6 +19,7 @@ #include #include #include +#include #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include @@ -83,10 +84,10 @@ int main() #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector > v(1000); -for (int i = 0; i < v.size(); ++i) +for (int i = 0; static_cast(i) < v.size(); ++i) v[i].reset(new int(i)); std::partial_sort(v.begin(), v.begin() + v.size()/2, v.end(), indirect_less()); -for (int i = 0; i < v.size()/2; ++i) +for (int i = 0; static_cast(i) < v.size()/2; ++i) assert(*v[i] == i); } #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff == --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp Wed Nov 23 16:01:58 2016 @@ -19,6 +19,7 @@ #include #includ
[libcxx] r287824 - [libcxx] [test] D27016: Fix MSVC warning C4018 "signed/unsigned mismatch", part 4/12.
Author: stl_msft Date: Wed Nov 23 16:02:27 2016 New Revision: 287824 URL: http://llvm.org/viewvc/llvm-project?rev=287824&view=rev Log: [libcxx] [test] D27016: Fix MSVC warning C4018 "signed/unsigned mismatch", part 4/12. Change "int j;" indices to "std::size_t j;". Also, include when it wasn't already being included. Modified: libcxx/trunk/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp libcxx/trunk/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp libcxx/trunk/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/insert_iter_value.pass.cpp Modified: libcxx/trunk/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp?rev=287824&r1=287823&r2=287824&view=diff == --- libcxx/trunk/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp (original) +++ libcxx/trunk/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp Wed Nov 23 16:02:27 2016 @@ -15,6 +15,7 @@ #include #include +#include #include "test_iterators.h" #include "min_allocator.h" @@ -28,7 +29,7 @@ int main() input_iterator(a+N)); assert(v.size() == 100 + N); assert(i == v.begin() + 10); -int j; +std::size_t j; for (j = 0; j < 10; ++j) assert(v[j] == 0); for (int k = 0; k < N; ++j, ++k) @@ -62,7 +63,7 @@ int main() forward_iterator(a+N)); assert(v.size() == sz + N); assert(i == v.begin() + 10); -int j; +std::size_t j; for (j = 0; j < 10; ++j) assert(v[j] == 0); for (int k = 0; k < N; ++j, ++k) @@ -81,7 +82,7 @@ int main() forward_iterator(a+N)); assert(v.size() == sz + N); assert(i == v.begin() + 10); -int j; +std::size_t j; for (j = 0; j < 10; ++j) assert(v[j] == 0); for (int k = 0; k < N; ++j, ++k) @@ -98,7 +99,7 @@ int main() input_iterator(a+N)); assert(v.size() == 100 + N); assert(i == v.begin() + 10); -int j; +std::size_t j; for (j = 0; j < 10; ++j) assert(v[j] == 0); for (int k = 0; k < N; ++j, ++k) @@ -114,7 +115,7 @@ int main() forward_iterator(a+N)); assert(v.size() == 100 + N); assert(i == v.begin() + 10); -int j; +std::size_t j; for (j = 0; j < 10; ++j) assert(v[j] == 0); for (int k = 0; k < N; ++j, ++k) Modified: libcxx/trunk/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp?rev=287824&r1=287823&r2=287824&view=diff == --- libcxx/trunk/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp (original) +++ libcxx/trunk/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp Wed Nov 23 16:02:27 2016 @@ -14,6 +14,7 @@ #include #include +#include #include "min_allocator.h" @@ -24,7 +25,7 @@ int main() std::vector::iterator i = v.insert(v.cbegin() + 10, 5, 1); assert(v.size() == 105); assert(i == v.begin() + 10); -int j; +std::size_t j; for (j = 0; j < 10; ++j) assert(v[j] == 0); for (; j < 15; ++j) @@ -39,7 +40,7 @@ int main() std::vector::iterator i = v.insert(v.cbegin() + 10, 5, 1); assert(v.size() == sz + 5); assert(i == v.begin() + 10); -int j; +std::size_t j; for (j = 0; j < 10; ++j) assert(v[j] == 0); for (; j < 15; ++j) @@ -55,7 +56,7 @@ int main() std::vector::iterator i = v.insert(v.cbegin() + 10, 5, 1); assert(v.size() == sz + 5); assert(i == v.begin() + 10); -int j; +std::size_t j; for (j = 0; j < 10; ++j) assert(v[j] == 0); for (; j < 15; ++j) @@ -69,7 +70,7 @@ int main() std::vector>::iterator i = v.insert(v.cbegin() + 10, 5, 1); assert(v.size() == 105); assert(i == v.begin() + 10); -int j; +std::size_t j; for (j = 0; j < 10; ++j)
[libcxx] r287825 - [libcxx] [test] D27018: Fix MSVC warning C4018 "signed/unsigned mismatch", part 5/12.
Author: stl_msft Date: Wed Nov 23 16:02:35 2016 New Revision: 287825 URL: http://llvm.org/viewvc/llvm-project?rev=287825&view=rev Log: [libcxx] [test] D27018: Fix MSVC warning C4018 "signed/unsigned mismatch", part 5/12. Various changes: test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp Change M from unsigned to int. It's compared against "int x", and we binary_search() for it within a vector. test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp Add static_cast when comparing int to unsigned. test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp Change unsigned indices to int when we're being given int as a bound. Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp?rev=287825&r1=287824&r2=287825&view=diff == --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp Wed Nov 23 16:02:35 2016 @@ -34,7 +34,7 @@ void test() { const unsigned N = 1000; -const unsigned M = 10; +const int M = 10; std::vector v(N); int x = 0; for (std::size_t i = 0; i < v.size(); ++i) Modified: libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp?rev=287825&r1=287824&r2=287825&view=diff == --- libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp Wed Nov 23 16:02:35 2016 @@ -34,7 +34,7 @@ double I(double x, unsigned a, unsigned b) { double r = 0; -for (int j = a; j <= a+b-1; ++j) +for (int j = a; static_cast(j) <= a+b-1; ++j) r += fac(a+b-1)/(fac(j) * fac(a + b - 1 - j)) * std::pow(x, j) * std::pow(1-x, a+b-1-j); return r; Modified: libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp?rev=287825&r1=287824&r2=287825&view=diff == --- libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp Wed Nov 23 16:02:35 2016 @@ -34,7 +34,7 @@ double I(double x, unsigned a, unsigned b) { double r = 0; -for (int j = a; j <= a+b-1; ++j) +for (int j = a; static_cast(j) <= a+b-1; ++j) r += fac(a+b-1)/(fac(j) * fac(a + b - 1 - j)) * std::pow(x, j) * std::pow(1-x, a+b-1-j); return r; Modified: libcxx/trunk/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp?rev=287825&r1=287824&r2=287825&view=diff == --- libcxx/trunk/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp (original) +++ libcxx/trunk/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp Wed Nov 23 16:02:35 2016 @@ -62,7 +62,7 @@ test(Tp n, Tp c) S s2(n, c); LIBCPP_ASSERT(s2.__invariants()); assert(s2.size() == n); -for (unsigned i = 0; i < n; ++i) +for (int i = 0; i < n; ++i) assert(s2[i] == c); assert(s2.get_allocator() == A()); assert(s2.capacity() >= s2.size()); @@ -78,7 +78,7 @@ test(Tp n, Tp c, const A& a) S s2(n, c, a); LIBCPP_ASSERT(s2.__invariants()); assert(s2.size() == n); -for (unsigned i = 0; i < n; ++i) +for (int i = 0; i < n; ++i) assert(s2[i] == c); assert(s2.get_allocator() == a); assert(s2.capacity() >= s2.size()); __
[libcxx] r287823 - [libcxx] [test] D27015: Fix MSVC warning C4018 "signed/unsigned mismatch", part 3/12.
Author: stl_msft Date: Wed Nov 23 16:02:16 2016 New Revision: 287823 URL: http://llvm.org/viewvc/llvm-project?rev=287823&view=rev Log: [libcxx] [test] D27015: Fix MSVC warning C4018 "signed/unsigned mismatch", part 3/12. Change unsigned to int in parameters. Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp?rev=287823&r1=287822&r2=287823&view=diff == --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp Wed Nov 23 16:02:16 2016 @@ -17,7 +17,7 @@ #include #include -void test(unsigned N) +void test(int N) { int* ia = new int [N]; for (int i = 0; i < N; ++i) Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp?rev=287823&r1=287822&r2=287823&view=diff == --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp Wed Nov 23 16:02:16 2016 @@ -17,7 +17,7 @@ #include #include -void test(unsigned N) +void test(int N) { int* ia = new int [N]; for (int i = 0; i < N; ++i) Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp?rev=287823&r1=287822&r2=287823&view=diff == --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp Wed Nov 23 16:02:16 2016 @@ -29,7 +29,7 @@ struct indirect_less #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -void test(unsigned N) +void test(int N) { int* ia = new int [N]; for (int i = 0; i < N; ++i) Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.pass.cpp?rev=287823&r1=287822&r2=287823&view=diff == --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.pass.cpp (o
[libcxx] r287826 - [libcxx] [test] D27019: Fix MSVC warning C4245 "conversion from 'X' to 'Y', signed/unsigned mismatch", part 6/12.
Author: stl_msft Date: Wed Nov 23 16:02:44 2016 New Revision: 287826 URL: http://llvm.org/viewvc/llvm-project?rev=287826&view=rev Log: [libcxx] [test] D27019: Fix MSVC warning C4245 "conversion from 'X' to 'Y', signed/unsigned mismatch", part 6/12. Add static_cast when initializing unsigned integers with negative numbers (in order to obtain big values). Modified: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long_long.pass.cpp libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_int.pass.cpp libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_long.pass.cpp libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_long_long.pass.cpp libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_short.pass.cpp Modified: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp?rev=287826&r1=287825&r2=287826&view=diff == --- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp (original) +++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp Wed Nov 23 16:02:44 2016 @@ -76,7 +76,7 @@ int main() testbuf sb; std::ostream os(&sb); hex(os); -unsigned long long n = -10; +unsigned long long n = static_cast(-10); os << n; assert(sb.str() == "fff6"); } Modified: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp?rev=287826&r1=287825&r2=287826&view=diff == --- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp (original) +++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp Wed Nov 23 16:02:44 2016 @@ -61,7 +61,7 @@ int main() } { std::ios ios(0); -unsigned long v = -1; +unsigned long v = static_cast(-1); char str[50]; output_iterator iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); @@ -69,7 +69,7 @@ int main() } { std::ios ios(0); -unsigned long v = -1000; +unsigned long v = static_cast(-1000); char str[50]; output_iterator iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); @@ -307,7 +307,7 @@ int main() { std::ios ios(0); ios.imbue(std::locale(std::locale::classic(), new my_numpunct)); -unsigned long v = -1000; +unsigned long v = static_cast(-1000); right(ios); showpos(ios); ios.width(10); @@ -321,7 +321,7 @@ int main() { std::ios ios(0); ios.imbue(std::locale(std::locale::classic(), new my_numpunct)); -unsigned long v = -1000; +unsigned long v = static_cast(-1000); left(ios); ios.width(10); char str[50]; @@ -334,7 +334,7 @@ int main() { std::ios ios(0); ios.imbue(std::locale(std::locale::classic(), new my_numpunct)); -unsigned long v = -1000; +unsigned long v = static_cast(-1000); internal(ios); ios.width(10); char str[50]; Modified: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long_long.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long_long.pass.cpp?rev=287826&r1=287825&r2=287826&view=diff ==
[libcxx] r287827 - [libcxx] [test] D27020: Fix MSVC warning C4245 "conversion from 'X' to 'Y', signed/unsigned mismatch", part 7/12.
Author: stl_msft Date: Wed Nov 23 16:02:53 2016 New Revision: 287827 URL: http://llvm.org/viewvc/llvm-project?rev=287827&view=rev Log: [libcxx] [test] D27020: Fix MSVC warning C4245 "conversion from 'X' to 'Y', signed/unsigned mismatch", part 7/12. When initializing unsigned integers to their maximum values, change "const T M(~0);" to "const T M(static_cast(-1));". ~0 and -1 are equivalent, but I consider the -1 form to be significantly clearer (and more consistent with other tests). Modified: libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp Modified: libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp?rev=287827&r1=287826&r2=287827&view=diff == --- libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp Wed Nov 23 16:02:53 2016 @@ -37,7 +37,7 @@ test() test1(); test1(); test1(); -const T M(~0); +const T M(static_cast(-1)); test1(); test1(); test1(); Modified: libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp?rev=287827&r1=287826&r2=287827&view=diff == --- libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp Wed Nov 23 16:02:53 2016 @@ -37,7 +37,7 @@ test() test1(); test1(); test1(); -const T M(~0); +const T M(static_cast(-1)); test1(); test1(); test1(); Modified: libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp?rev=287827&r1=287826&r2=287827&view=diff == --- libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp Wed Nov 23 16:02:53 2016 @@ -36,7 +36,7 @@ test() test1(); test1(); test1(); -const T M(~0); +const T M(static_cast(-1)); test1(); test1(); test1(); Modified: libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp?rev=287827&r1=287826&r2=287827&view=diff == --- libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp Wed Nov 23 16:02:53 2016 @@ -72,7 +72,7 @@ test() test1(); test1(); test1(); -const T M(~0); +const T M(static_cast(-1)); test1(); test1(); test1(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r287829 - [libcxx] [test] D27027: Strip trailing whitespace.
Author: stl_msft Date: Wed Nov 23 16:03:28 2016 New Revision: 287829 URL: http://llvm.org/viewvc/llvm-project?rev=287829&view=rev Log: [libcxx] [test] D27027: Strip trailing whitespace. Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.clamp/clamp.comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp libcxx/trunk/test/std/atomics/atomics.types.generic/integral.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp libcxx/trunk/test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp libcxx/trunk/test/std/containers/sequences/vector/vector.data/data.pass.cpp libcxx/trunk/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.fail.cpp libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.fail.cpp libcxx/trunk/test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.fail.cpp libcxx/trunk/test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.fail.cpp libcxx/trunk/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp libcxx/trunk/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp libcxx/trunk/test/std/iterators/iterator.range/begin-end.fail.cpp libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op==/test.pass.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp libcxx/trunk/test/std/strings/basic.stri
[libcxx] r287828 - [libcxx] [test] D27026: Fix copy-paste silliness; ULL can't ever be 32-bit.
Author: stl_msft Date: Wed Nov 23 16:02:59 2016 New Revision: 287828 URL: http://llvm.org/viewvc/llvm-project?rev=287828&view=rev Log: [libcxx] [test] D27026: Fix copy-paste silliness; ULL can't ever be 32-bit. Modified: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long_long.pass.cpp Modified: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long_long.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long_long.pass.cpp?rev=287828&r1=287827&r2=287828&view=diff == --- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long_long.pass.cpp (original) +++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long_long.pass.cpp Wed Nov 23 16:02:59 2016 @@ -65,7 +65,7 @@ int main() char str[50]; output_iterator iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -assert(ex == (sizeof(unsigned long long) == 4 ? "4294967295" : "18446744073709551615")); +assert(ex == "18446744073709551615"); } { std::ios ios(0); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27013: [libcxx] [test] Fix MSVC warning C4018 "signed/unsigned mismatch", part 1/12.
STL_MSFT closed this revision. STL_MSFT added a comment. Thanks, r287820. https://reviews.llvm.org/D27013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27014: [libcxx] [test] Fix MSVC warning C4018 "signed/unsigned mismatch", part 2/12.
STL_MSFT closed this revision. STL_MSFT added a comment. Thanks, r287822. https://reviews.llvm.org/D27014 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27015: [libcxx] [test] Fix MSVC warning C4018 "signed/unsigned mismatch", part 3/12.
STL_MSFT closed this revision. STL_MSFT added a comment. Thanks, r287823. https://reviews.llvm.org/D27015 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27016: [libcxx] [test] Fix MSVC warning C4018 "signed/unsigned mismatch", part 4/12.
STL_MSFT closed this revision. STL_MSFT added a comment. Thanks, r287824. https://reviews.llvm.org/D27016 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27019: [libcxx] [test] Fix MSVC warning C4245 "conversion from 'X' to 'Y', signed/unsigned mismatch", part 6/12.
STL_MSFT closed this revision. STL_MSFT added a comment. Thanks, r287826. https://reviews.llvm.org/D27019 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27018: [libcxx] [test] Fix MSVC warning C4018 "signed/unsigned mismatch", part 5/12.
STL_MSFT closed this revision. STL_MSFT added a comment. Thanks, r287825. https://reviews.llvm.org/D27018 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27026: [libcxx] [test] Fix copy-paste silliness; ULL can't ever be 32-bit.
STL_MSFT closed this revision. STL_MSFT added a comment. Thanks, r287828. https://reviews.llvm.org/D27026 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27020: [libcxx] [test] Fix MSVC warning C4245 "conversion from 'X' to 'Y', signed/unsigned mismatch", part 7/12.
STL_MSFT closed this revision. STL_MSFT added a comment. Thanks, r287827. https://reviews.llvm.org/D27020 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27027: [libcxx] [test] Strip trailing whitespace.
STL_MSFT closed this revision. STL_MSFT added a comment. Thanks, r287829. https://reviews.llvm.org/D27027 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27066: Fix crash with unsupported architectures in Linux/Gnu target triples.
fhahn created this revision. fhahn added a reviewer: rafael. fhahn added a subscriber: cfe-commits. Herald added a subscriber: dschuff. This patch adds a check and an error message to gnutools::Linker::ConstructJob in case the architecture is not supported. For most other operating systems, the error message is created in lib/Basic/Targets.cpp:AllocateTarget, but when construction the linker arguments for the gnutools linker a supported architecture is required. I am not sure if it would be better to validate target triples earlier. https://reviews.llvm.org/D27066 Files: lib/Driver/Tools.cpp test/Driver/unsupported-target-arch.c Index: test/Driver/unsupported-target-arch.c === --- /dev/null +++ test/Driver/unsupported-target-arch.c @@ -0,0 +1,25 @@ +// Tests that clang does not crash with invalid architectures in target triples. +// +// RUN: not %clang --target=noarch-unknown-linux -o %t.o %s 2> %t.err +// RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-NOARCH-LINUX %s +// CHECK-NOARCH-LINUX: error: unknown target triple 'noarch-unknown-linux', please use -triple or -arch +// +// RUN: not %clang --target=noarch-unknown-darwin -o %t.o %s 2> %t.err +// RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-NOARCH-DARWIN %s +// CHECK-NOARCH-DARWIN: error: unknown target triple 'unknown-unknown-macosx{{.+}}', please use -triple or -arch +// +// RUN: not %clang --target=noarch-unknown-windows -o %t.o %s 2> %t.err +// RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-NOARCH-WINDOWS %s +// CHECK-NOARCH-WINDOWS: error: unknown target triple 'noarch-unknown-windows-{{.+}}', please use -triple or -arch +// +// RUN: not %clang --target=noarch-unknown-freebsd -o %t.o %s 2> %t.err +// RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-NOARCH-FREEBSD %s +// CHECK-NOARCH-FREEBSD: error: unknown target triple 'noarch-unknown-freebsd', please use -triple or -arch +// +// RUN: not %clang --target=noarch-unknown-netbsd -o %t.o %s 2> %t.err +// RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-NOARCH-NETBSD %s +// CHECK-NOARCH-NETBSD: error: unknown target triple 'noarch-unknown-netbsd', please use -triple or -arch +// +// RUN: not %clang --target=noarch-unknown-nacl -o %t.o %s 2> %t.err +// RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-NOARCH-NACL %s +// CHECK-NOARCH-NACL: error: the target architecture 'noarch' is not supported by the target 'Native Client' Index: lib/Driver/Tools.cpp === --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -9941,7 +9941,7 @@ return "elf32_x86_64"; return "elf_x86_64"; default: -llvm_unreachable("Unexpected arch"); +return nullptr; } } @@ -10014,8 +10014,13 @@ CmdArgs.push_back("--eh-frame-hdr"); } + const char *LDMOption = getLDMOption(ToolChain.getTriple(), Args); + if (!LDMOption) { +D.Diag(diag::err_target_unknown_triple) << Triple.str(); +return; + } CmdArgs.push_back("-m"); - CmdArgs.push_back(getLDMOption(ToolChain.getTriple(), Args)); + CmdArgs.push_back(LDMOption); if (Args.hasArg(options::OPT_static)) { if (Arch == llvm::Triple::arm || Arch == llvm::Triple::armeb || Index: test/Driver/unsupported-target-arch.c === --- /dev/null +++ test/Driver/unsupported-target-arch.c @@ -0,0 +1,25 @@ +// Tests that clang does not crash with invalid architectures in target triples. +// +// RUN: not %clang --target=noarch-unknown-linux -o %t.o %s 2> %t.err +// RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-NOARCH-LINUX %s +// CHECK-NOARCH-LINUX: error: unknown target triple 'noarch-unknown-linux', please use -triple or -arch +// +// RUN: not %clang --target=noarch-unknown-darwin -o %t.o %s 2> %t.err +// RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-NOARCH-DARWIN %s +// CHECK-NOARCH-DARWIN: error: unknown target triple 'unknown-unknown-macosx{{.+}}', please use -triple or -arch +// +// RUN: not %clang --target=noarch-unknown-windows -o %t.o %s 2> %t.err +// RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-NOARCH-WINDOWS %s +// CHECK-NOARCH-WINDOWS: error: unknown target triple 'noarch-unknown-windows-{{.+}}', please use -triple or -arch +// +// RUN: not %clang --target=noarch-unknown-freebsd -o %t.o %s 2> %t.err +// RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-NOARCH-FREEBSD %s +// CHECK-NOARCH-FREEBSD: error: unknown target triple 'noarch-unknown-freebsd', please use -triple or -arch +// +// RUN: not %clang --target=noarch-unknown-netbsd -o %t.o %s 2> %t.err +// RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-NOARCH-NETBSD %s +// CHECK-NOARCH-NETBSD: error: unknown target triple 'noarch-unknown-netbsd', please use -triple or -arch +// +// RUN: not %clang --target=noarch-unknown-nacl -o %t.o %s 2> %t.err +// RUN: FileCheck --input-file=%t.err
[PATCH] D26814: [libcxx] [test] Change ifstream constructor tests to handle read-only files.
STL_MSFT added a comment. As yet another alternative, I could keep the ios_base::openmode tests in ifstream.cons, but use ios_base::binary instead of ios_base::out. https://reviews.llvm.org/D26814 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26979: Do not hard-code locale data in unit tests: get it from the OS instead
vangyzen added inline comments. Comment at: test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp:65 +{ +expected = *std::localeconv()->thousands_sep; +(void) std::setlocale(LC_NUMERIC, "C"); vangyzen wrote: > EricWF wrote: > > We should probably assert that `thousands_sep` isn't a multibyte character. > I don't quite follow. C defines it as `char*`. Are you concerned about an > implementation defining it as `wchar_t*`? Oh, I understand now. Sorry. I've never really done much with locales, so I'm not so fluent with them...especially early on a holiday morning. :) https://reviews.llvm.org/D26979 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27068: Improve string::find
hiraditya created this revision. hiraditya added reviewers: mclow.lists, EricWF. hiraditya added subscribers: sebpop, cfe-commits. Improving string::find such that it ultimately gets converted to calls to memchr and memcmp. This is an intermediate patch to see if there is an interest in this optimization. I'm planning to propagate this change to similar functions string::rfind ... etc. Worked in collaboration with Sebastian Pop. https://reviews.llvm.org/D27068 Files: libcxx/benchmarks/string.bench.cpp libcxx/include/__string Index: libcxx/include/__string === --- libcxx/include/__string +++ libcxx/include/__string @@ -538,25 +538,63 @@ return static_cast<_SizeT>(__r - __p); } +template +_LIBCPP_CONSTEXPR_AFTER_CXX11 +_RandomAccessIterator +__search_substring(_RandomAccessIterator __first1, _RandomAccessIterator __last1, + _RandomAccessIterator __first2, _RandomAccessIterator __last2) +{ +using __iterator_traits = iterator_traits<_RandomAccessIterator>; +typedef typename __iterator_traits::difference_type __difference_type; + +// Take advantage of knowing source and pattern lengths. +// Stop short when source is smaller than pattern. +__difference_type __len2 = __last2 - __first2; +if (__len2 == 0) +return __first1; +__difference_type __len1 = __last1 - __first1; +if (__len1 < __len2) +return __last1; + +// First element of __first2 is loop invariant. +typename __iterator_traits::value_type __f2 = *__first2; +while (true) +{ + __len1 = __last1 - __first1; + if (__len1 < __len2) + return __last1; + + __first1 = _Traits::find(__first1, __len1 - __len2 + 1, __f2); + if (__first1 == _RandomAccessIterator(0)) +return __last1; + + // Comparing __first2 as well because the first pointer will be aligned + // and we dont know if __first1+1 is going to be aligned. + if (_Traits::compare(__first1, __first2, __len2) == 0) +return __first1; + +++__first1; +} +} + template inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY __str_find(const _CharT *__p, _SizeT __sz, const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT { -if (__pos > __sz || __sz - __pos < __n) +if (__pos > __sz) return __npos; -if (__n == 0) + +if (__n == 0) // There is nothing to search, just return __pos return __pos; -const _CharT* __r = -_VSTD::__search(__p + __pos, __p + __sz, -__s, __s + __n, _Traits::eq, -random_access_iterator_tag(), random_access_iterator_tag()).first; + +const _CharT* __r = __search_substring(__p + __pos, __p + __sz, + __s, __s + __n); if (__r == __p + __sz) return __npos; return static_cast<_SizeT>(__r - __p); } - // __str_rfind template Index: libcxx/benchmarks/string.bench.cpp === --- /dev/null +++ libcxx/benchmarks/string.bench.cpp @@ -0,0 +1,32 @@ +#include +#include +#include + +#include "benchmark/benchmark_api.h" +#include "GenerateInput.hpp" + +constexpr std::size_t MAX_STRING_LEN = 8<<14; + +// Benchmark the first loop of string search: we do not want the string to match +// until the end of s1. +static void BM_StringFindPhase1(benchmark::State& state) { + // Benchmark following the length of s1. + std::string s1(state.range(0), '-'); + std::string s2(8, '*'); + while (state.KeepRunning()) +benchmark::DoNotOptimize(s1.find(s2)); +} +BENCHMARK(BM_StringFindPhase1)->Range(10,MAX_STRING_LEN); + +// Benchmark the __phase2 part of string search: we want the strings s1 and s2 +// to match from the first char in s1. +static void BM_StringFindPhase2(benchmark::State& state) { + std::string s1(MAX_STRING_LEN, '-'); + // Benchmark following the length of s2. + std::string s2(state.range(0), '-'); + while (state.KeepRunning()) +benchmark::DoNotOptimize(s1.find(s2)); +} +BENCHMARK(BM_StringFindPhase2)->Range(1,MAX_STRING_LEN); + +BENCHMARK_MAIN() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Buildbot numbers for the week of 11/13/2016 - 11/19/2016
Hello everyone, Below are some buildbot numbers for the last week of 11/13/2016 - 11/19/2016. Please see the same data in attached csv files: The longest time each builder was red during the last week; "Status change ratio" by active builder (percent of builds that changed the builder status from greed to red or from red to green); Count of commits by project; Number of completed builds, failed builds and average build time for successful builds per active builder; Average waiting time for a revision to get build result per active builder (response time). Thanks Galina The longest time each builder was red during the last week: buildername | was_red +- sanitizer-x86_64-linux-bootstrap | 66:29:59 clang-ppc64le-linux| 56:19:00 sanitizer-x86_64-linux-fast| 46:46:09 clang-s390x-linux | 41:17:45 sanitizer-ppc64be-linux| 39:19:54 sanitizer-ppc64le-linux| 38:08:34 lld-x86_64-darwin13| 38:06:50 clang-ppc64le-linux-lnt| 37:09:50 clang-ppc64be-linux-lnt| 37:06:00 clang-ppc64be-linux-multistage | 36:46:14 clang-x86_64-linux-selfhost-modules| 35:59:09 clang-ppc64le-linux-multistage | 35:45:04 clang-ppc64be-linux| 30:20:14 sanitizer-windows | 27:26:01 clang-cmake-mipsel | 20:53:28 clang-cmake-thumbv7-a15-full-sh| 15:29:50 perf-x86_64-penryn-O3-polly-before-vectorizer-detect-only | 13:01:30 lldb-windows7-android | 11:34:00 libcxx-libcxxabi-libunwind-arm-linux-noexceptions | 10:11:53 clang-cmake-mips | 08:09:26 libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11 | 07:55:32 sanitizer-x86_64-linux | 07:37:03 clang-x86-windows-msvc2015 | 07:17:16 clang-cmake-armv7-a15-selfhost-neon| 07:11:20 perf-x86_64-penryn-O3-polly-fast | 06:29:52 perf-x86_64-penryn-O3-polly-before-vectorizer | 06:24:07 clang-x64-ninja-win7 | 06:07:12 lldb-x86_64-ubuntu-14.04-buildserver | 05:37:48 lldb-amd64-ninja-netbsd7 | 05:17:22 lldb-x86_64-ubuntu-14.04-cmake | 04:52:56 clang-with-thin-lto-ubuntu | 04:38:51 lldb-amd64-ninja-freebsd11 | 04:37:51 clang-cmake-armv7-a15-selfhost | 04:16:25 clang-with-lto-ubuntu | 03:24:18 clang-cmake-thumbv7-a15| 03:15:26 clang-cmake-armv7-a15 | 03:13:57 clang-x86_64-debian-fast | 03:07:25 libcxx-libcxxabi-libunwind-x86_64-linux-debian | 02:57:08 llvm-mips-linux| 02:46:46 llvm-hexagon-elf | 02:40:59 clang-cmake-aarch64-full | 02:38:25 clang-cmake-aarch64-39vma | 02:32:50 clang-3stage-ubuntu| 02:20:06 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast | 02:18:40 libcxx-libcxxabi-x86_64-linux-debian | 02:12:57 sanitizer-x86_64-linux-fuzzer | 02:01:37 libcxx-libcxxabi-libunwind-arm-linux | 01:59:16 libcxx-libcxxabi-x86_64-linux-ubuntu-msan | 01:43:49 libcxx-libcxxabi-x86_64-linux-ubuntu-tsan | 01:43:40 clang-cmake-aarch64-quick | 01:43:00 libcxx-libcxxabi-x86_64-linux-ubuntu-asan | 01:39:22 libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan | 01:35:04 clang-cmake-armv7-a15-full | 01:29:28 clang-native-arm-lnt | 01:29:14 clang-hexagon-elf | 01:25:00 perf-x86_64-penryn-O3-polly-parallel-fast | 01:22:52 lldb-x86_64-darwin-13.4| 01:22:00 lldb-x86-windows-msvc2015 | 01:18:57 clang-cmake-aarch64-42vma | 01:18:35 perf-x86_64-penryn-O3-po
r287847 - Spelling.
Author: joerg Date: Wed Nov 23 19:24:38 2016 New Revision: 287847 URL: http://llvm.org/viewvc/llvm-project?rev=287847&view=rev Log: Spelling. Modified: cfe/trunk/include/clang/Tooling/JSONCompilationDatabase.h Modified: cfe/trunk/include/clang/Tooling/JSONCompilationDatabase.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/JSONCompilationDatabase.h?rev=287847&r1=287846&r2=287847&view=diff == --- cfe/trunk/include/clang/Tooling/JSONCompilationDatabase.h (original) +++ cfe/trunk/include/clang/Tooling/JSONCompilationDatabase.h Wed Nov 23 19:24:38 2016 @@ -73,7 +73,7 @@ public: loadFromBuffer(StringRef DatabaseString, std::string &ErrorMessage, JSONCommandLineSyntax Syntax); - /// \brief Returns all compile comamnds in which the specified file was + /// \brief Returns all compile commands in which the specified file was /// compiled. /// /// FIXME: Currently FilePath must be an absolute path inside the ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26827: Make tests more robust with Release builds
This revision was automatically updated to reflect the committed changes. Closed by commit rL287851: Make these tests work more reliably with Release builds. (authored by dyung). Changed prior to commit: https://reviews.llvm.org/D26827?vs=78449&id=79181#toc Repository: rL LLVM https://reviews.llvm.org/D26827 Files: cfe/trunk/test/OpenMP/for_simd_codegen.cpp cfe/trunk/test/OpenMP/simd_codegen.cpp Index: cfe/trunk/test/OpenMP/for_simd_codegen.cpp === --- cfe/trunk/test/OpenMP/for_simd_codegen.cpp +++ cfe/trunk/test/OpenMP/for_simd_codegen.cpp @@ -16,12 +16,12 @@ // CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], // CHECK: [[CMP:%.+]] = icmp sgt i32 [[UB_VAL]], 5 // CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] -// CHECK: [[TRUE]] +// CHECK: [[TRUE]]: // CHECK: br label %[[SWITCH:[^,]+]] -// CHECK: [[FALSE]] +// CHECK: [[FALSE]]: // CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], // CHECK: br label %[[SWITCH]] -// CHECK: [[SWITCH]] +// CHECK: [[SWITCH]]: // CHECK: [[UP:%.+]] = phi i32 [ 5, %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] // CHECK: store i32 [[UP]], i32* [[UB]], // CHECK: [[LB_VAL:%.+]] = load i32, i32* [[LB]], @@ -32,7 +32,7 @@ // CHECK-NEXT: [[CMP:%.+]] = icmp sle i32 [[IV]], [[UB_VAL]] // CHECK-NEXT: br i1 [[CMP]], label %[[SIMPLE_LOOP1_BODY:.+]], label %[[SIMPLE_LOOP1_END:[^,]+]] for (int i = 3; i < 32; i += 5) { -// CHECK: [[SIMPLE_LOOP1_BODY]] +// CHECK: [[SIMPLE_LOOP1_BODY]]: // Start of body: calculate i from IV: // CHECK: [[IV1_1:%.+]] = load i32, i32* [[OMP_IV]]{{.*}} // CHECK: [[CALC_I_1:%.+]] = mul nsw i32 [[IV1_1]], 5 @@ -47,7 +47,7 @@ // CHECK-NEXT: store i32 [[ADD1_2]], i32* [[OMP_IV]] // br label %{{.+}}, !llvm.loop !{{.+}} } -// CHECK: [[SIMPLE_LOOP1_END]] +// CHECK: [[SIMPLE_LOOP1_END]]: // CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) // CHECK: call void @__kmpc_barrier(%ident_t* {{.+}}, i32 %{{.+}}) @@ -63,16 +63,16 @@ // CHECK: [[NEXT:%.+]] = call i32 @__kmpc_dispatch_next_4(%ident_t* {{.+}}, i32 %{{.+}}, i32* %{{.+}}, i32* [[LB:%.+]], i32* [[UB:%.+]], i32* %{{.+}}) // CHECK: [[COND:%.+]] = icmp ne i32 [[NEXT]], 0 // CHECK: br i1 [[COND]], label %[[CONT:.+]], label %[[END:.+]] -// CHECK: [[CONT]] +// CHECK: [[CONT]]: // CHECK: [[LB_VAL:%.+]] = load i32, i32* [[LB]], // CHECK: store i32 [[LB_VAL]], i32* [[OMP_IV2:%[^,]+]], // CHECK: [[IV2:%.+]] = load i32, i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID:[0-9]+]] // CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]] // CHECK-NEXT: [[CMP2:%.+]] = icmp sle i32 [[IV2]], [[UB_VAL]] // CHECK-NEXT: br i1 [[CMP2]], label %[[SIMPLE_LOOP2_BODY:.+]], label %[[SIMPLE_LOOP2_END:[^,]+]] for (int i = 10; i > 1; i--) { -// CHECK: [[SIMPLE_LOOP2_BODY]] +// CHECK: [[SIMPLE_LOOP2_BODY]]: // Start of body: calculate i from IV: // CHECK: [[IV2_0:%.+]] = load i32, i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]] // FIXME: It is interesting, why the following "mul 1" was not constant folded? @@ -94,7 +94,7 @@ // CHECK-NEXT: store i32 [[ADD2_2]], i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]] // br label {{.+}}, !llvm.loop ![[SIMPLE_LOOP2_ID]] } -// CHECK: [[SIMPLE_LOOP2_END]] +// CHECK: [[SIMPLE_LOOP2_END]]: // // Update linear vars after loop, as the loop was operating on a private version. // CHECK: [[LIN0_2:%.+]] = load i64, i64* [[LIN0]] @@ -120,12 +120,12 @@ // CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], // CHECK: [[CMP:%.+]] = icmp ugt i64 [[UB_VAL]], 3 // CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] -// CHECK: [[TRUE]] +// CHECK: [[TRUE]]: // CHECK: br label %[[SWITCH:[^,]+]] -// CHECK: [[FALSE]] +// CHECK: [[FALSE]]: // CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], // CHECK: br label %[[SWITCH]] -// CHECK: [[SWITCH]] +// CHECK: [[SWITCH]]: // CHECK: [[UP:%.+]] = phi i64 [ 3, %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] // CHECK: store i64 [[UP]], i64* [[UB]], // CHECK: [[LB_VAL:%.+]] = load i64, i64* [[LB]], @@ -136,7 +136,7 @@ // CHECK-NEXT: [[CMP3:%.+]] = icmp ule i64 [[IV3]], [[UB_VAL]] // CHECK-NEXT: br i1 [[CMP3]], label %[[SIMPLE_LOOP3_BODY:.+]], label %[[SIMPLE_LOOP3_END:[^,]+]] for (unsigned long long it = 2000; it >= 600; it-=400) { -// CHECK: [[SIMPLE_LOOP3_BODY]] +// CHECK: [[SIMPLE_LOOP3_BODY]]: // Start of body: calculate it from IV: // CHECK: [[IV3_0:%.+]] = load i64, i64* [[OMP_IV3]] // CHECK-NEXT: [[LC_IT_1:%.+]] = mul i64 [[IV3_0]], 400 @@ -162,7 +162,7 @@ // CHECK-NEXT: [[ADD3_2:%.+]] = add i64 [[IV3_2]], 1 // CHECK-NEXT: store i64 [[ADD3_2]], i64* [[OMP_IV3]] } -// CHECK: [[SIMPLE_LOOP3_END]] +// CHECK: [[SIMPLE_LOOP3_END]]: // CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) // // Linear start and step are used to calculate final value of the linear variables. @@ -178
r287851 - Make these tests work more reliably with Release builds.
Author: dyung Date: Wed Nov 23 19:53:38 2016 New Revision: 287851 URL: http://llvm.org/viewvc/llvm-project?rev=287851&view=rev Log: Make these tests work more reliably with Release builds. Differential Revision: https://reviews.llvm.org/D26827 Modified: cfe/trunk/test/OpenMP/for_simd_codegen.cpp cfe/trunk/test/OpenMP/simd_codegen.cpp Modified: cfe/trunk/test/OpenMP/for_simd_codegen.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_simd_codegen.cpp?rev=287851&r1=287850&r2=287851&view=diff == --- cfe/trunk/test/OpenMP/for_simd_codegen.cpp (original) +++ cfe/trunk/test/OpenMP/for_simd_codegen.cpp Wed Nov 23 19:53:38 2016 @@ -16,12 +16,12 @@ void simple(float *a, float *b, float *c // CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], // CHECK: [[CMP:%.+]] = icmp sgt i32 [[UB_VAL]], 5 // CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] -// CHECK: [[TRUE]] +// CHECK: [[TRUE]]: // CHECK: br label %[[SWITCH:[^,]+]] -// CHECK: [[FALSE]] +// CHECK: [[FALSE]]: // CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], // CHECK: br label %[[SWITCH]] -// CHECK: [[SWITCH]] +// CHECK: [[SWITCH]]: // CHECK: [[UP:%.+]] = phi i32 [ 5, %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] // CHECK: store i32 [[UP]], i32* [[UB]], // CHECK: [[LB_VAL:%.+]] = load i32, i32* [[LB]], @@ -32,7 +32,7 @@ void simple(float *a, float *b, float *c // CHECK-NEXT: [[CMP:%.+]] = icmp sle i32 [[IV]], [[UB_VAL]] // CHECK-NEXT: br i1 [[CMP]], label %[[SIMPLE_LOOP1_BODY:.+]], label %[[SIMPLE_LOOP1_END:[^,]+]] for (int i = 3; i < 32; i += 5) { -// CHECK: [[SIMPLE_LOOP1_BODY]] +// CHECK: [[SIMPLE_LOOP1_BODY]]: // Start of body: calculate i from IV: // CHECK: [[IV1_1:%.+]] = load i32, i32* [[OMP_IV]]{{.*}} // CHECK: [[CALC_I_1:%.+]] = mul nsw i32 [[IV1_1]], 5 @@ -47,7 +47,7 @@ void simple(float *a, float *b, float *c // CHECK-NEXT: store i32 [[ADD1_2]], i32* [[OMP_IV]] // br label %{{.+}}, !llvm.loop !{{.+}} } -// CHECK: [[SIMPLE_LOOP1_END]] +// CHECK: [[SIMPLE_LOOP1_END]]: // CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) // CHECK: call void @__kmpc_barrier(%ident_t* {{.+}}, i32 %{{.+}}) @@ -63,7 +63,7 @@ void simple(float *a, float *b, float *c // CHECK: [[NEXT:%.+]] = call i32 @__kmpc_dispatch_next_4(%ident_t* {{.+}}, i32 %{{.+}}, i32* %{{.+}}, i32* [[LB:%.+]], i32* [[UB:%.+]], i32* %{{.+}}) // CHECK: [[COND:%.+]] = icmp ne i32 [[NEXT]], 0 // CHECK: br i1 [[COND]], label %[[CONT:.+]], label %[[END:.+]] -// CHECK: [[CONT]] +// CHECK: [[CONT]]: // CHECK: [[LB_VAL:%.+]] = load i32, i32* [[LB]], // CHECK: store i32 [[LB_VAL]], i32* [[OMP_IV2:%[^,]+]], @@ -72,7 +72,7 @@ void simple(float *a, float *b, float *c // CHECK-NEXT: [[CMP2:%.+]] = icmp sle i32 [[IV2]], [[UB_VAL]] // CHECK-NEXT: br i1 [[CMP2]], label %[[SIMPLE_LOOP2_BODY:.+]], label %[[SIMPLE_LOOP2_END:[^,]+]] for (int i = 10; i > 1; i--) { -// CHECK: [[SIMPLE_LOOP2_BODY]] +// CHECK: [[SIMPLE_LOOP2_BODY]]: // Start of body: calculate i from IV: // CHECK: [[IV2_0:%.+]] = load i32, i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]] // FIXME: It is interesting, why the following "mul 1" was not constant folded? @@ -94,7 +94,7 @@ void simple(float *a, float *b, float *c // CHECK-NEXT: store i32 [[ADD2_2]], i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]] // br label {{.+}}, !llvm.loop ![[SIMPLE_LOOP2_ID]] } -// CHECK: [[SIMPLE_LOOP2_END]] +// CHECK: [[SIMPLE_LOOP2_END]]: // // Update linear vars after loop, as the loop was operating on a private version. // CHECK: [[LIN0_2:%.+]] = load i64, i64* [[LIN0]] @@ -120,12 +120,12 @@ void simple(float *a, float *b, float *c // CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], // CHECK: [[CMP:%.+]] = icmp ugt i64 [[UB_VAL]], 3 // CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] -// CHECK: [[TRUE]] +// CHECK: [[TRUE]]: // CHECK: br label %[[SWITCH:[^,]+]] -// CHECK: [[FALSE]] +// CHECK: [[FALSE]]: // CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], // CHECK: br label %[[SWITCH]] -// CHECK: [[SWITCH]] +// CHECK: [[SWITCH]]: // CHECK: [[UP:%.+]] = phi i64 [ 3, %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] // CHECK: store i64 [[UP]], i64* [[UB]], // CHECK: [[LB_VAL:%.+]] = load i64, i64* [[LB]], @@ -136,7 +136,7 @@ void simple(float *a, float *b, float *c // CHECK-NEXT: [[CMP3:%.+]] = icmp ule i64 [[IV3]], [[UB_VAL]] // CHECK-NEXT: br i1 [[CMP3]], label %[[SIMPLE_LOOP3_BODY:.+]], label %[[SIMPLE_LOOP3_END:[^,]+]] for (unsigned long long it = 2000; it >= 600; it-=400) { -// CHECK: [[SIMPLE_LOOP3_BODY]] +// CHECK: [[SIMPLE_LOOP3_BODY]]: // Start of body: calculate it from IV: // CHECK: [[IV3_0:%.+]] = load i64, i64* [[OMP_IV3]] // CHECK-NEXT: [[LC_IT_1:%.+]] = mul i64 [[IV3_0]], 400 @@ -162,7 +162,7 @@ void simple(float *a, float *b, float *c // CHECK-NEXT: [[ADD3_2:%.+]] = add i64 [[IV3_2]], 1 // CHECK-NEXT: s
Re: r287755 - [X86][AVX512VL] Add missing _mm256_maskz_alignr_epi64 shufflevector check
Thanks! ~Craig On Wed, Nov 23, 2016 at 3:38 AM, Simon Pilgrim via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: rksimon > Date: Wed Nov 23 05:38:52 2016 > New Revision: 287755 > > URL: http://llvm.org/viewvc/llvm-project?rev=287755&view=rev > Log: > [X86][AVX512VL] Add missing _mm256_maskz_alignr_epi64 shufflevector check > > Missed in rL287733 > > Modified: > cfe/trunk/test/CodeGen/avx512vl-builtins.c > > Modified: cfe/trunk/test/CodeGen/avx512vl-builtins.c > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ > CodeGen/avx512vl-builtins.c?rev=287755&r1=287754&r2=287755&view=diff > > == > --- cfe/trunk/test/CodeGen/avx512vl-builtins.c (original) > +++ cfe/trunk/test/CodeGen/avx512vl-builtins.c Wed Nov 23 05:38:52 2016 > @@ -7007,6 +7007,7 @@ __m256i test_mm256_mask_alignr_epi64(__m > > __m256i test_mm256_maskz_alignr_epi64(__mmask8 __U, __m256i __A, __m256i > __B) { >// CHECK-LABEL: @test_mm256_maskz_alignr_epi64 > + // CHECK: shufflevector <4 x i64> %{{.*}}, <4 x i64> %{{.*}}, <4 x i32> > >// CHECK: select <4 x i1> %{{.*}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}} >return _mm256_maskz_alignr_epi64(__U, __A, __B, 1); > } > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27059: [clang-move] Enable dump all declarations in old header.
ioeric added inline comments. Comment at: clang-move/ClangMove.h:90 + +// When moving all declarations in old header, all code in old.h/cc will be +// moved. Is this the right place for this comment? Seems a bit unexpected. Comment at: unittests/clang-move/ClangMoveTests.cpp:522 + auto ExpectedDeclaration = ExpectedDeclarations.begin(); + for (auto DeclPair : Reporter.getDeclarationList()) { +ASSERT_TRUE(ExpectedDeclaration != ExpectedDeclarations.end()); What if `Reporter.getDeclarationList().size()` > `ExpectedDeclaration.size()`. I'd use iterator-based loop on both vectors and assert both iterators reached end after loop. https://reviews.llvm.org/D27059 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26244: [Driver] Prefer libraries installed next to Clang over those from GCC
Hahnfeld added a comment. ping https://reviews.llvm.org/D26244 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25669: [Driver] Simplify ToolChain::GetCXXStdlibType (NFC)
Hahnfeld added a comment. ping https://reviews.llvm.org/D25669 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits