[PATCH] D25503: [analyzer] Remove superquadratic behaviour from DataflowWorklist
alexshap created this revision. alexshap added reviewers: NoQ, zaks.anna. alexshap added a subscriber: cfe-commits. alexshap set the repository for this revision to rL LLVM. The class DataflowWorklist internally maintains a sorted list of pointers to CFGBlock and the method enqueuePredecessors has to call sortWorklist to maintain the invariant. The implementation based on vector + sort works well for small sizes but gets infeasible for relatively large sizes. In particular the issue takes place for some cryptographic libraries which use code generation. This diff replaces vector + sort with set. The slowdown for small sizes (measured on the current tests) is negligeable (I was looking at the reported "Testing Time" for check-clang-analysis and the difference was less then 0.01s (the total time is 3.93s)). Repository: rL LLVM https://reviews.llvm.org/D25503 Files: lib/Analysis/LiveVariables.cpp Index: lib/Analysis/LiveVariables.cpp === --- lib/Analysis/LiveVariables.cpp +++ lib/Analysis/LiveVariables.cpp @@ -21,59 +21,51 @@ #include "llvm/ADT/PostOrderIterator.h" #include "llvm/Support/raw_ostream.h" #include +#include #include using namespace clang; namespace { class DataflowWorklist { - SmallVector worklist; llvm::BitVector enqueuedBlocks; PostOrderCFGView *POV; + std::multiset worklist; public: DataflowWorklist(const CFG &cfg, AnalysisDeclContext &Ctx) : enqueuedBlocks(cfg.getNumBlockIDs()), - POV(Ctx.getAnalysis()) {} + POV(Ctx.getAnalysis()), + worklist(POV->getComparator()) {} void enqueueBlock(const CFGBlock *block); void enqueuePredecessors(const CFGBlock *block); const CFGBlock *dequeue(); - - void sortWorklist(); }; } void DataflowWorklist::enqueueBlock(const clang::CFGBlock *block) { if (block && !enqueuedBlocks[block->getBlockID()]) { enqueuedBlocks[block->getBlockID()] = true; -worklist.push_back(block); +worklist.insert(block); } } void DataflowWorklist::enqueuePredecessors(const clang::CFGBlock *block) { - const unsigned OldWorklistSize = worklist.size(); for (CFGBlock::const_pred_iterator I = block->pred_begin(), E = block->pred_end(); I != E; ++I) { enqueueBlock(*I); } - - if (OldWorklistSize == 0 || OldWorklistSize == worklist.size()) -return; - - sortWorklist(); -} - -void DataflowWorklist::sortWorklist() { - std::sort(worklist.begin(), worklist.end(), POV->getComparator()); } const CFGBlock *DataflowWorklist::dequeue() { if (worklist.empty()) return nullptr; - const CFGBlock *b = worklist.pop_back_val(); + const auto I = --worklist.end(); + const CFGBlock *b = *I; + worklist.erase(I); enqueuedBlocks[b->getBlockID()] = false; return b; } @@ -528,8 +520,6 @@ } } - worklist.sortWorklist(); - while (const CFGBlock *block = worklist.dequeue()) { // Determine if the block's end value has changed. If not, we // have nothing left to do for this block. Index: lib/Analysis/LiveVariables.cpp === --- lib/Analysis/LiveVariables.cpp +++ lib/Analysis/LiveVariables.cpp @@ -21,59 +21,51 @@ #include "llvm/ADT/PostOrderIterator.h" #include "llvm/Support/raw_ostream.h" #include +#include #include using namespace clang; namespace { class DataflowWorklist { - SmallVector worklist; llvm::BitVector enqueuedBlocks; PostOrderCFGView *POV; + std::multiset worklist; public: DataflowWorklist(const CFG &cfg, AnalysisDeclContext &Ctx) : enqueuedBlocks(cfg.getNumBlockIDs()), - POV(Ctx.getAnalysis()) {} + POV(Ctx.getAnalysis()), + worklist(POV->getComparator()) {} void enqueueBlock(const CFGBlock *block); void enqueuePredecessors(const CFGBlock *block); const CFGBlock *dequeue(); - - void sortWorklist(); }; } void DataflowWorklist::enqueueBlock(const clang::CFGBlock *block) { if (block && !enqueuedBlocks[block->getBlockID()]) { enqueuedBlocks[block->getBlockID()] = true; -worklist.push_back(block); +worklist.insert(block); } } void DataflowWorklist::enqueuePredecessors(const clang::CFGBlock *block) { - const unsigned OldWorklistSize = worklist.size(); for (CFGBlock::const_pred_iterator I = block->pred_begin(), E = block->pred_end(); I != E; ++I) { enqueueBlock(*I); } - - if (OldWorklistSize == 0 || OldWorklistSize == worklist.size()) -return; - - sortWorklist(); -} - -void DataflowWorklist::sortWorklist() { - std::sort(worklist.begin(), worklist.end(), POV->getComparator()); } const CFGBlock *DataflowWorklist::dequeue() { if (worklist.empty()) return nullptr; - const CFGBlock *b = worklist.pop_back_val(); + const auto I = --worklist.end(); + const CFGBlock *b = *I; + worklist.erase(I); enqueuedBlocks[b->getBlockID()] = false; return b; } @@ -528,8 +520,6 @@
[clang-tools-extra] r283981 - [ClangTidy] Add UsingInserter and NamespaceAliaser
Author: hokein Date: Wed Oct 12 02:59:54 2016 New Revision: 283981 URL: http://llvm.org/viewvc/llvm-project?rev=283981&view=rev Log: [ClangTidy] Add UsingInserter and NamespaceAliaser Summary: This adds helper classes to add using declaractions and namespace aliases to function bodies. These help making function calls to deeply nested functions concise (e.g. when calling helpers in a refactoring) Patch by Julian Bangert! Reviewers: alexfh, hokein Subscribers: cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D24997 Added: clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.cpp clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.h clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.h clang-tools-extra/trunk/clang-tidy/utils/UsingInserter.cpp clang-tools-extra/trunk/clang-tidy/utils/UsingInserter.h clang-tools-extra/trunk/unittests/clang-tidy/NamespaceAliaserTest.cpp clang-tools-extra/trunk/unittests/clang-tidy/UsingInserterTest.cpp Added: clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.cpp?rev=283981&view=auto == --- clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.cpp (added) +++ clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.cpp Wed Oct 12 02:59:54 2016 @@ -0,0 +1,28 @@ +//===-- ASTUtils.cpp - clang-tidy ===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "ASTUtils.h" + +#include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/ASTMatchers/ASTMatchers.h" + +namespace clang { +namespace tidy { +namespace utils { +using namespace ast_matchers; + +const FunctionDecl *getSurroundingFunction(ASTContext &Context, + const Stmt &Statement) { + return selectFirst( + "function", match(stmt(hasAncestor(functionDecl().bind("function"))), +Statement, Context)); +} +} // namespace utils +} // namespace tidy +} // namespace clang Added: clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.h?rev=283981&view=auto == --- clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.h (added) +++ clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.h Wed Oct 12 02:59:54 2016 @@ -0,0 +1,25 @@ +//===-- ASTUtils.h - clang-tidy ===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ASTUTILS_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ASTUTILS_H + +#include "clang/AST/AST.h" + +namespace clang { +namespace tidy { +namespace utils { +// Returns the (closest) Function declaration surrounding |Statement| or NULL. +const FunctionDecl *getSurroundingFunction(ASTContext &Context, + const Stmt &Statement); +} // namespace utils +} // namespace tidy +} // namespace clang + +#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ASTUTILS_H Added: clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp?rev=283981&view=auto == --- clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp (added) +++ clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp Wed Oct 12 02:59:54 2016 @@ -0,0 +1,99 @@ +//===-- NamespaceAliaser.cpp - clang-tidy -===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "NamespaceAliaser.h" + +#include "ASTUtils.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/ASTMatchers/ASTMatchers.h" +#include "clang/Lex/Lexer.h" +namespace clang { +namespace tidy { +namespace utils { + +using namespace ast_matchers; + +NamespaceAliaser::NamespaceAliaser(const SourceManager &SourceMgr) +: SourceMgr(SourceMgr) {} + +AST_MATCHER_P(NamespaceAliasDecl, hasTargetNamespace, + ast_matchers::internal::Matcher, innerMatcher)
[PATCH] D24997: [ClangTidy] Add UsingInserter and NamespaceAliaser
This revision was automatically updated to reflect the committed changes. Closed by commit rL283981: [ClangTidy] Add UsingInserter and NamespaceAliaser (authored by hokein). Changed prior to commit: https://reviews.llvm.org/D24997?vs=74311&id=74338#toc Repository: rL LLVM https://reviews.llvm.org/D24997 Files: clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.cpp clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.h clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.h clang-tools-extra/trunk/clang-tidy/utils/UsingInserter.cpp clang-tools-extra/trunk/clang-tidy/utils/UsingInserter.h clang-tools-extra/trunk/unittests/clang-tidy/NamespaceAliaserTest.cpp clang-tools-extra/trunk/unittests/clang-tidy/UsingInserterTest.cpp Index: clang-tools-extra/trunk/unittests/clang-tidy/UsingInserterTest.cpp === --- clang-tools-extra/trunk/unittests/clang-tidy/UsingInserterTest.cpp +++ clang-tools-extra/trunk/unittests/clang-tidy/UsingInserterTest.cpp @@ -0,0 +1,115 @@ +//=== UsingInserterTest.cpp - clang-tidy ===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "../clang-tidy/utils/UsingInserter.h" + +#include "ClangTidyTest.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/ASTMatchers/ASTMatchers.h" +#include "gtest/gtest.h" + +namespace clang { +namespace tidy { +namespace utils { + +// Replace all function calls with calls to foo::func. Inserts using +// declarations as necessary. This checker is for testing only. It +// can only run on one test case (e.g. wih one SourceManager). +class InsertUsingCheck : public clang::tidy::ClangTidyCheck { +public: + using clang::tidy::ClangTidyCheck::ClangTidyCheck; + void registerMatchers(clang::ast_matchers::MatchFinder *Finder) override { +Finder->addMatcher(clang::ast_matchers::callExpr().bind("foo"), this); + } + void + check(const clang::ast_matchers::MatchFinder::MatchResult &Result) override { +if (!Inserter) + Inserter.reset(new UsingInserter(*Result.SourceManager, + Result.Context->getLangOpts())); + +const clang::CallExpr *Call = +Result.Nodes.getNodeAs("foo"); +assert(Call != nullptr && "Did not find node \"foo\""); +auto Hint = +Inserter->createUsingDeclaration(*Result.Context, *Call, "::foo::func"); + +if (Hint.hasValue()) + diag(Call->getLocStart(), "Fix for testing") << Hint.getValue(); + +diag(Call->getLocStart(), "insert call") +<< clang::FixItHint::CreateReplacement( + Call->getCallee()->getSourceRange(), + Inserter->getShortName(*Result.Context, *Call, "::foo::func")); + } + +private: + std::unique_ptr Inserter; +}; + +template +std::string runChecker(StringRef Code, int ExpectedWarningCount) { + std::map AdditionalFileContents = {{"foo.h", +"namespace foo {\n" +"namespace bar {\n" +"}\n" +"void func() { }\n" +"}"}}; + std::vector errors; + + std::string result = + test::runCheckOnCode(Code, &errors, "foo.cc", None, + ClangTidyOptions(), AdditionalFileContents); + + EXPECT_EQ(ExpectedWarningCount, errors.size()); + return result; +} + +TEST(UsingInserterTest, ReusesExisting) { + EXPECT_EQ("#include \"foo.h\"\n" +"namespace {" +"using ::foo::func;\n" +"void f() { func(); }" +"}", +runChecker("#include \"foo.h\"\n" + "namespace {" + "using ::foo::func;\n" + "void f() { f(); }" + "}", + 1)); +} + +TEST(UsingInserterTest, ReusesExistingGlobal) { + EXPECT_EQ("#include \"foo.h\"\n" +"using ::foo::func;\n" +"namespace {" +"void f() { func(); }" +"}", +runChecker("#include \"foo.h\"\n" + "using ::foo::func;\n" + "namespace {" + "void f() { f(); }" + "}", + 1)); +} + +TEST(UsingInserterTest, AvoidsConflict) { + EXPECT_EQ("#include \"foo.h\"\n" +"names
[PATCH] D25397: [change-namespace] don't miss comments in the beginning of a namespace block.
hokein accepted this revision. hokein added a comment. This revision is now accepted and ready to land. LGTM. Comment at: change-namespace/ChangeNamespace.cpp:387 + Token Tok; + while (!Lex->LexFromRawLexer(Tok) && Tok.isNot(tok::TokenKind::l_brace)) { + } ioeric wrote: > hokein wrote: > > Maybe we can use `findLocationAfterToken` here? > This doesn't seem to work in this case. Note that we are lexing from the > beginning of `NsDecl`, which is `namespace` or `inline`, and the next token > is not necessarily `{`. > > /// \brief Checks that the given token is the first token that occurs after > the > /// given location (this excludes comments and whitespace). Returns the > location > /// immediately after the specified token. If the token is not found or the > /// location is inside a macro, the returned source location will be > invalid. > SourceLocation Lexer::findLocationAfterToken(...); > I see. Thanks for the clarification. https://reviews.llvm.org/D25397 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24656: [clang-tidy] Add check readability-redundant-declaration
danielmarjamaki added inline comments. Comment at: clang-tidy/readability/RedundantDeclarationCheck.cpp:60 +auto Diag = diag(D->getLocation(), "redundant '%0' declaration") +<< cast(D)->getName(); +if (!MultiVar && !DifferentHeaders) alexfh wrote: > It should be possible to just use `D` here. Thanks. It's not possible: ``` RedundantDeclarationCheck.cpp:61:15: error: ‘const class clang::Decl’ has no member named ‘getName’ << D->getName(); ^ ``` https://reviews.llvm.org/D24656 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r283983 - Protect special members of NullBase archetype to avoid exposing them
Author: ericwf Date: Wed Oct 12 03:09:22 2016 New Revision: 283983 URL: http://llvm.org/viewvc/llvm-project?rev=283983&view=rev Log: Protect special members of NullBase archetype to avoid exposing them Modified: libcxx/trunk/test/support/archetypes.hpp Modified: libcxx/trunk/test/support/archetypes.hpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/archetypes.hpp?rev=283983&r1=283982&r2=283983&view=diff == --- libcxx/trunk/test/support/archetypes.hpp (original) +++ libcxx/trunk/test/support/archetypes.hpp Wed Oct 12 03:09:22 2016 @@ -13,7 +13,14 @@ namespace ArchetypeBases { template struct DepType : T {}; -struct NullBase {}; +struct NullBase { +protected: + NullBase() = default; + NullBase(NullBase const&) = default; + NullBase& operator=(NullBase const&) = default; + NullBase(NullBase &&) = default; + NullBase& operator=(NullBase &&) = default; +}; template struct TestBase { @@ -66,7 +73,7 @@ struct TestBase { ++alive; ++constructed; ++value_constructed; } template ::type = true> -TestBase(std::initializer_list& il, int y = 0) noexcept : value(il.size()) { +explicit TestBase(std::initializer_list& il, int y = 0) noexcept : value(il.size()) { ++alive; ++constructed; ++value_constructed; } TestBase& operator=(int xvalue) noexcept { @@ -79,11 +86,11 @@ protected: assert(value != -999); assert(alive > 0); --alive; ++destroyed; value = -999; } -TestBase(TestBase const& o) noexcept : value(o.value) { +explicit TestBase(TestBase const& o) noexcept : value(o.value) { assert(o.value != -1); assert(o.value != -999); ++alive; ++constructed; ++copy_constructed; } -TestBase(TestBase && o) noexcept : value(o.value) { +explicit TestBase(TestBase && o) noexcept : value(o.value) { assert(o.value != -1); assert(o.value != -999); ++alive; ++constructed; ++move_constructed; o.value = -1; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r283985 - Revert "[ClangTidy] Add UsingInserter and NamespaceAliaser"
Author: hokein Date: Wed Oct 12 03:19:44 2016 New Revision: 283985 URL: http://llvm.org/viewvc/llvm-project?rev=283985&view=rev Log: Revert "[ClangTidy] Add UsingInserter and NamespaceAliaser" This reverts commit r283981. This patch breaks the buildbot. Removed: clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.cpp clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.h clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.h clang-tools-extra/trunk/clang-tidy/utils/UsingInserter.cpp clang-tools-extra/trunk/clang-tidy/utils/UsingInserter.h clang-tools-extra/trunk/unittests/clang-tidy/NamespaceAliaserTest.cpp clang-tools-extra/trunk/unittests/clang-tidy/UsingInserterTest.cpp Removed: clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.cpp?rev=283984&view=auto == --- clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.cpp (removed) @@ -1,28 +0,0 @@ -//===-- ASTUtils.cpp - clang-tidy ===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===--===// - -#include "ASTUtils.h" - -#include "clang/ASTMatchers/ASTMatchFinder.h" -#include "clang/ASTMatchers/ASTMatchers.h" - -namespace clang { -namespace tidy { -namespace utils { -using namespace ast_matchers; - -const FunctionDecl *getSurroundingFunction(ASTContext &Context, - const Stmt &Statement) { - return selectFirst( - "function", match(stmt(hasAncestor(functionDecl().bind("function"))), -Statement, Context)); -} -} // namespace utils -} // namespace tidy -} // namespace clang Removed: clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.h?rev=283984&view=auto == --- clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.h (original) +++ clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.h (removed) @@ -1,25 +0,0 @@ -//===-- ASTUtils.h - clang-tidy ===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===--===// - -#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ASTUTILS_H -#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ASTUTILS_H - -#include "clang/AST/AST.h" - -namespace clang { -namespace tidy { -namespace utils { -// Returns the (closest) Function declaration surrounding |Statement| or NULL. -const FunctionDecl *getSurroundingFunction(ASTContext &Context, - const Stmt &Statement); -} // namespace utils -} // namespace tidy -} // namespace clang - -#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ASTUTILS_H Removed: clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp?rev=283984&view=auto == --- clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp (removed) @@ -1,99 +0,0 @@ -//===-- NamespaceAliaser.cpp - clang-tidy -===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===--===// - -#include "NamespaceAliaser.h" - -#include "ASTUtils.h" -#include "clang/ASTMatchers/ASTMatchFinder.h" -#include "clang/ASTMatchers/ASTMatchers.h" -#include "clang/Lex/Lexer.h" -namespace clang { -namespace tidy { -namespace utils { - -using namespace ast_matchers; - -NamespaceAliaser::NamespaceAliaser(const SourceManager &SourceMgr) -: SourceMgr(SourceMgr) {} - -AST_MATCHER_P(NamespaceAliasDecl, hasTargetNamespace, - ast_matchers::internal::Matcher, innerMatcher) { - return innerMatcher.matches(*Node.getNamespace(), Finder, Builder); -} - -Optional -NamespaceAliaser::createAlias(ASTContext &Context, const Stmt &Statement, - StringRef Namespace, - const std::vector &Abbreviations) { - const FunctionDecl *Function = getSurroundingFunction
[PATCH] D24997: [ClangTidy] Add UsingInserter and NamespaceAliaser
hokein added a comment. @jbangert, your patch broke the buildbot, and I reverted it in r283985. You need to add the new source files to the CMakefile. (I saw other compilation errors after I updated the cmake files, Could you take a look on it? ) Repository: rL LLVM https://reviews.llvm.org/D24997 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation
rmaprath added a comment. In https://reviews.llvm.org/D21803#567774, @tavianator wrote: > In https://reviews.llvm.org/D21803#556857, @EricWF wrote: > > > @rmaprath I'll merge this if needed. Feel free to commit your patch first. > > > Yeah, @rmaprath I'm happy to rebase this over your patch. My patch got a bit stuck downstream :( So you / @EricWF can go ahead with this patch, I'll rebase mine over yours when I'm ready to commit. / Asiri https://reviews.llvm.org/D21803 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r283986 - [clang-tidy-vs] Fix ClangTidy extension name in the manifest.
Author: mkurdej Date: Wed Oct 12 03:32:59 2016 New Revision: 283986 URL: http://llvm.org/viewvc/llvm-project?rev=283986&view=rev Log: [clang-tidy-vs] Fix ClangTidy extension name in the manifest. Modified: clang-tools-extra/trunk/clang-tidy-vs/source.extension.vsixmanifest.in Modified: clang-tools-extra/trunk/clang-tidy-vs/source.extension.vsixmanifest.in URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy-vs/source.extension.vsixmanifest.in?rev=283986&r1=283985&r2=283986&view=diff == --- clang-tools-extra/trunk/clang-tidy-vs/source.extension.vsixmanifest.in (original) +++ clang-tools-extra/trunk/clang-tidy-vs/source.extension.vsixmanifest.in Wed Oct 12 03:32:59 2016 @@ -1,7 +1,7 @@  http://schemas.microsoft.com/developer/vsx-schema/2010";> -ClangFormat +ClangTidy LLVM @CLANG_TIDY_VS_VERSION@ A static analysis tool for C/C++ code. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r283988 - Provide a fallback __cxa_thread_atexit() implementation. Patch from Tavian Barnes
Author: ericwf Date: Wed Oct 12 03:54:10 2016 New Revision: 283988 URL: http://llvm.org/viewvc/llvm-project?rev=283988&view=rev Log: Provide a fallback __cxa_thread_atexit() implementation. Patch from Tavian Barnes Added: libcxxabi/trunk/test/thread_local_destruction_order.pass.cpp Modified: libcxxabi/trunk/src/cxa_thread_atexit.cpp libcxxabi/trunk/test/CMakeLists.txt libcxxabi/trunk/test/cxa_thread_atexit_test.pass.cpp libcxxabi/trunk/test/libcxxabi/test/config.py libcxxabi/trunk/test/lit.site.cfg.in Modified: libcxxabi/trunk/src/cxa_thread_atexit.cpp URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_thread_atexit.cpp?rev=283988&r1=283987&r2=283988&view=diff == --- libcxxabi/trunk/src/cxa_thread_atexit.cpp (original) +++ libcxxabi/trunk/src/cxa_thread_atexit.cpp Wed Oct 12 03:54:10 2016 @@ -7,20 +7,133 @@ // //===--===// +#include "abort_message.h" #include "cxxabi.h" +#include +#include namespace __cxxabiv1 { -extern "C" { -#ifdef HAVE___CXA_THREAD_ATEXIT_IMPL + using Dtor = void(*)(void*); -_LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(void (*dtor)(void *), void *obj, -void *dso_symbol) throw() { - extern int __cxa_thread_atexit_impl(void (*)(void *), void *, void *); - return __cxa_thread_atexit_impl(dtor, obj, dso_symbol); -} + extern "C" +#ifndef HAVE___CXA_THREAD_ATEXIT_IMPL + // A weak symbol is used to detect this function's presence in the C library + // at runtime, even if libc++ is built against an older libc + __attribute__((__weak__)) +#endif + int __cxa_thread_atexit_impl(Dtor, void*, void*); + +#ifndef HAVE___CXA_THREAD_ATEXIT_IMPL + +namespace { + // This implementation is used if the C library does not provide + // __cxa_thread_atexit_impl() for us. It has a number of limitations that are + // difficult to impossible to address without ..._impl(): + // + // - dso_symbol is ignored. This means that a shared library may be unloaded + // (via dlclose()) before its thread_local destructors have run. + // + // - thread_local destructors for the main thread are run by the destructor of + // a static object. This is later than expected; they should run before the + // destructors of any objects with static storage duration. + // + // - thread_local destructors on non-main threads run on the first iteration + // through the pthread_key destructors. std::notify_all_at_thread_exit() + // and similar functions must be careful to wait until the second iteration + // to provide their intended ordering guarantees. + // + // Another limitation, though one shared with ..._impl(), is that any + // thread_locals that are first initialized after non-thread_local global + // destructors begin to run will not be destroyed. [basic.start.term] states + // that all thread_local destructors are sequenced before the destruction of + // objects with static storage duration, resulting in a contradiction if a + // thread_local is constructed after that point. Thus we consider such + // programs ill-formed, and don't bother to run those destructors. (If the + // program terminates abnormally after such a thread_local is constructed, + // the destructor is not expected to run and thus there is no contradiction. + // So construction still has to work.) + + struct DtorList { +Dtor dtor; +void* obj; +DtorList* next; + }; + + // The linked list of thread-local destructors to run + __thread DtorList* dtors = nullptr; + // True if the destructors are currently scheduled to run on this thread + __thread bool dtors_alive = false; + // Used to trigger destructors on thread exit; value is ignored + pthread_key_t dtors_key; + + void run_dtors(void*) { +while (auto head = dtors) { + dtors = head->next; + head->dtor(head->obj); + std::free(head); +} + +dtors_alive = false; + } + + struct DtorsManager { +DtorsManager() { + // There is intentionally no matching pthread_key_delete call, as + // __cxa_thread_atexit() may be called arbitrarily late (for example, from + // global destructors or atexit() handlers). + if (pthread_key_create(&dtors_key, run_dtors) != 0) { +abort_message("pthread_key_create() failed in __cxa_thread_atexit()"); + } +} + +~DtorsManager() { + // pthread_key destructors do not run on threads that call exit() + // (including when the main thread returns from main()), so we explicitly + // call the destructor here. This runs at exit time (potentially earlier + // if libc++abi is dlclose()'d). Any thread_locals initialized after this + // point will not be destroyed. + run_dtors(nullptr); +} + }; +} // namespace #endif // HAVE__CXA_THREAD_ATEXIT_IMPL +extern "C" { + + _LIBCXXABI_FUN
[PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation
EricWF closed this revision. EricWF added a comment. Committed as r283988. Thanks for the patch! https://reviews.llvm.org/D21803 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25492: [libcxx] [test] Fix shadowing in string.assign and string.append
EricWF accepted this revision. EricWF added a comment. This revision is now accepted and ready to land. LGTM. https://reviews.llvm.org/D25492 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [clang-tools-extra] r283981 - [ClangTidy] Add UsingInserter and NamespaceAliaser
On 12 October 2016 at 08:59, Haojian Wu via cfe-commits wrote: > Author: hokein > Date: Wed Oct 12 02:59:54 2016 > New Revision: 283981 > > URL: http://llvm.org/viewvc/llvm-project?rev=283981&view=rev > Log: > [ClangTidy] Add UsingInserter and NamespaceAliaser Hi Haojian, Many, if not all buildbots building Clang *also* build clang-tools-extra. Any commit you make to your projects are bound to affect many more buildbots than you would expect. So I'm asking you to be careful with your commits, as this is not the first time. One rule of thumb that I took it to heart very early on, after making the same mistakes myself, is to *always* build and test someone else's patch on my machine, in a configuration that is likely to be present in most buildbots. That practically means the following: 1. Have a check-out with LLVM+Clang+RT 2. Update it to the latest trunk, apply the patch 2.1 If it doesn't apply cleanly, refuse the patch, ask to rebase (you could rebase it wrong and not notice, I've done that) 2.2 The original author rebases and updates the review 2.3 Goto 2 3. Run "make check-all" and it has to pass. 4. Commit, and hope for the best. If even after that, it broke some obscure buildbot, that's life, we can deal with that. cheers, --renato ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r283991 - Remove use of _VSTD::__invoke in the not_fn tests
Author: ericwf Date: Wed Oct 12 04:06:12 2016 New Revision: 283991 URL: http://llvm.org/viewvc/llvm-project?rev=283991&view=rev Log: Remove use of _VSTD::__invoke in the not_fn tests Modified: libcxx/trunk/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp Modified: libcxx/trunk/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp?rev=283991&r1=283990&r2=283991&view=diff == --- libcxx/trunk/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp Wed Oct 12 04:06:12 2016 @@ -554,7 +554,10 @@ void call_operator_noexcept_test() using T = NoExceptCallable; T value(true); auto ret = std::not_fn(value); -static_assert(noexcept(!_VSTD::__invoke(value)), ""); +LIBCPP_STATIC_ASSERT(noexcept(!_VSTD::__invoke(value)), ""); +#if TEST_STD_VER > 14 +static_assert(noexcept(!std::invoke(value)), ""); +#endif static_assert(noexcept(ret()), "call should be noexcept"); auto const& cret = ret; static_assert(noexcept(cret()), "call should be noexcept"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r283993 - Fix use of C++14 constexpr in C++11
Author: ericwf Date: Wed Oct 12 04:20:58 2016 New Revision: 283993 URL: http://llvm.org/viewvc/llvm-project?rev=283993&view=rev Log: Fix use of C++14 constexpr in C++11 Modified: libcxx/trunk/test/support/archetypes.ipp Modified: libcxx/trunk/test/support/archetypes.ipp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/archetypes.ipp?rev=283993&r1=283992&r2=283993&view=diff == --- libcxx/trunk/test/support/archetypes.ipp (original) +++ libcxx/trunk/test/support/archetypes.ipp Wed Oct 12 04:20:58 2016 @@ -9,7 +9,11 @@ #define DEFINE_CONSTEXPR constexpr #endif #ifndef DEFINE_ASSIGN_CONSTEXPR +#if TEST_STD_VER >= 14 #define DEFINE_ASSIGN_CONSTEXPR DEFINE_CONSTEXPR +#else +#define DEFINE_ASSIGN_CONSTEXPR +#endif #endif #ifndef DEFINE_CTOR #define DEFINE_CTOR = default ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r283994 - Fix nasty_containers.hpp for other stdlibs
Author: ericwf Date: Wed Oct 12 04:31:26 2016 New Revision: 283994 URL: http://llvm.org/viewvc/llvm-project?rev=283994&view=rev Log: Fix nasty_containers.hpp for other stdlibs Modified: libcxx/trunk/test/support/nasty_containers.hpp libcxx/trunk/test/support/test_macros.h Modified: libcxx/trunk/test/support/nasty_containers.hpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/nasty_containers.hpp?rev=283994&r1=283993&r2=283994&view=diff == --- libcxx/trunk/test/support/nasty_containers.hpp (original) +++ libcxx/trunk/test/support/nasty_containers.hpp Wed Oct 12 04:31:26 2016 @@ -14,6 +14,8 @@ #include #include +#include "test_macros.h" + template class nasty_vector { @@ -49,27 +51,27 @@ public: void assign(std::initializer_list il) { v_.assign(il); } #endif -iterator begin() _NOEXCEPT { return v_.begin(); } -const_iterator begin() const _NOEXCEPT { return v_.begin(); } -iterator end() _NOEXCEPT { return v_.end(); } -const_iterator end() const _NOEXCEPT { return v_.end(); } - -reverse_iterator rbegin() _NOEXCEPT{ return v_.rbegin(); } -const_reverse_iterator rbegin() const _NOEXCEPT { return v_.rbegin(); } -reverse_iterator rend() _NOEXCEPT { return v_.rend(); } -const_reverse_iterator rend()const _NOEXCEPT { return v_.rend(); } - -const_iterator cbegin() const _NOEXCEPT { return v_.cbegin(); } -const_iterator cend()const _NOEXCEPT { return v_.cend(); } -const_reverse_iterator crbegin() const _NOEXCEPT { return v_.crbegin(); } -const_reverse_iterator crend() const _NOEXCEPT { return v_.crend(); } - -size_type size() const _NOEXCEPT { return v_.size(); } -size_type max_size() const _NOEXCEPT { return v_.max_size(); } -size_type capacity() const _NOEXCEPT { return v_.capacity(); } -bool empty() const _NOEXCEPT { return v_.empty(); } +iterator begin() TEST_NOEXCEPT { return v_.begin(); } +const_iterator begin() const TEST_NOEXCEPT { return v_.begin(); } +iterator end() TEST_NOEXCEPT { return v_.end(); } +const_iterator end() const TEST_NOEXCEPT { return v_.end(); } + +reverse_iterator rbegin() TEST_NOEXCEPT{ return v_.rbegin(); } +const_reverse_iterator rbegin() const TEST_NOEXCEPT { return v_.rbegin(); } +reverse_iterator rend() TEST_NOEXCEPT { return v_.rend(); } +const_reverse_iterator rend()const TEST_NOEXCEPT { return v_.rend(); } + +const_iterator cbegin() const TEST_NOEXCEPT { return v_.cbegin(); } +const_iterator cend()const TEST_NOEXCEPT { return v_.cend(); } +const_reverse_iterator crbegin() const TEST_NOEXCEPT { return v_.crbegin(); } +const_reverse_iterator crend() const TEST_NOEXCEPT { return v_.crend(); } + +size_type size() const TEST_NOEXCEPT { return v_.size(); } +size_type max_size() const TEST_NOEXCEPT { return v_.max_size(); } +size_type capacity() const TEST_NOEXCEPT { return v_.capacity(); } +bool empty() const TEST_NOEXCEPT { return v_.empty(); } void reserve(size_type n) { v_.reserve(n); }; -void shrink_to_fit() _NOEXCEPT{ v_.shrink_to_fit(); } +void shrink_to_fit() TEST_NOEXCEPT{ v_.shrink_to_fit(); } reference operator[](size_type n) { return v_[n]; } const_reference operator[](size_type n) const { return v_[n]; } @@ -81,8 +83,8 @@ public: reference back(){ return v_.back(); } const_reference back() const { return v_.back(); } -value_type* data() _NOEXCEPT { return v_.data(); } -const value_type* data() const _NOEXCEPT { return v_.data(); } +value_type* data() TEST_NOEXCEPT { return v_.data(); } +const value_type* data() const TEST_NOEXCEPT { return v_.data(); } void push_back(const value_type& x) { v_.push_back(x); } #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -117,12 +119,17 @@ public: iterator erase(const_iterator pos){ return v_.erase(pos); } iterator erase(const_iterator first, const_iterator last) { return v_.erase(first, last); } -void clear() _NOEXCEPT { v_.clear(); } +void clear() TEST_NOEXCEPT { v_.clear(); } void resize(size_type sz) { v_.resize(sz); } void resize(size_type sz, const value_type& c) { v_.resize(sz, c); } -void swap(nasty_vector &nv) _NOEXCEPT_(std::__is_nothrow_swappable::value) +void swap(nasty_vector &nv) +#if TEST_STD_VER > 14 +noexcept(std::is_nothrow_swappable::value) +#elif defined(_LIBCPP_VERSION) +TEST_NOEXCEPT_COND(std::__is_nothrow_swappable::value) +#endif { v_.swap(nv.v_); }
r283995 - [Sema] Handle transparent_union attributes in C mode only
Author: arphaman Date: Wed Oct 12 04:36:35 2016 New Revision: 283995 URL: http://llvm.org/viewvc/llvm-project?rev=283995&view=rev Log: [Sema] Handle transparent_union attributes in C mode only This commit marks the transparent_union attributes as C only because clang doesn't support them in C++ mode. Prior to this commit, clang still tried to verify these attributes in C++, leading to crashes when analyzing templated transparent_union unions that have dependent field types. This commit ensures that such crashes won't happen again. As a result of this commit clang now displays a warning every time it encounters a transparent_union attribute in C++ mode. Differential Revision: https://reviews.llvm.org/D25308 Modified: cfe/trunk/include/clang/Basic/Attr.td cfe/trunk/test/SemaCXX/attr-gnu.cpp Modified: cfe/trunk/include/clang/Basic/Attr.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=283995&r1=283994&r2=283995&view=diff == --- cfe/trunk/include/clang/Basic/Attr.td (original) +++ cfe/trunk/include/clang/Basic/Attr.td Wed Oct 12 04:36:35 2016 @@ -1543,6 +1543,7 @@ def TransparentUnion : InheritableAttr { let Spellings = [GCC<"transparent_union">]; // let Subjects = SubjectList<[Record, TypedefName]>; let Documentation = [Undocumented]; + let LangOpts = [COnly]; } def Unavailable : InheritableAttr { Modified: cfe/trunk/test/SemaCXX/attr-gnu.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-gnu.cpp?rev=283995&r1=283994&r2=283995&view=diff == --- cfe/trunk/test/SemaCXX/attr-gnu.cpp (original) +++ cfe/trunk/test/SemaCXX/attr-gnu.cpp Wed Oct 12 04:36:35 2016 @@ -27,3 +27,19 @@ public: void test3() __attribute__((cf_unknown_transfer)) override {} // Ok, not known to GCC. }; } + +template +union Tu { T b; } __attribute__((transparent_union)); // expected-warning {{'transparent_union' attribute ignored}} + +template +union Tu2 { int x; T b; } __attribute__((transparent_union)); // expected-warning {{'transparent_union' attribute ignored}} + +union Tu3 { int x; } __attribute((transparent_union)); // expected-warning {{'transparent_union' attribute ignored}} + +void tuTest1(Tu u); // expected-note {{candidate function not viable: no known conversion from 'int' to 'Tu' for 1st argument}} +void tuTest2(Tu3 u); // expected-note {{candidate function not viable: no known conversion from 'int' to 'Tu3' for 1st argument}} +void tu() { + int x = 2; + tuTest1(x); // expected-error {{no matching function for call to 'tuTest1'}} + tuTest2(x); // expected-error {{no matching function for call to 'tuTest2'}} +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r283996 - Fix more C++11 constexpr issues in the tests
Author: ericwf Date: Wed Oct 12 04:48:44 2016 New Revision: 283996 URL: http://llvm.org/viewvc/llvm-project?rev=283996&view=rev Log: Fix more C++11 constexpr issues in the tests Modified: libcxx/trunk/test/support/archetypes.hpp Modified: libcxx/trunk/test/support/archetypes.hpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/archetypes.hpp?rev=283996&r1=283995&r2=283996&view=diff == --- libcxx/trunk/test/support/archetypes.hpp (original) +++ libcxx/trunk/test/support/archetypes.hpp Wed Oct 12 04:48:44 2016 @@ -138,27 +138,42 @@ struct ValueBase { explicit constexpr ValueBase(std::initializer_list& il, int y = 0) : value(il.size()) {} template ::type = true> constexpr ValueBase(std::initializer_list& il, int y = 0) : value(il.size()) {} -constexpr ValueBase& operator=(int xvalue) noexcept { +TEST_CONSTEXPR_CXX14 ValueBase& operator=(int xvalue) noexcept { value = xvalue; return *this; } //~ValueBase() { assert(value != -999); value = -999; } int value; protected: - constexpr ValueBase() noexcept : value(0) {} -constexpr ValueBase(ValueBase const& o) noexcept : value(o.value) { -assert(o.value != -1); assert(o.value != -999); +constexpr static int check_value(int const& val) { +#if TEST_STD_VER < 14 + return val == -1 || val == 999 ? TEST_THROW(42) : val; +#else + assert(val != -1); assert(val != 999); + return val; +#endif } -constexpr ValueBase(ValueBase && o) noexcept : value(o.value) { -assert(o.value != -1); assert(o.value != -999); -o.value = -1; +constexpr static int check_value(int& val, int val_cp = 0) { +#if TEST_STD_VER < 14 + return val_cp = val, val = -1, (val_cp == -1 || val_cp == 999 ? TEST_THROW(42) : val_cp); +#else + assert(val != -1); assert(val != 999); + val_cp = val; + val = -1; + return val_cp; +#endif +} +constexpr ValueBase() noexcept : value(0) {} +constexpr ValueBase(ValueBase const& o) noexcept : value(check_value(o.value)) { +} +constexpr ValueBase(ValueBase && o) noexcept : value(check_value(o.value)) { } -constexpr ValueBase& operator=(ValueBase const& o) noexcept { +TEST_CONSTEXPR_CXX14 ValueBase& operator=(ValueBase const& o) noexcept { assert(o.value != -1); assert(o.value != -999); value = o.value; return *this; } -constexpr ValueBase& operator=(ValueBase&& o) noexcept { +TEST_CONSTEXPR_CXX14 ValueBase& operator=(ValueBase&& o) noexcept { assert(o.value != -1); assert(o.value != -999); value = o.value; o.value = -1; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25308: [Sema] Ignore transparent_union attributes in C++
This revision was automatically updated to reflect the committed changes. Closed by commit rL283995: [Sema] Handle transparent_union attributes in C mode only (authored by arphaman). Changed prior to commit: https://reviews.llvm.org/D25308?vs=74127&id=74350#toc Repository: rL LLVM https://reviews.llvm.org/D25308 Files: cfe/trunk/include/clang/Basic/Attr.td cfe/trunk/test/SemaCXX/attr-gnu.cpp Index: cfe/trunk/include/clang/Basic/Attr.td === --- cfe/trunk/include/clang/Basic/Attr.td +++ cfe/trunk/include/clang/Basic/Attr.td @@ -1543,6 +1543,7 @@ let Spellings = [GCC<"transparent_union">]; // let Subjects = SubjectList<[Record, TypedefName]>; let Documentation = [Undocumented]; + let LangOpts = [COnly]; } def Unavailable : InheritableAttr { Index: cfe/trunk/test/SemaCXX/attr-gnu.cpp === --- cfe/trunk/test/SemaCXX/attr-gnu.cpp +++ cfe/trunk/test/SemaCXX/attr-gnu.cpp @@ -27,3 +27,19 @@ void test3() __attribute__((cf_unknown_transfer)) override {} // Ok, not known to GCC. }; } + +template +union Tu { T b; } __attribute__((transparent_union)); // expected-warning {{'transparent_union' attribute ignored}} + +template +union Tu2 { int x; T b; } __attribute__((transparent_union)); // expected-warning {{'transparent_union' attribute ignored}} + +union Tu3 { int x; } __attribute((transparent_union)); // expected-warning {{'transparent_union' attribute ignored}} + +void tuTest1(Tu u); // expected-note {{candidate function not viable: no known conversion from 'int' to 'Tu' for 1st argument}} +void tuTest2(Tu3 u); // expected-note {{candidate function not viable: no known conversion from 'int' to 'Tu3' for 1st argument}} +void tu() { + int x = 2; + tuTest1(x); // expected-error {{no matching function for call to 'tuTest1'}} + tuTest2(x); // expected-error {{no matching function for call to 'tuTest2'}} +} Index: cfe/trunk/include/clang/Basic/Attr.td === --- cfe/trunk/include/clang/Basic/Attr.td +++ cfe/trunk/include/clang/Basic/Attr.td @@ -1543,6 +1543,7 @@ let Spellings = [GCC<"transparent_union">]; // let Subjects = SubjectList<[Record, TypedefName]>; let Documentation = [Undocumented]; + let LangOpts = [COnly]; } def Unavailable : InheritableAttr { Index: cfe/trunk/test/SemaCXX/attr-gnu.cpp === --- cfe/trunk/test/SemaCXX/attr-gnu.cpp +++ cfe/trunk/test/SemaCXX/attr-gnu.cpp @@ -27,3 +27,19 @@ void test3() __attribute__((cf_unknown_transfer)) override {} // Ok, not known to GCC. }; } + +template +union Tu { T b; } __attribute__((transparent_union)); // expected-warning {{'transparent_union' attribute ignored}} + +template +union Tu2 { int x; T b; } __attribute__((transparent_union)); // expected-warning {{'transparent_union' attribute ignored}} + +union Tu3 { int x; } __attribute((transparent_union)); // expected-warning {{'transparent_union' attribute ignored}} + +void tuTest1(Tu u); // expected-note {{candidate function not viable: no known conversion from 'int' to 'Tu' for 1st argument}} +void tuTest2(Tu3 u); // expected-note {{candidate function not viable: no known conversion from 'int' to 'Tu3' for 1st argument}} +void tu() { + int x = 2; + tuTest1(x); // expected-error {{no matching function for call to 'tuTest1'}} + tuTest2(x); // expected-error {{no matching function for call to 'tuTest2'}} +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r283997 - support --param=std=gnu++XX
Author: ericwf Date: Wed Oct 12 04:53:35 2016 New Revision: 283997 URL: http://llvm.org/viewvc/llvm-project?rev=283997&view=rev Log: support --param=std=gnu++XX Modified: libcxx/trunk/test/libcxx/test/config.py Modified: libcxx/trunk/test/libcxx/test/config.py URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/config.py?rev=283997&r1=283996&r2=283997&view=diff == --- libcxx/trunk/test/libcxx/test/config.py (original) +++ libcxx/trunk/test/libcxx/test/config.py Wed Oct 12 04:53:35 2016 @@ -347,7 +347,7 @@ class Configuration(object): 'Failed to infer a supported language dialect from one of %r' % possible_stds) self.cxx.compile_flags += ['-std={0}'.format(std)] -self.config.available_features.add(std) +self.config.available_features.add(std.replace('gnu++', 'c++')) # Configure include paths self.configure_compile_flags_header_includes() self.target_info.add_cxx_compile_flags(self.cxx.compile_flags) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25508: [clang-move] Don't comparing absolute file path to relative path.
hokein created this revision. hokein added a reviewer: ioeric. hokein added subscribers: bkramer, cfe-commits. Herald added subscribers: mgorny, beanz. This patch is kind of reverting r283202 (but keep the updated lint test), because it leads to a few annoying problems by comparing absolute file path to the relative path: - MakeAbsolutePath does wrong things with symlinks. - Removing `..` directory is not always safe. https://reviews.llvm.org/D25508 Files: clang-move/ClangMove.cpp clang-move/ClangMove.h clang-move/tool/ClangMoveMain.cpp test/CMakeLists.txt test/clang-move/Inputs/database_template.json test/clang-move/move-class.cpp unittests/clang-move/ClangMoveTests.cpp Index: unittests/clang-move/ClangMoveTests.cpp === --- unittests/clang-move/ClangMoveTests.cpp +++ unittests/clang-move/ClangMoveTests.cpp @@ -187,12 +187,8 @@ CreateFiles(Spec.OldCC, TestCC); std::map FileToReplacements; - llvm::SmallString<128> InitialDirectory; - std::error_code EC = llvm::sys::fs::current_path(InitialDirectory); - assert(!EC); - (void)EC; auto Factory = llvm::make_unique( - Spec, FileToReplacements, InitialDirectory.str(), "LLVM"); + Spec, FileToReplacements, "LLVM"); tooling::runToolOnCodeWithArgs( Factory->create(), TestCC, {"-std=c++11", "-fparse-all-comments"}, Index: test/clang-move/move-class.cpp === --- test/clang-move/move-class.cpp +++ test/clang-move/move-class.cpp @@ -1,21 +1,15 @@ // RUN: mkdir -p %T/clang-move/build +// RUN: mkdir -p %T/clang-move/include // RUN: sed 's|$test_dir|%/T/clang-move|g' %S/Inputs/database_template.json > %T/clang-move/compile_commands.json -// RUN: cp %S/Inputs/test* %T/clang-move/ -// RUN: touch %T/clang-move/test2.h -// RUN: cd %T/clang-move -// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=../clang-move/test.cpp -old_header=../clang-move/test.h %T/clang-move/test.cpp +// RUN: cp %S/Inputs/test.h %T/clang-move/include +// RUN: cp %S/Inputs/test.cpp %T/clang-move/ +// RUN: touch %T/clang-move/include/test2.h +// RUN: cd %T/clang-move/build +// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=test.cpp -old_header=../include/test.h %T/clang-move/test.cpp // RUN: FileCheck -input-file=%T/clang-move/new_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s // RUN: FileCheck -input-file=%T/clang-move/new_test.h -check-prefix=CHECK-NEW-TEST-H %s // RUN: FileCheck -input-file=%T/clang-move/test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s -// RUN: FileCheck -input-file=%T/clang-move/test.h %s -implicit-check-not='{{namespace.*}}' -// -// RUN: cp %S/Inputs/test* %T/clang-move/ -// RUN: cd %T/clang-move -// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=%T/clang-move/test.cpp -old_header=%T/clang-move/test.h %T/clang-move/test.cpp -// RUN: FileCheck -input-file=%T/clang-move/new_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s -// RUN: FileCheck -input-file=%T/clang-move/new_test.h -check-prefix=CHECK-NEW-TEST-H %s -// RUN: FileCheck -input-file=%T/clang-move/test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s -// RUN: FileCheck -input-file=%T/clang-move/test.h %s -implicit-check-not='{{namespace.*}}' +// RUN: FileCheck -input-file=%T/clang-move/include/test.h %s -implicit-check-not='{{namespace.*}}' // // CHECK-NEW-TEST-H: namespace a { // CHECK-NEW-TEST-H: class Foo { Index: test/clang-move/Inputs/database_template.json === --- test/clang-move/Inputs/database_template.json +++ test/clang-move/Inputs/database_template.json @@ -1,7 +1,7 @@ [ { "directory": "$test_dir/build", - "command": "clang++ -o test.o $test_dir/test.cpp", + "command": "clang++ -o test.o -I../include $test_dir/test.cpp", "file": "$test_dir/test.cpp" } ] Index: test/CMakeLists.txt === --- test/CMakeLists.txt +++ test/CMakeLists.txt @@ -44,7 +44,6 @@ clang-apply-replacements clang-change-namespace clang-include-fixer - clang-move clang-query clang-rename clang-reorder-fields Index: clang-move/tool/ClangMoveMain.cpp === --- clang-move/tool/ClangMoveMain.cpp +++ clang-move/tool/ClangMoveMain.cpp @@ -17,15 +17,13 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Process.h" #include "llvm/Support/YAMLTraits.h" -#include "llvm/Support/Path.h" #include #include using namespace clang; using namespace llvm; namespace { - std::error_code CreateNewFile(const llvm::Twine &path) { int fd = 0; if (std::error_code ec = @@ -40,22 +38,19 @@ cl::opt Name("name", cl::desc("The name of class being moved."),
[PATCH] D24508: PR28752: Do not instantiate var decls which are not visible.
v.g.vassilev updated this revision to Diff 74353. v.g.vassilev marked 2 inline comments as done. v.g.vassilev added a comment. We should not access the IsThisDeclarationADemotedDefinition bits if the decl is ParmVarDecl. https://reviews.llvm.org/D24508 Files: include/clang/AST/Decl.h lib/AST/Decl.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaTemplate.cpp lib/Sema/SemaTemplateInstantiateDecl.cpp lib/Sema/SemaType.cpp lib/Serialization/ASTReaderDecl.cpp lib/Serialization/ASTWriterDecl.cpp test/Modules/Inputs/PR28752/Subdir1/b.h test/Modules/Inputs/PR28752/Subdir1/c.h test/Modules/Inputs/PR28752/Subdir1/module.modulemap test/Modules/Inputs/PR28752/a.h test/Modules/Inputs/PR28752/module.modulemap test/Modules/Inputs/PR28752/vector test/Modules/pr28752.cpp Index: test/Modules/pr28752.cpp === --- /dev/null +++ test/Modules/pr28752.cpp @@ -0,0 +1,19 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -std=c++11 -nostdsysteminc -I%S/Inputs/PR28752 -verify %s +// RUN: %clang_cc1 -std=c++11 -nostdsysteminc -fmodules -fmodule-map-file=%S/Inputs/PR28752/Subdir1/module.modulemap -fmodule-map-file=%S/Inputs/PR28752/module.modulemap -fmodules-cache-path=%t -I%S/Inputs/PR28752 -I%S/Inputs/PR28752/Subdir1 -verify %s + +#include "a.h" +#include "Subdir1/c.h" +#include + +class TClingClassInfo { + std::vector fIterStack; +}; + +TClingClassInfo *a; +class TClingBaseClassInfo { + TClingBaseClassInfo() { new TClingClassInfo(*a); } +}; + +// expected-no-diagnostics + Index: test/Modules/Inputs/PR28752/vector === --- /dev/null +++ test/Modules/Inputs/PR28752/vector @@ -0,0 +1,28 @@ +#ifndef VECTOR +#define VECTOR +template struct B; +template struct B { typedef _Tp type; }; +namespace std { +template struct D { + + template struct F { +static const bool value = 0; + }; + + template + typename B::value, _Alloc2>::type _S_select(_Alloc2); + template + static + typename B::value, _Alloc2>::type _S_select(_Alloc2); +}; +template +template +const bool D<_Alloc>::F<_Alloc2>::value; + +template class vector { +public: + vector(int); + vector(vector &) : vector(D::_S_select((bool)0)) {} +}; +} +#endif // VECTOR \ No newline at end of file Index: test/Modules/Inputs/PR28752/module.modulemap === --- /dev/null +++ test/Modules/Inputs/PR28752/module.modulemap @@ -0,0 +1 @@ +module a { header "a.h" export * } Index: test/Modules/Inputs/PR28752/a.h === --- /dev/null +++ test/Modules/Inputs/PR28752/a.h @@ -0,0 +1 @@ +#include Index: test/Modules/Inputs/PR28752/Subdir1/module.modulemap === --- /dev/null +++ test/Modules/Inputs/PR28752/Subdir1/module.modulemap @@ -0,0 +1,5 @@ +module b { + module "b.h" { header "b.h" export * } + module "c.h" { header "c.h" export * } + export * +} Index: test/Modules/Inputs/PR28752/Subdir1/b.h === --- /dev/null +++ test/Modules/Inputs/PR28752/Subdir1/b.h @@ -0,0 +1 @@ +#include Index: lib/Serialization/ASTWriterDecl.cpp === --- lib/Serialization/ASTWriterDecl.cpp +++ lib/Serialization/ASTWriterDecl.cpp @@ -894,6 +894,7 @@ Record.push_back(D->getTSCSpec()); Record.push_back(D->getInitStyle()); if (!isa(D)) { +Record.push_back(D->isThisDeclarationADemotedDefinition()); Record.push_back(D->isExceptionVariable()); Record.push_back(D->isNRVOVariable()); Record.push_back(D->isCXXForRangeDecl()); @@ -998,6 +999,8 @@ // Check things we know are true of *every* PARM_VAR_DECL, which is more than // just us assuming it. assert(!D->getTSCSpec() && "PARM_VAR_DECL can't use TLS"); + assert(!D->isThisDeclarationADemotedDefinition() + && "PARM_VAR_DECL can't be demoted definition."); assert(D->getAccess() == AS_none && "PARM_VAR_DECL can't be public/private"); assert(!D->isExceptionVariable() && "PARM_VAR_DECL can't be exception var"); assert(D->getPreviousDecl() == nullptr && "PARM_VAR_DECL can't be redecl"); @@ -1957,6 +1960,7 @@ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // SClass Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // TSCSpec Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // InitStyle + Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsThisDeclarationADemotedDefinition Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isExceptionVariable Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isNRVOVariable Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCXXForRangeDecl Index: lib/Serialization/ASTReaderDecl.cpp === --- lib/Serialization/
[PATCH] D25479: Guard flag –fdenormal-fp-math with –fno-fast-math
rengolin added inline comments. Comment at: test/Driver/denormal-fp-math.c:4 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s +// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-fast-math -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s // RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo -v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s Please add all tests that the change is covering. https://reviews.llvm.org/D25479 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r283999 - Remove usages of _ALIGNAS_TYPE
Author: ericwf Date: Wed Oct 12 05:19:48 2016 New Revision: 283999 URL: http://llvm.org/viewvc/llvm-project?rev=283999&view=rev Log: Remove usages of _ALIGNAS_TYPE Modified: libcxx/trunk/test/std/atomics/atomics.flag/default.pass.cpp libcxx/trunk/test/std/atomics/atomics.types.generic/address.pass.cpp libcxx/trunk/test/std/atomics/atomics.types.generic/bool.pass.cpp libcxx/trunk/test/std/atomics/atomics.types.generic/integral.pass.cpp libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp libcxx/trunk/test/support/test_macros.h Modified: libcxx/trunk/test/std/atomics/atomics.flag/default.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.flag/default.pass.cpp?rev=283999&r1=283998&r2=283999&view=diff == --- libcxx/trunk/test/std/atomics/atomics.flag/default.pass.cpp (original) +++ libcxx/trunk/test/std/atomics/atomics.flag/default.pass.cpp Wed Oct 12 05:19:48 2016 @@ -19,6 +19,8 @@ #include #include +#include "test_macros.h" + int main() { std::atomic_flag f; @@ -26,7 +28,7 @@ int main() assert(f.test_and_set() == 0); { typedef std::atomic_flag A; -_ALIGNAS_TYPE(A) char storage[sizeof(A)] = {1}; +TEST_ALIGNAS_TYPE(A) char storage[sizeof(A)] = {1}; A& zero = *new (storage) A(); assert(!zero.test_and_set()); zero.~A(); Modified: libcxx/trunk/test/std/atomics/atomics.types.generic/address.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.generic/address.pass.cpp?rev=283999&r1=283998&r2=283999&view=diff == --- libcxx/trunk/test/std/atomics/atomics.types.generic/address.pass.cpp (original) +++ libcxx/trunk/test/std/atomics/atomics.types.generic/address.pass.cpp Wed Oct 12 05:19:48 2016 @@ -75,6 +75,8 @@ #include +#include "test_macros.h" + template void do_test() @@ -121,7 +123,7 @@ do_test() assert(obj == T(2*sizeof(X))); { -_ALIGNAS_TYPE(A) char storage[sizeof(A)] = {23}; +TEST_ALIGNAS_TYPE(A) char storage[sizeof(A)] = {23}; A& zero = *new (storage) A(); assert(zero == T(0)); zero.~A(); Modified: libcxx/trunk/test/std/atomics/atomics.types.generic/bool.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.generic/bool.pass.cpp?rev=283999&r1=283998&r2=283999&view=diff == --- libcxx/trunk/test/std/atomics/atomics.types.generic/bool.pass.cpp (original) +++ libcxx/trunk/test/std/atomics/atomics.types.generic/bool.pass.cpp Wed Oct 12 05:19:48 2016 @@ -57,6 +57,8 @@ #include +#include "test_macros.h" + int main() { { @@ -226,7 +228,7 @@ int main() } { typedef std::atomic A; -_ALIGNAS_TYPE(A) char storage[sizeof(A)] = {1}; +TEST_ALIGNAS_TYPE(A) char storage[sizeof(A)] = {1}; A& zero = *new (storage) A(); assert(zero == false); zero.~A(); Modified: libcxx/trunk/test/std/atomics/atomics.types.generic/integral.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.generic/integral.pass.cpp?rev=283999&r1=283998&r2=283999&view=diff == --- libcxx/trunk/test/std/atomics/atomics.types.generic/integral.pass.cpp (original) +++ libcxx/trunk/test/std/atomics/atomics.types.generic/integral.pass.cpp Wed Oct 12 05:19:48 2016 @@ -92,6 +92,8 @@ #include +#include "test_macros.h" + template void do_test() @@ -151,7 +153,7 @@ do_test() assert(obj == T(8)); { -_ALIGNAS_TYPE(A) char storage[sizeof(A)] = {23}; +TEST_ALIGNAS_TYPE(A) char storage[sizeof(A)] = {23}; A& zero = *new (storage) A(); assert(zero == 0); zero.~A(); Modified: libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp?rev=283999&r1=283998&r2=283999&view=diff == --- libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp (original) +++ libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp Wed Oct 12 05:19:48 2016 @@ -18,12 +18,14 @@ #include #include +#include "test_macros.h" + class A { int data_; public: explicit A(int data) : data_(data) {} -virtual ~A() _NOEXCEPT {} +virtual ~A() TEST_NOEXCEPT {} friend bool operator==(const A& x, const A& y) {return x.data_ == y.data_;} }; Mo
[libcxx] r284002 - Remove usages of _LIBCPP_CONSTEXPR under test/std
Author: ericwf Date: Wed Oct 12 05:28:09 2016 New Revision: 284002 URL: http://llvm.org/viewvc/llvm-project?rev=284002&view=rev Log: Remove usages of _LIBCPP_CONSTEXPR under test/std Modified: libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/eval.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/result_type.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/eval.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/result_type.pass.cpp libcxx/trunk/test/std/utilities/time/rep.h Modified: libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/eval.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/eval.pass.cpp?rev=284002&r1=284001&r2=284002&view=diff == --- libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/eval.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/eval.pass.cpp Wed Oct 12 05:28:09 2016 @@ -17,6 +17,8 @@ #include #include +#include "test_macros.h" + template class rand1 { @@ -30,14 +32,14 @@ private: static_assert(Min < Max, "rand1 invalid parameters"); public: -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER < 11 && defined(_LIBCPP_VERSION) // Workaround for lack of constexpr in C++03 static const result_type _Min = Min; static const result_type _Max = Max; #endif -static _LIBCPP_CONSTEXPR result_type min() {return Min;} -static _LIBCPP_CONSTEXPR result_type max() {return Max;} +static TEST_CONSTEXPR result_type min() {return Min;} +static TEST_CONSTEXPR result_type max() {return Max;} explicit rand1(result_type sd = Min) : x_(sd) { Modified: libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/result_type.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/result_type.pass.cpp?rev=284002&r1=284001&r2=284002&view=diff == --- libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/result_type.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/result_type.pass.cpp Wed Oct 12 05:28:09 2016 @@ -19,6 +19,8 @@ #include #include +#include "test_macros.h" + template class rand1 { @@ -32,14 +34,14 @@ private: static_assert(Min < Max, "rand1 invalid parameters"); public: -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER < 11 && defined(_LIBCPP_VERSION) // Workaround for lack of constexpr in C++03 static const result_type _Min = Min; static const result_type _Max = Max; #endif -static _LIBCPP_CONSTEXPR result_type min() {return Min;} -static _LIBCPP_CONSTEXPR result_type max() {return Max;} +static TEST_CONSTEXPR result_type min() {return Min;} +static TEST_CONSTEXPR result_type max() {return Max;} explicit rand1(result_type sd = Min) : x_(sd) { Modified: libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/eval.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/eval.pass.cpp?rev=284002&r1=284001&r2=284002&view=diff == --- libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/eval.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/eval.pass.cpp Wed Oct 12 05:28:09 2016 @@ -17,6 +17,8 @@ #include #include +#include "test_macros.h" + template class rand1 { @@ -30,14 +32,14 @@ private: static_assert(Min < Max, "rand1 invalid parameters"); public: -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER < 11 && defined(_LIBCPP_VERSION) // Workaround for lack of constexpr in C++03 static const result_type _Min = Min; static const result_type _Max = Max; #endif -static _LIBCPP_CONSTEXPR result_type min() {return Min;} -static _LIBCPP_CONSTEXPR result_type max() {return Max;} +static TEST_CONSTEXPR result_type min() {return Min;} +static TEST_CONSTEXPR result_type max() {return Max;} explicit rand1(result_type sd = Min) : x_(sd) { Modified: libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/result_type.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/result_type.pass.cpp?rev=284002&r1=284001&r2=284002&view=diff == --- libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/result_type.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/result_type.pass.cpp Wed Oct 12 05:28:09 2016 @@ -19,6 +19,8 @@ #include #include +#include
[libcxx] r284004 - Unbreak C++03 build
Author: ericwf Date: Wed Oct 12 06:20:27 2016 New Revision: 284004 URL: http://llvm.org/viewvc/llvm-project?rev=284004&view=rev Log: Unbreak C++03 build Modified: libcxx/trunk/test/support/test_macros.h Modified: libcxx/trunk/test/support/test_macros.h URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_macros.h?rev=284004&r1=284003&r2=284004&view=diff == --- libcxx/trunk/test/support/test_macros.h (original) +++ libcxx/trunk/test/support/test_macros.h Wed Oct 12 06:20:27 2016 @@ -99,7 +99,7 @@ #else #define TEST_CONSTEXPR #define TEST_CONSTEXPR_CXX14 -#define TEST_NOEXCEPT +#define TEST_NOEXCEPT throw() #define TEST_NOEXCEPT_COND(...) #define TEST_ALIGNOF(...) __alignof(__VA_ARGS__) #define TEST_ALIGNAS(...) __attribute__((__aligned__(__VA_ARGS__))) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r284005 - Remove incorrect XFAILS
Author: ericwf Date: Wed Oct 12 06:29:18 2016 New Revision: 284005 URL: http://llvm.org/viewvc/llvm-project?rev=284005&view=rev Log: Remove incorrect XFAILS Modified: libcxx/trunk/test/libcxx/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp libcxx/trunk/test/libcxx/utilities/optional/optional.object/optional.object.assign/move.pass.cpp libcxx/trunk/test/libcxx/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp libcxx/trunk/test/libcxx/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp Modified: libcxx/trunk/test/libcxx/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp?rev=284005&r1=284004&r2=284005&view=diff == --- libcxx/trunk/test/libcxx/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp (original) +++ libcxx/trunk/test/libcxx/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp Wed Oct 12 06:29:18 2016 @@ -8,7 +8,6 @@ //===--===// // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: libcpp-no-exceptions // // optional& operator=(const optional& rhs); @@ -45,7 +44,6 @@ struct Z2 Z2& operator=(const Z2&) = default; }; -#if __cplusplus >= 201402 template constexpr bool test() @@ -55,23 +53,18 @@ test() opt = opt2; return true; } -#endif int main() { { using T = int; static_assert((std::is_trivially_copy_assignable>::value), ""); -#if __cplusplus >= 201402 static_assert(test(), ""); -#endif } { using T = X; static_assert((std::is_trivially_copy_assignable>::value), ""); -#if __cplusplus >= 201402 static_assert(test(), ""); -#endif } static_assert(!(std::is_trivially_copy_assignable>::value), ""); static_assert(!(std::is_trivially_copy_assignable>::value), ""); Modified: libcxx/trunk/test/libcxx/utilities/optional/optional.object/optional.object.assign/move.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/optional/optional.object/optional.object.assign/move.pass.cpp?rev=284005&r1=284004&r2=284005&view=diff == --- libcxx/trunk/test/libcxx/utilities/optional/optional.object/optional.object.assign/move.pass.cpp (original) +++ libcxx/trunk/test/libcxx/utilities/optional/optional.object/optional.object.assign/move.pass.cpp Wed Oct 12 06:29:18 2016 @@ -8,7 +8,6 @@ //===--===// // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: libcpp-no-exceptions // // optional& operator=(optional&& rhs); @@ -42,7 +41,6 @@ struct Z2 Z2& operator=(Z2&&) = default; }; -#if __cplusplus >= 201402 template constexpr bool test() @@ -52,23 +50,18 @@ test() opt = std::move(opt2); return true; } -#endif int main() { { using T = int; static_assert((std::is_trivially_copy_constructible>::value), ""); -#if __cplusplus >= 201402 static_assert(test(), ""); -#endif } { using T = X; static_assert((std::is_trivially_copy_constructible>::value), ""); -#if __cplusplus >= 201402 static_assert(test(), ""); -#endif } static_assert(!(std::is_trivially_move_assignable>::value), ""); static_assert(!(std::is_trivially_move_assignable>::value), ""); Modified: libcxx/trunk/test/libcxx/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp?rev=284005&r1=284004&r2=284005&view=diff == --- libcxx/trunk/test/libcxx/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp (original) +++ libcxx/trunk/test/libcxx/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp Wed Oct 12 06:29:18 2016 @@ -8,7 +8,7 @@ //===--===// // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: libcpp-no-exceptions + // // optional(const optional& rhs); Modified: libcxx/trunk/test/libcxx/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp?rev=284005&r1=284004&r2=284005&view=diff == --- libcxx/trunk/test/libcxx/utilities/optional/optional.object/optional.object.cto
Re: [libcxx] r284005 - Remove incorrect XFAILS
Thanks! I still have that no-exception cleanup in my TODO list. Just pressed on time, hope to get to it soon. / Asiri On Wed, Oct 12, 2016 at 12:29 PM, Eric Fiselier via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: ericwf > Date: Wed Oct 12 06:29:18 2016 > New Revision: 284005 > > URL: http://llvm.org/viewvc/llvm-project?rev=284005&view=rev > Log: > Remove incorrect XFAILS > > Modified: > libcxx/trunk/test/libcxx/utilities/optional/optional. > object/optional.object.assign/copy.pass.cpp > libcxx/trunk/test/libcxx/utilities/optional/optional. > object/optional.object.assign/move.pass.cpp > libcxx/trunk/test/libcxx/utilities/optional/optional. > object/optional.object.ctor/copy.pass.cpp > libcxx/trunk/test/libcxx/utilities/optional/optional. > object/optional.object.ctor/move.pass.cpp > > Modified: libcxx/trunk/test/libcxx/utilities/optional/optional. > object/optional.object.assign/copy.pass.cpp > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/ > libcxx/utilities/optional/optional.object/optional. > object.assign/copy.pass.cpp?rev=284005&r1=284004&r2=284005&view=diff > > == > --- libcxx/trunk/test/libcxx/utilities/optional/optional. > object/optional.object.assign/copy.pass.cpp (original) > +++ libcxx/trunk/test/libcxx/utilities/optional/optional. > object/optional.object.assign/copy.pass.cpp Wed Oct 12 06:29:18 2016 > @@ -8,7 +8,6 @@ > //===--- > ---===// > > // UNSUPPORTED: c++98, c++03, c++11, c++14 > -// XFAIL: libcpp-no-exceptions > // > > // optional& operator=(const optional& rhs); > @@ -45,7 +44,6 @@ struct Z2 > Z2& operator=(const Z2&) = default; > }; > > -#if __cplusplus >= 201402 > template > constexpr bool > test() > @@ -55,23 +53,18 @@ test() > opt = opt2; > return true; > } > -#endif > > int main() > { > { > using T = int; > > static_assert((std::is_trivially_copy_assignable>::value), > ""); > -#if __cplusplus >= 201402 > static_assert(test(), ""); > -#endif > } > { > using T = X; > > static_assert((std::is_trivially_copy_assignable>::value), > ""); > -#if __cplusplus >= 201402 > static_assert(test(), ""); > -#endif > } > static_assert(!(std::is_trivially_copy_assignable>::value), > ""); > static_assert(!(std::is_trivially_copy_assignable< > optional>::value), ""); > > Modified: libcxx/trunk/test/libcxx/utilities/optional/optional. > object/optional.object.assign/move.pass.cpp > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/ > libcxx/utilities/optional/optional.object/optional. > object.assign/move.pass.cpp?rev=284005&r1=284004&r2=284005&view=diff > > == > --- libcxx/trunk/test/libcxx/utilities/optional/optional. > object/optional.object.assign/move.pass.cpp (original) > +++ libcxx/trunk/test/libcxx/utilities/optional/optional. > object/optional.object.assign/move.pass.cpp Wed Oct 12 06:29:18 2016 > @@ -8,7 +8,6 @@ > //===--- > ---===// > > // UNSUPPORTED: c++98, c++03, c++11, c++14 > -// XFAIL: libcpp-no-exceptions > // > > // optional& operator=(optional&& rhs); > @@ -42,7 +41,6 @@ struct Z2 > Z2& operator=(Z2&&) = default; > }; > > -#if __cplusplus >= 201402 > template > constexpr bool > test() > @@ -52,23 +50,18 @@ test() > opt = std::move(opt2); > return true; > } > -#endif > > int main() > { > { > using T = int; > > static_assert((std::is_trivially_copy_constructible>::value), > ""); > -#if __cplusplus >= 201402 > static_assert(test(), ""); > -#endif > } > { > using T = X; > > static_assert((std::is_trivially_copy_constructible>::value), > ""); > -#if __cplusplus >= 201402 > static_assert(test(), ""); > -#endif > } > static_assert(!(std::is_trivially_move_assignable>::value), > ""); > static_assert(!(std::is_trivially_move_assignable< > optional>::value), ""); > > Modified: libcxx/trunk/test/libcxx/utilities/optional/optional. > object/optional.object.ctor/copy.pass.cpp > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/ > libcxx/utilities/optional/optional.object/optional. > object.ctor/copy.pass.cpp?rev=284005&r1=284004&r2=284005&view=diff > > == > --- libcxx/trunk/test/libcxx/utilities/optional/optional. > object/optional.object.ctor/copy.pass.cpp (original) > +++ libcxx/trunk/test/libcxx/utilities/optional/optional. > object/optional.object.ctor/copy.pass.cpp Wed Oct 12 06:29:18 2016 > @@ -8,7 +8,7 @@ > //===--- > ---===// > > // UNSUPPORTED: c++98, c++03, c++11, c++14 > -//
[libcxx] r284006 - Correctly grant rebound limited_allocators friendship.
Author: ericwf Date: Wed Oct 12 06:35:37 2016 New Revision: 284006 URL: http://llvm.org/viewvc/llvm-project?rev=284006&view=rev Log: Correctly grant rebound limited_allocators friendship. Modified: libcxx/trunk/test/support/test_allocator.h Modified: libcxx/trunk/test/support/test_allocator.h URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_allocator.h?rev=284006&r1=284005&r2=284006&view=diff == --- libcxx/trunk/test/support/test_allocator.h (original) +++ libcxx/trunk/test/support/test_allocator.h Wed Oct 12 06:35:37 2016 @@ -332,6 +332,7 @@ struct limited_alloc_handle { template class limited_allocator { +template friend class limited_allocator; typedef limited_alloc_handle BuffT; std::shared_ptr handle_; public: ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284007 - [CodeCompletion] Show protocol properties that are accessed through qualified id
Author: arphaman Date: Wed Oct 12 06:40:15 2016 New Revision: 284007 URL: http://llvm.org/viewvc/llvm-project?rev=284007&view=rev Log: [CodeCompletion] Show protocol properties that are accessed through qualified id This commit improves code completion for properties that are declared in Objective-C protocols by making sure that properties show up in completions when they are accessed through a qualified id. rdar://24426041 Differential Revision: https://reviews.llvm.org/D25436 Added: cfe/trunk/test/CodeCompletion/objc-protocol-member-access.m Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=284007&r1=284006&r2=284007&view=diff == --- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original) +++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Wed Oct 12 06:40:15 2016 @@ -3720,20 +3720,21 @@ void Sema::CodeCompleteMemberReferenceEx Results.AddResult(Result("template")); } } - } else if (!IsArrow && BaseType->getAsObjCInterfacePointerType()) { + } else if (!IsArrow && BaseType->isObjCObjectPointerType()) { // Objective-C property reference. AddedPropertiesSet AddedProperties; - -// Add property results based on our interface. -const ObjCObjectPointerType *ObjCPtr - = BaseType->getAsObjCInterfacePointerType(); -assert(ObjCPtr && "Non-NULL pointer guaranteed above!"); -AddObjCProperties(CCContext, ObjCPtr->getInterfaceDecl(), true, - /*AllowNullaryMethods=*/true, CurContext, - AddedProperties, Results); - + +if (const ObjCObjectPointerType *ObjCPtr = +BaseType->getAsObjCInterfacePointerType()) { + // Add property results based on our interface. + assert(ObjCPtr && "Non-NULL pointer guaranteed above!"); + AddObjCProperties(CCContext, ObjCPtr->getInterfaceDecl(), true, +/*AllowNullaryMethods=*/true, CurContext, +AddedProperties, Results); +} + // Add properties from the protocols in a qualified interface. -for (auto *I : ObjCPtr->quals()) +for (auto *I : BaseType->getAs()->quals()) AddObjCProperties(CCContext, I, true, /*AllowNullaryMethods=*/true, CurContext, AddedProperties, Results); } else if ((IsArrow && BaseType->isObjCObjectPointerType()) || Added: cfe/trunk/test/CodeCompletion/objc-protocol-member-access.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompletion/objc-protocol-member-access.m?rev=284007&view=auto == --- cfe/trunk/test/CodeCompletion/objc-protocol-member-access.m (added) +++ cfe/trunk/test/CodeCompletion/objc-protocol-member-access.m Wed Oct 12 06:40:15 2016 @@ -0,0 +1,24 @@ +// Note: the run lines follow their respective tests, since line/column +// matter in this test. + +@protocol Bar +@property (readonly) int bar; +@end + +@protocol Foo + +@property (nonatomic, readonly) int foo; +- (void)foobar: (int)x; + +@end + +int getFoo(id object) { + id modelObject = (id)object; + int foo = modelObject.; + return foo; +} + +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:17:25 %s -o - | FileCheck %s +// CHECK: bar : [#int#]bar +// CHECK: foo : [#int#]foo +// CHECK-NOT: foobar ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r284005 - Remove incorrect XFAILS
I just committed those tests, so I kinda had to fix them :-P On Wed, Oct 12, 2016 at 5:40 AM, Asiri Rathnayake < asiri.rathnay...@gmail.com> wrote: > Thanks! > > I still have that no-exception cleanup in my TODO list. Just pressed on > time, hope to get to it soon. > > / Asiri > > On Wed, Oct 12, 2016 at 12:29 PM, Eric Fiselier via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> Author: ericwf >> Date: Wed Oct 12 06:29:18 2016 >> New Revision: 284005 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=284005&view=rev >> Log: >> Remove incorrect XFAILS >> >> Modified: >> libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >> optional.object.assign/copy.pass.cpp >> libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >> optional.object.assign/move.pass.cpp >> libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >> optional.object.ctor/copy.pass.cpp >> libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >> optional.object.ctor/move.pass.cpp >> >> Modified: libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >> optional.object.assign/copy.pass.cpp >> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx >> /utilities/optional/optional.object/optional.object.assign/ >> copy.pass.cpp?rev=284005&r1=284004&r2=284005&view=diff >> >> == >> --- libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >> optional.object.assign/copy.pass.cpp (original) >> +++ libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >> optional.object.assign/copy.pass.cpp Wed Oct 12 06:29:18 2016 >> @@ -8,7 +8,6 @@ >> //===-- >> ===// >> >> // UNSUPPORTED: c++98, c++03, c++11, c++14 >> -// XFAIL: libcpp-no-exceptions >> // >> >> // optional& operator=(const optional& rhs); >> @@ -45,7 +44,6 @@ struct Z2 >> Z2& operator=(const Z2&) = default; >> }; >> >> -#if __cplusplus >= 201402 >> template >> constexpr bool >> test() >> @@ -55,23 +53,18 @@ test() >> opt = opt2; >> return true; >> } >> -#endif >> >> int main() >> { >> { >> using T = int; >> >> static_assert((std::is_trivially_copy_assignable>::value), >> ""); >> -#if __cplusplus >= 201402 >> static_assert(test(), ""); >> -#endif >> } >> { >> using T = X; >> >> static_assert((std::is_trivially_copy_assignable>::value), >> ""); >> -#if __cplusplus >= 201402 >> static_assert(test(), ""); >> -#endif >> } >> static_assert(!(std::is_trivially_copy_assignable>::value), >> ""); >> >> static_assert(!(std::is_trivially_copy_assignable>::value), >> ""); >> >> Modified: libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >> optional.object.assign/move.pass.cpp >> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx >> /utilities/optional/optional.object/optional.object.assign/ >> move.pass.cpp?rev=284005&r1=284004&r2=284005&view=diff >> >> == >> --- libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >> optional.object.assign/move.pass.cpp (original) >> +++ libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >> optional.object.assign/move.pass.cpp Wed Oct 12 06:29:18 2016 >> @@ -8,7 +8,6 @@ >> //===-- >> ===// >> >> // UNSUPPORTED: c++98, c++03, c++11, c++14 >> -// XFAIL: libcpp-no-exceptions >> // >> >> // optional& operator=(optional&& rhs); >> @@ -42,7 +41,6 @@ struct Z2 >> Z2& operator=(Z2&&) = default; >> }; >> >> -#if __cplusplus >= 201402 >> template >> constexpr bool >> test() >> @@ -52,23 +50,18 @@ test() >> opt = std::move(opt2); >> return true; >> } >> -#endif >> >> int main() >> { >> { >> using T = int; >> >> static_assert((std::is_trivially_copy_constructible>::value), >> ""); >> -#if __cplusplus >= 201402 >> static_assert(test(), ""); >> -#endif >> } >> { >> using T = X; >> >> static_assert((std::is_trivially_copy_constructible>::value), >> ""); >> -#if __cplusplus >= 201402 >> static_assert(test(), ""); >> -#endif >> } >> static_assert(!(std::is_trivially_move_assignable>::value), >> ""); >> >> static_assert(!(std::is_trivially_move_assignable>::value), >> ""); >> >> Modified: libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >> optional.object.ctor/copy.pass.cpp >> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx >> /utilities/optional/optional.object/optional.object.ctor/ >> copy.pass.cpp?rev=284005&r1=284004&r2=284005&view=diff >> >> == >> --- libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >> optional.object.ctor/copy.pass.cpp
Re: [libcxx] r284005 - Remove incorrect XFAILS
More love for no-exceptions in any case ;) Cheers! On Wed, Oct 12, 2016 at 12:52 PM, Eric Fiselier wrote: > I just committed those tests, so I kinda had to fix them :-P > > On Wed, Oct 12, 2016 at 5:40 AM, Asiri Rathnayake < > asiri.rathnay...@gmail.com> wrote: > >> Thanks! >> >> I still have that no-exception cleanup in my TODO list. Just pressed on >> time, hope to get to it soon. >> >> / Asiri >> >> On Wed, Oct 12, 2016 at 12:29 PM, Eric Fiselier via cfe-commits < >> cfe-commits@lists.llvm.org> wrote: >> >>> Author: ericwf >>> Date: Wed Oct 12 06:29:18 2016 >>> New Revision: 284005 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=284005&view=rev >>> Log: >>> Remove incorrect XFAILS >>> >>> Modified: >>> libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >>> optional.object.assign/copy.pass.cpp >>> libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >>> optional.object.assign/move.pass.cpp >>> libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >>> optional.object.ctor/copy.pass.cpp >>> libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >>> optional.object.ctor/move.pass.cpp >>> >>> Modified: libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >>> optional.object.assign/copy.pass.cpp >>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx >>> /utilities/optional/optional.object/optional.object.assign/c >>> opy.pass.cpp?rev=284005&r1=284004&r2=284005&view=diff >>> >>> == >>> --- libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >>> optional.object.assign/copy.pass.cpp (original) >>> +++ libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >>> optional.object.assign/copy.pass.cpp Wed Oct 12 06:29:18 2016 >>> @@ -8,7 +8,6 @@ >>> //===-- >>> ===// >>> >>> // UNSUPPORTED: c++98, c++03, c++11, c++14 >>> -// XFAIL: libcpp-no-exceptions >>> // >>> >>> // optional& operator=(const optional& rhs); >>> @@ -45,7 +44,6 @@ struct Z2 >>> Z2& operator=(const Z2&) = default; >>> }; >>> >>> -#if __cplusplus >= 201402 >>> template >>> constexpr bool >>> test() >>> @@ -55,23 +53,18 @@ test() >>> opt = opt2; >>> return true; >>> } >>> -#endif >>> >>> int main() >>> { >>> { >>> using T = int; >>> >>> static_assert((std::is_trivially_copy_assignable>::value), >>> ""); >>> -#if __cplusplus >= 201402 >>> static_assert(test(), ""); >>> -#endif >>> } >>> { >>> using T = X; >>> >>> static_assert((std::is_trivially_copy_assignable>::value), >>> ""); >>> -#if __cplusplus >= 201402 >>> static_assert(test(), ""); >>> -#endif >>> } >>> static_assert(!(std::is_trivially_copy_assignable>::value), >>> ""); >>> >>> static_assert(!(std::is_trivially_copy_assignable>::value), >>> ""); >>> >>> Modified: libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >>> optional.object.assign/move.pass.cpp >>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx >>> /utilities/optional/optional.object/optional.object.assign/m >>> ove.pass.cpp?rev=284005&r1=284004&r2=284005&view=diff >>> >>> == >>> --- libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >>> optional.object.assign/move.pass.cpp (original) >>> +++ libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >>> optional.object.assign/move.pass.cpp Wed Oct 12 06:29:18 2016 >>> @@ -8,7 +8,6 @@ >>> //===-- >>> ===// >>> >>> // UNSUPPORTED: c++98, c++03, c++11, c++14 >>> -// XFAIL: libcpp-no-exceptions >>> // >>> >>> // optional& operator=(optional&& rhs); >>> @@ -42,7 +41,6 @@ struct Z2 >>> Z2& operator=(Z2&&) = default; >>> }; >>> >>> -#if __cplusplus >= 201402 >>> template >>> constexpr bool >>> test() >>> @@ -52,23 +50,18 @@ test() >>> opt = std::move(opt2); >>> return true; >>> } >>> -#endif >>> >>> int main() >>> { >>> { >>> using T = int; >>> >>> static_assert((std::is_trivially_copy_constructible>::value), >>> ""); >>> -#if __cplusplus >= 201402 >>> static_assert(test(), ""); >>> -#endif >>> } >>> { >>> using T = X; >>> >>> static_assert((std::is_trivially_copy_constructible>::value), >>> ""); >>> -#if __cplusplus >= 201402 >>> static_assert(test(), ""); >>> -#endif >>> } >>> static_assert(!(std::is_trivially_move_assignable>::value), >>> ""); >>> >>> static_assert(!(std::is_trivially_move_assignable>::value), >>> ""); >>> >>> Modified: libcxx/trunk/test/libcxx/utilities/optional/optional.object/ >>> optional.object.ctor/copy.pass.cpp >>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx >>> /utilities/optional/optional.object/op
[PATCH] D24656: [clang-tidy] Add check readability-redundant-declaration
aaron.ballman added inline comments. Comment at: clang-tidy/readability/RedundantDeclarationCheck.cpp:60 +auto Diag = diag(D->getLocation(), "redundant '%0' declaration") +<< cast(D)->getName(); +if (!MultiVar && !DifferentHeaders) danielmarjamaki wrote: > alexfh wrote: > > It should be possible to just use `D` here. > Thanks. It's not possible: > > ``` > RedundantDeclarationCheck.cpp:61:15: error: ‘const class clang::Decl’ has no > member named ‘getName’ > << D->getName(); >^ > ``` > `diag(...) << cast(D)` is required; the diagnostic engine properly handles quoting `NamedDecl` objects. https://reviews.llvm.org/D24656 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284008 - Reinstate r283887 and r283882.
Author: vvassilev Date: Wed Oct 12 06:57:08 2016 New Revision: 284008 URL: http://llvm.org/viewvc/llvm-project?rev=284008&view=rev Log: Reinstate r283887 and r283882. Original message: "[modules] PR28752: Do not instantiate variable declarations which are not visible. https://reviews.llvm.org/D24508 Patch developed in collaboration with Richard Smith!" Added: cfe/trunk/test/Modules/Inputs/PR28752/ cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/ cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/b.h cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/c.h cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/module.modulemap cfe/trunk/test/Modules/Inputs/PR28752/a.h cfe/trunk/test/Modules/Inputs/PR28752/module.modulemap cfe/trunk/test/Modules/Inputs/PR28752/vector cfe/trunk/test/Modules/pr28752.cpp Modified: cfe/trunk/include/clang/AST/Decl.h cfe/trunk/lib/AST/Decl.cpp cfe/trunk/lib/Sema/SemaDecl.cpp cfe/trunk/lib/Sema/SemaTemplate.cpp cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp cfe/trunk/lib/Sema/SemaType.cpp cfe/trunk/lib/Serialization/ASTReaderDecl.cpp cfe/trunk/lib/Serialization/ASTWriterDecl.cpp Modified: cfe/trunk/include/clang/AST/Decl.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=284008&r1=284007&r2=284008&view=diff == --- cfe/trunk/include/clang/AST/Decl.h (original) +++ cfe/trunk/include/clang/AST/Decl.h Wed Oct 12 06:57:08 2016 @@ -865,6 +865,11 @@ protected: unsigned : NumVarDeclBits; +// FIXME: We need something similar to CXXRecordDecl::DefinitionData. +/// \brief Whether this variable is a definition which was demoted due to +/// module merge. +unsigned IsThisDeclarationADemotedDefinition : 1; + /// \brief Whether this variable is the exception variable in a C++ catch /// or an Objective-C @catch statement. unsigned ExceptionVar : 1; @@ -1198,12 +1203,28 @@ public: InitializationStyle getInitStyle() const { return static_cast(VarDeclBits.InitStyle); } - /// \brief Whether the initializer is a direct-initializer (list or call). bool isDirectInit() const { return getInitStyle() != CInit; } + /// \brief If this definition should pretend to be a declaration. + bool isThisDeclarationADemotedDefinition() const { +return isa(this) ? false : + NonParmVarDeclBits.IsThisDeclarationADemotedDefinition; + } + + /// \brief This is a definition which should be demoted to a declaration. + /// + /// In some cases (mostly module merging) we can end up with two visible + /// definitions one of which needs to be demoted to a declaration to keep + /// the AST invariants. + void demoteThisDefinitionToDeclaration() { +assert (isThisDeclarationADefinition() && "Not a definition!"); +assert (!isa(this) && "Cannot demote ParmVarDecls!"); +NonParmVarDeclBits.IsThisDeclarationADemotedDefinition = 1; + } + /// \brief Determine whether this variable is the exception variable in a /// C++ catch statememt or an Objective-C \@catch statement. bool isExceptionVariable() const { @@ -1302,6 +1323,10 @@ public: NonParmVarDeclBits.PreviousDeclInSameBlockScope = Same; } + /// \brief Retrieve the variable declaration from which this variable could + /// be instantiated, if it is an instantiation (rather than a non-template). + VarDecl *getTemplateInstantiationPattern() const; + /// \brief If this variable is an instantiated static data member of a /// class template specialization, returns the templated static data member /// from which it was instantiated. Modified: cfe/trunk/lib/AST/Decl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=284008&r1=284007&r2=284008&view=diff == --- cfe/trunk/lib/AST/Decl.cpp (original) +++ cfe/trunk/lib/AST/Decl.cpp Wed Oct 12 06:57:08 2016 @@ -1926,6 +1926,9 @@ VarDecl::isThisDeclarationADefinition(AS // // FIXME: How do you declare (but not define) a partial specialization of // a static data member template outside the containing class? + if (isThisDeclarationADemotedDefinition()) +return DeclarationOnly; + if (isStaticDataMember()) { if (isOutOfLine() && !(getCanonicalDecl()->isInline() && @@ -2250,6 +2253,56 @@ bool VarDecl::checkInitIsICE() const { return Eval->IsICE; } +VarDecl *VarDecl::getTemplateInstantiationPattern() const { + // If it's a variable template specialization, find the template or partial + // specialization from which it was instantiated. + if (auto *VDTemplSpec = dyn_cast(this)) { +auto From = VDTemplSpec->getInstantiatedFrom(); +if (auto *VTD = From.dyn_cast()) { + while (auto *NewVTD = VTD->getInstantiatedFromMemberTemplate()) { +if (NewVTD->isMemberSpecialization()) + break; +VTD = NewVTD; +
[PATCH] D25479: Guard flag –fdenormal-fp-math with –fno-fast-math
SjoerdMeijer updated this revision to Diff 74363. SjoerdMeijer added a comment. Thanks for catching this: the logic and test have been updated. https://reviews.llvm.org/D25479 Files: lib/Driver/Tools.cpp test/Driver/denormal-fp-math.c Index: test/Driver/denormal-fp-math.c === --- test/Driver/denormal-fp-math.c +++ test/Driver/denormal-fp-math.c @@ -1,9 +1,12 @@ // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -v 2>&1 | FileCheck -check-prefix=CHECK-IEEE %s // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=preserve-sign -v 2>&1 | FileCheck -check-prefix=CHECK-PS %s // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s +// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-fast-math -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s +// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-unsafe-math-optimizations -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s // RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo -v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s // CHECK-IEEE: "-fdenormal-fp-math=ieee" // CHECK-PS: "-fdenormal-fp-math=preserve-sign" // CHECK-PZ: "-fdenormal-fp-math=positive-zero" +// CHECK-NO-UNSAFE-NOT: "-fdenormal-fp-math=ieee" // CHECK-INVALID: error: invalid value 'foo' in '-fdenormal-fp-math=foo' Index: lib/Driver/Tools.cpp === --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -4390,11 +4390,18 @@ if (ReciprocalMath) CmdArgs.push_back("-freciprocal-math"); - if (!TrappingMath) + if (!TrappingMath) CmdArgs.push_back("-fno-trapping-math"); - if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ)) -Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ); + + if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption, + options::OPT_fno_fast_math, + options::OPT_funsafe_math_optimizations, + options::OPT_fno_unsafe_math_optimizations, + options::OPT_fdenormal_fp_math_EQ)) +if (A->getOption().getID() != options::OPT_fno_fast_math && +A->getOption().getID() != options::OPT_fno_unsafe_math_optimizations) + Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ); // Validate and pass through -fp-contract option. if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption, Index: test/Driver/denormal-fp-math.c === --- test/Driver/denormal-fp-math.c +++ test/Driver/denormal-fp-math.c @@ -1,9 +1,12 @@ // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -v 2>&1 | FileCheck -check-prefix=CHECK-IEEE %s // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=preserve-sign -v 2>&1 | FileCheck -check-prefix=CHECK-PS %s // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s +// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-fast-math -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s +// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-unsafe-math-optimizations -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s // RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo -v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s // CHECK-IEEE: "-fdenormal-fp-math=ieee" // CHECK-PS: "-fdenormal-fp-math=preserve-sign" // CHECK-PZ: "-fdenormal-fp-math=positive-zero" +// CHECK-NO-UNSAFE-NOT: "-fdenormal-fp-math=ieee" // CHECK-INVALID: error: invalid value 'foo' in '-fdenormal-fp-math=foo' Index: lib/Driver/Tools.cpp === --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -4390,11 +4390,18 @@ if (ReciprocalMath) CmdArgs.push_back("-freciprocal-math"); - if (!TrappingMath) + if (!TrappingMath) CmdArgs.push_back("-fno-trapping-math"); - if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ)) -Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ); + + if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption, + options::OPT_fno_fast_math, + options::OPT_funsafe_math_optimizations, + options::OPT_fno_unsafe_math_optimizations, + options::OPT_fdenormal_fp_math_EQ)) +if (A->getOption().getID() != options::OPT_fno_fast_math && +A->getOption().getID() != options::OPT_fno_unsafe_math_optimizations) + Args.AddLastArg(
[PATCH] D25436: [CodeCompletion] Improve completion for properties declared in Objective-C protocols
This revision was automatically updated to reflect the committed changes. Closed by commit rL284007: [CodeCompletion] Show protocol properties that are accessed through qualified id (authored by arphaman). Changed prior to commit: https://reviews.llvm.org/D25436?vs=74227&id=74364#toc Repository: rL LLVM https://reviews.llvm.org/D25436 Files: cfe/trunk/lib/Sema/SemaCodeComplete.cpp cfe/trunk/test/CodeCompletion/objc-protocol-member-access.m Index: cfe/trunk/test/CodeCompletion/objc-protocol-member-access.m === --- cfe/trunk/test/CodeCompletion/objc-protocol-member-access.m +++ cfe/trunk/test/CodeCompletion/objc-protocol-member-access.m @@ -0,0 +1,24 @@ +// Note: the run lines follow their respective tests, since line/column +// matter in this test. + +@protocol Bar +@property (readonly) int bar; +@end + +@protocol Foo + +@property (nonatomic, readonly) int foo; +- (void)foobar: (int)x; + +@end + +int getFoo(id object) { + id modelObject = (id)object; + int foo = modelObject.; + return foo; +} + +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:17:25 %s -o - | FileCheck %s +// CHECK: bar : [#int#]bar +// CHECK: foo : [#int#]foo +// CHECK-NOT: foobar Index: cfe/trunk/lib/Sema/SemaCodeComplete.cpp === --- cfe/trunk/lib/Sema/SemaCodeComplete.cpp +++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp @@ -3720,20 +3720,21 @@ Results.AddResult(Result("template")); } } - } else if (!IsArrow && BaseType->getAsObjCInterfacePointerType()) { + } else if (!IsArrow && BaseType->isObjCObjectPointerType()) { // Objective-C property reference. AddedPropertiesSet AddedProperties; - -// Add property results based on our interface. -const ObjCObjectPointerType *ObjCPtr - = BaseType->getAsObjCInterfacePointerType(); -assert(ObjCPtr && "Non-NULL pointer guaranteed above!"); -AddObjCProperties(CCContext, ObjCPtr->getInterfaceDecl(), true, - /*AllowNullaryMethods=*/true, CurContext, - AddedProperties, Results); - + +if (const ObjCObjectPointerType *ObjCPtr = +BaseType->getAsObjCInterfacePointerType()) { + // Add property results based on our interface. + assert(ObjCPtr && "Non-NULL pointer guaranteed above!"); + AddObjCProperties(CCContext, ObjCPtr->getInterfaceDecl(), true, +/*AllowNullaryMethods=*/true, CurContext, +AddedProperties, Results); +} + // Add properties from the protocols in a qualified interface. -for (auto *I : ObjCPtr->quals()) +for (auto *I : BaseType->getAs()->quals()) AddObjCProperties(CCContext, I, true, /*AllowNullaryMethods=*/true, CurContext, AddedProperties, Results); } else if ((IsArrow && BaseType->isObjCObjectPointerType()) || Index: cfe/trunk/test/CodeCompletion/objc-protocol-member-access.m === --- cfe/trunk/test/CodeCompletion/objc-protocol-member-access.m +++ cfe/trunk/test/CodeCompletion/objc-protocol-member-access.m @@ -0,0 +1,24 @@ +// Note: the run lines follow their respective tests, since line/column +// matter in this test. + +@protocol Bar +@property (readonly) int bar; +@end + +@protocol Foo + +@property (nonatomic, readonly) int foo; +- (void)foobar: (int)x; + +@end + +int getFoo(id object) { + id modelObject = (id)object; + int foo = modelObject.; + return foo; +} + +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:17:25 %s -o - | FileCheck %s +// CHECK: bar : [#int#]bar +// CHECK: foo : [#int#]foo +// CHECK-NOT: foobar Index: cfe/trunk/lib/Sema/SemaCodeComplete.cpp === --- cfe/trunk/lib/Sema/SemaCodeComplete.cpp +++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp @@ -3720,20 +3720,21 @@ Results.AddResult(Result("template")); } } - } else if (!IsArrow && BaseType->getAsObjCInterfacePointerType()) { + } else if (!IsArrow && BaseType->isObjCObjectPointerType()) { // Objective-C property reference. AddedPropertiesSet AddedProperties; - -// Add property results based on our interface. -const ObjCObjectPointerType *ObjCPtr - = BaseType->getAsObjCInterfacePointerType(); -assert(ObjCPtr && "Non-NULL pointer guaranteed above!"); -AddObjCProperties(CCContext, ObjCPtr->getInterfaceDecl(), true, - /*AllowNullaryMethods=*/true, CurContext, - AddedProperties, Results); - + +if (const ObjCObjectPointerType *ObjCPtr = +BaseType->getAsObjCInterfacePointerType()) { + // Add property results based on our interface. + assert(ObjCPtr && "Non-NULL pointer guaranteed above!"); + AddObjCProperties(CCContext, ObjCPtr->getInterfaceDecl(), true, +/*A
r284009 - [ARM] Fix - missing target-cpu in test
Author: javed.absar Date: Wed Oct 12 07:13:55 2016 New Revision: 284009 URL: http://llvm.org/viewvc/llvm-project?rev=284009&view=rev Log: [ARM] Fix - missing target-cpu in test Fixes an incomplete test, wherein the target-cpu name (cortex-r52) was missing. Differential Revision: http://reviews.llvm.org/D25474 Modified: cfe/trunk/test/Driver/arm-cortex-cpus.c Modified: cfe/trunk/test/Driver/arm-cortex-cpus.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-cortex-cpus.c?rev=284009&r1=284008&r2=284009&view=diff == --- cfe/trunk/test/Driver/arm-cortex-cpus.c (original) +++ cfe/trunk/test/Driver/arm-cortex-cpus.c Wed Oct 12 07:13:55 2016 @@ -165,7 +165,7 @@ // RUN: FileCheck -check-prefix=CHECK-V8R-THUMB-BIG %s // RUN: %clang -target arm -march=armv8r -mthumb -mbig-endian -### -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=CHECK-V8R-THUMB-BIG %s -// CHECK-V8R-THUMB-BIG: "-cc1"{{.*}} "-triple" "thumbebv8r-{{.*}} "-target-cpu +// CHECK-V8R-THUMB-BIG: "-cc1"{{.*}} "-triple" "thumbebv8r-{{.*}} "-target-cpu" "cortex-r52" // RUN: %clang -mcpu=generic -target armv8 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s // RUN: %clang -mcpu=generic -target arm -march=armv8 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25474: [ARM] Fix - missing target-cpu in test
This revision was automatically updated to reflect the committed changes. Closed by commit rL284009: [ARM] Fix - missing target-cpu in test (authored by javed.absar). Changed prior to commit: https://reviews.llvm.org/D25474?vs=74247&id=74365#toc Repository: rL LLVM https://reviews.llvm.org/D25474 Files: cfe/trunk/test/Driver/arm-cortex-cpus.c Index: cfe/trunk/test/Driver/arm-cortex-cpus.c === --- cfe/trunk/test/Driver/arm-cortex-cpus.c +++ cfe/trunk/test/Driver/arm-cortex-cpus.c @@ -165,7 +165,7 @@ // RUN: FileCheck -check-prefix=CHECK-V8R-THUMB-BIG %s // RUN: %clang -target arm -march=armv8r -mthumb -mbig-endian -### -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=CHECK-V8R-THUMB-BIG %s -// CHECK-V8R-THUMB-BIG: "-cc1"{{.*}} "-triple" "thumbebv8r-{{.*}} "-target-cpu +// CHECK-V8R-THUMB-BIG: "-cc1"{{.*}} "-triple" "thumbebv8r-{{.*}} "-target-cpu" "cortex-r52" // RUN: %clang -mcpu=generic -target armv8 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s // RUN: %clang -mcpu=generic -target arm -march=armv8 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s Index: cfe/trunk/test/Driver/arm-cortex-cpus.c === --- cfe/trunk/test/Driver/arm-cortex-cpus.c +++ cfe/trunk/test/Driver/arm-cortex-cpus.c @@ -165,7 +165,7 @@ // RUN: FileCheck -check-prefix=CHECK-V8R-THUMB-BIG %s // RUN: %clang -target arm -march=armv8r -mthumb -mbig-endian -### -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=CHECK-V8R-THUMB-BIG %s -// CHECK-V8R-THUMB-BIG: "-cc1"{{.*}} "-triple" "thumbebv8r-{{.*}} "-target-cpu +// CHECK-V8R-THUMB-BIG: "-cc1"{{.*}} "-triple" "thumbebv8r-{{.*}} "-target-cpu" "cortex-r52" // RUN: %clang -mcpu=generic -target armv8 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s // RUN: %clang -mcpu=generic -target arm -march=armv8 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D23657: Remove some false positives when taking the address of packed members
joerg added inline comments. Comment at: lib/Sema/SemaChecking.cpp:11370 +// we are here such increase has not been enough. So pointing the first +// FieldDecl that either is packed orelse its RecordDecl is, +// seems reasonable. Missing space. https://reviews.llvm.org/D23657 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24508: PR28752: Do not instantiate var decls which are not visible.
v.g.vassilev closed this revision. v.g.vassilev marked an inline comment as done. v.g.vassilev added a comment. Relanded in r284008. https://reviews.llvm.org/D24508 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r284011 - [change-namespace] don't miss comments in the beginning of a namespace block.
Author: ioeric Date: Wed Oct 12 07:34:18 2016 New Revision: 284011 URL: http://llvm.org/viewvc/llvm-project?rev=284011&view=rev Log: [change-namespace] don't miss comments in the beginning of a namespace block. Reviewers: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25397 Modified: clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp Modified: clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp?rev=284011&r1=284010&r2=284011&view=diff == --- clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp (original) +++ clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp Wed Oct 12 07:34:18 2016 @@ -82,33 +82,42 @@ const NamespaceDecl *getOuterNamespace(c return CurrentNs; } -// FIXME: get rid of this helper function if this is supported in clang-refactor -// library. -SourceLocation getStartOfNextLine(SourceLocation Loc, const SourceManager &SM, - const LangOptions &LangOpts) { +static std::unique_ptr +getLexerStartingFromLoc(SourceLocation Loc, const SourceManager &SM, +const LangOptions &LangOpts) { if (Loc.isMacroID() && !Lexer::isAtEndOfMacroExpansion(Loc, SM, LangOpts, &Loc)) -return SourceLocation(); +return nullptr; // Break down the source location. std::pair LocInfo = SM.getDecomposedLoc(Loc); // Try to load the file buffer. bool InvalidTemp = false; llvm::StringRef File = SM.getBufferData(LocInfo.first, &InvalidTemp); if (InvalidTemp) -return SourceLocation(); +return nullptr; const char *TokBegin = File.data() + LocInfo.second; // Lex from the start of the given location. - Lexer Lex(SM.getLocForStartOfFile(LocInfo.first), LangOpts, File.begin(), -TokBegin, File.end()); + return llvm::make_unique(SM.getLocForStartOfFile(LocInfo.first), + LangOpts, File.begin(), TokBegin, File.end()); +} +// FIXME: get rid of this helper function if this is supported in clang-refactor +// library. +static SourceLocation getStartOfNextLine(SourceLocation Loc, + const SourceManager &SM, + const LangOptions &LangOpts) { + std::unique_ptr Lex = getLexerStartingFromLoc(Loc, SM, LangOpts); + if (!Lex.get()) +return SourceLocation(); llvm::SmallVector Line; // FIXME: this is a bit hacky to get ReadToEndOfLine work. - Lex.setParsingPreprocessorDirective(true); - Lex.ReadToEndOfLine(&Line); + Lex->setParsingPreprocessorDirective(true); + Lex->ReadToEndOfLine(&Line); auto End = Loc.getLocWithOffset(Line.size()); - return SM.getLocForEndOfFile(LocInfo.first) == End ? End - : End.getLocWithOffset(1); + return SM.getLocForEndOfFile(SM.getDecomposedLoc(Loc).first) == End + ? End + : End.getLocWithOffset(1); } // Returns `R` with new range that refers to code after `Replaces` being @@ -365,6 +374,23 @@ void ChangeNamespaceTool::run( } } +static SourceLocation getLocAfterNamespaceLBrace(const NamespaceDecl *NsDecl, + const SourceManager &SM, + const LangOptions &LangOpts) { + std::unique_ptr Lex = + getLexerStartingFromLoc(NsDecl->getLocStart(), SM, LangOpts); + assert(Lex.get() && + "Failed to create lexer from the beginning of namespace."); + if (!Lex.get()) +return SourceLocation(); + Token Tok; + while (!Lex->LexFromRawLexer(Tok) && Tok.isNot(tok::TokenKind::l_brace)) { + } + return Tok.isNot(tok::TokenKind::l_brace) + ? SourceLocation() + : Tok.getEndLoc().getLocWithOffset(1); +} + // Stores information about a moved namespace in `MoveNamespaces` and leaves // the actual movement to `onEndOfTranslationUnit()`. void ChangeNamespaceTool::moveOldNamespace( @@ -375,7 +401,9 @@ void ChangeNamespaceTool::moveOldNamespa return; // Get the range of the code in the old namespace. - SourceLocation Start = NsDecl->decls_begin()->getLocStart(); + SourceLocation Start = getLocAfterNamespaceLBrace( + NsDecl, *Result.SourceManager, Result.Context->getLangOpts()); + assert(Start.isValid() && "Can't find l_brace for namespace."); SourceLocation End = NsDecl->getRBraceLoc().getLocWithOffset(-1); // Create a replacement that deletes the code in the old namespace merely for // retrieving offset and length from it. Modified: clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/change-namespace/ChangeNames
[PATCH] D25397: [change-namespace] don't miss comments in the beginning of a namespace block.
This revision was automatically updated to reflect the committed changes. Closed by commit rL284011: [change-namespace] don't miss comments in the beginning of a namespace block. (authored by ioeric). Changed prior to commit: https://reviews.llvm.org/D25397?vs=74038&id=74368#toc Repository: rL LLVM https://reviews.llvm.org/D25397 Files: clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp Index: clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp === --- clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp +++ clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp @@ -552,6 +552,38 @@ EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code)); } +TEST_F(ChangeNamespaceTest, CommentsBeforeMovedClass) { + std::string Code = "namespace na {\n" + "namespace nb {\n" + "\n\n" + "// Wild comments.\n" + "\n" + "// Comments.\n" + "// More comments.\n" + "class B {\n" + " // Private comments.\n" + " int a;\n" + "};\n" + "}\n" + "}"; + std::string Expected = "\n" + "\n" + "namespace x {\n" + "namespace y {\n" + "\n\n" + "// Wild comments.\n" + "\n" + "// Comments.\n" + "// More comments.\n" + "class B {\n" + " // Private comments.\n" + " int a;\n" + "};\n" + "} // namespace y\n" + "} // namespace x\n"; + EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code)); +} + } // anonymous namespace } // namespace change_namespace } // namespace clang Index: clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp === --- clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp +++ clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp @@ -82,33 +82,42 @@ return CurrentNs; } -// FIXME: get rid of this helper function if this is supported in clang-refactor -// library. -SourceLocation getStartOfNextLine(SourceLocation Loc, const SourceManager &SM, - const LangOptions &LangOpts) { +static std::unique_ptr +getLexerStartingFromLoc(SourceLocation Loc, const SourceManager &SM, +const LangOptions &LangOpts) { if (Loc.isMacroID() && !Lexer::isAtEndOfMacroExpansion(Loc, SM, LangOpts, &Loc)) -return SourceLocation(); +return nullptr; // Break down the source location. std::pair LocInfo = SM.getDecomposedLoc(Loc); // Try to load the file buffer. bool InvalidTemp = false; llvm::StringRef File = SM.getBufferData(LocInfo.first, &InvalidTemp); if (InvalidTemp) -return SourceLocation(); +return nullptr; const char *TokBegin = File.data() + LocInfo.second; // Lex from the start of the given location. - Lexer Lex(SM.getLocForStartOfFile(LocInfo.first), LangOpts, File.begin(), -TokBegin, File.end()); + return llvm::make_unique(SM.getLocForStartOfFile(LocInfo.first), + LangOpts, File.begin(), TokBegin, File.end()); +} +// FIXME: get rid of this helper function if this is supported in clang-refactor +// library. +static SourceLocation getStartOfNextLine(SourceLocation Loc, + const SourceManager &SM, + const LangOptions &LangOpts) { + std::unique_ptr Lex = getLexerStartingFromLoc(Loc, SM, LangOpts); + if (!Lex.get()) +return SourceLocation(); llvm::SmallVector Line; // FIXME: this is a bit hacky to get ReadToEndOfLine work. - Lex.setParsingPreprocessorDirective(true); - Lex.ReadToEndOfLine(&Line); + Lex->setParsingPreprocessorDirective(true); + Lex->ReadToEndOfLine(&Line); auto End = Loc.getLocWithOffset(Line.size()); - return SM.getLocForEndOfFile(LocInfo.first) == End ? End - : End.getLocWithOffset(1); + return SM.getLocForEndOfFile(SM.getDecomposedLoc(Loc).first) == End + ? End + : End.getLocWithOffset(1); } // Returns `R` with new range that refers to code after `Replaces` being @@ -365,6 +374,23 @@ } } +static SourceLocation getLocAfterNamespaceLBrace(const NamespaceDecl *NsDecl, + const SourceManager &SM, + const Lan
[PATCH] D25145: [libc++] Correct explanation of _LIBCPP_NEW_DELETE_VIS
smeenai added a comment. In https://reviews.llvm.org/D25145#565027, @mclow.lists wrote: > Sigh. Make an expedient choice that you don't really agree with, and you get > immediately reminded of it. I suggested on an earlier review (not this > patch) that I really didn't want to see `_WIN32` in any files other than > ``, that we should have a libc++-specific one. I let that slide > because we had a couple other instances of `_WIN32` in the source base. > > About three days later, this pops up. :-( > Not your fault, but it makes me sad. I'm not a fan either :) Gonna commit this and then send something to cfe-dev about cleaning them up. https://reviews.llvm.org/D25145 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r284016 - [libc++] Correct explanation of _LIBCPP_NEW_DELETE_VIS
Author: smeenai Date: Wed Oct 12 08:48:14 2016 New Revision: 284016 URL: http://llvm.org/viewvc/llvm-project?rev=284016&view=rev Log: [libc++] Correct explanation of _LIBCPP_NEW_DELETE_VIS The behavior of this macro actually needs to apply universally on Windows and not just when using the Microsoft CRT. Update the macro definition and documentation accordingly. Differential Revision: https://reviews.llvm.org/D25145 Modified: libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst libcxx/trunk/include/new Modified: libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst?rev=284016&r1=284015&r2=284016&view=diff == --- libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst (original) +++ libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst Wed Oct 12 08:48:14 2016 @@ -112,14 +112,15 @@ Visibility Macros Mark a symbol as being exported by the libc++ library. This macro must be applied to all `operator new` and `operator delete` overloads. - **Windows Behavior**: When using the Microsoft CRT, all the `operator new` and - `operator delete` overloads are defined statically in `msvcrt.lib`. Marking - them as `dllimport` in the libc++ `` header is therefore undesirable: if - we were to mark them as `dllimport` and then link against libc++, source files - which included `` would end up linking against libc++'s `operator new` - and `operator delete`, while source files which did not include `` would - end up linking against msvcrt's `operator new` and `operator delete`, which - would be a confusing and potentially error-prone inconsistency. + **Windows Behavior**: The `operator new` and `operator delete` overloads + should not be marked as `dllimport`; if they were, source files including the + `` header (either directly or transitively) would lose the ability to use + local overloads of `operator new` and `operator delete`. On Windows, this + macro therefore expands to `__declspec(dllexport)` when building the library + and has an empty definition otherwise. A related caveat is that libc++ must be + included on the link line before `msvcrt.lib`, otherwise Microsoft's + definitions of `operator new` and `operator delete` inside `msvcrt.lib` will + end up being used instead of libc++'s. Links = Modified: libcxx/trunk/include/new URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/new?rev=284016&r1=284015&r2=284016&view=diff == --- libcxx/trunk/include/new (original) +++ libcxx/trunk/include/new Wed Oct 12 08:48:14 2016 @@ -125,7 +125,7 @@ _LIBCPP_FUNC_VIS new_handler get_new_han } // std -#if defined(_LIBCPP_MSVCRT) && !defined(_LIBCPP_BUILDING_LIBRARY) +#if defined(_WIN32) && !defined(_LIBCPP_BUILDING_LIBRARY) # define _LIBCPP_NEW_DELETE_VIS #else # define _LIBCPP_NEW_DELETE_VIS _LIBCPP_FUNC_VIS ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25475: [analyzer] Add a new SVal to support pointer-to-member operations.
NoQ added a comment. Yay, thanks for posting this! :) I've got a bit of concern for some assert-suppressions. Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:2314 { + // Return to fulfil assert condition + if (location.getAs()) Hmm. Why would anybody try to load anything from a plain pointer-to-member, rather than from a pointer-to-member-applied-to-an-object (which would no longer be represented by a `PointerToMember` value)? I suspect there's something wrong above the stack (or one of the sub-expression `SVal`s is incorrect), because otherwise i think that making `PointerToMember` a NonLoc is correct - we cannot store things in it or load things from it. Comment at: lib/StaticAnalyzer/Core/ExprEngineC.cpp:465 + "UnaryOperator as Cast's child was expected"); +if (const UnaryOperator *UO = dyn_cast(UOExpr)) { + const Expr *DREExpr = UO->getSubExpr()->IgnoreParenCasts(); `cast<>()`? It seems that all dynamic casts here are asserted to succeed. Comment at: lib/StaticAnalyzer/Core/ExprEngineCXX.cpp:69 +// Add check to fulfil assert condition +if (!V.getAs()) + assert(V.isUnknown()); Same concern: Why are we copying a `NonLoc`? Comment at: test/Analysis/pointer-to-member.cpp:79 // FIXME: Should emit a null dereference. return obj.*member; // no-warning } In fact, maybe dereferencing a null pointer-to-member should produce an `UndefinedVal`, which could be later caught by `core.uninitialized.UndefReturn`. I wonder why doesn't this happen. https://reviews.llvm.org/D25475 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25145: [libc++] Correct explanation of _LIBCPP_NEW_DELETE_VIS
smeenai closed this revision. smeenai added a comment. Not sure why Phabricator isn't closing this out, but this was committed as SVN r284016 https://reviews.llvm.org/D25145 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25508: [clang-move] Don't comparing absolute file path to relative path.
hokein updated this revision to Diff 74375. hokein added a comment. Update the patch based on offline discussion. https://reviews.llvm.org/D25508 Files: clang-move/ClangMove.cpp test/clang-move/Inputs/database_template.json test/clang-move/move-class.cpp Index: test/clang-move/move-class.cpp === --- test/clang-move/move-class.cpp +++ test/clang-move/move-class.cpp @@ -1,21 +1,24 @@ // RUN: mkdir -p %T/clang-move/build +// RUN: mkdir -p %T/clang-move/include // RUN: sed 's|$test_dir|%/T/clang-move|g' %S/Inputs/database_template.json > %T/clang-move/compile_commands.json -// RUN: cp %S/Inputs/test* %T/clang-move/ -// RUN: touch %T/clang-move/test2.h -// RUN: cd %T/clang-move -// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=../clang-move/test.cpp -old_header=../clang-move/test.h %T/clang-move/test.cpp +// RUN: cp %S/Inputs/test.h %T/clang-move/include +// RUN: cp %S/Inputs/test.cpp %T/clang-move +// RUN: touch %T/clang-move/include/test2.h +// RUN: cd %T/clang-move/build +// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=../test.cpp -old_header=../include/test.h %T/clang-move/test.cpp // RUN: FileCheck -input-file=%T/clang-move/new_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s // RUN: FileCheck -input-file=%T/clang-move/new_test.h -check-prefix=CHECK-NEW-TEST-H %s // RUN: FileCheck -input-file=%T/clang-move/test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s -// RUN: FileCheck -input-file=%T/clang-move/test.h %s -implicit-check-not='{{namespace.*}}' +// RUN: FileCheck -input-file=%T/clang-move/include/test.h %s -implicit-check-not='{{namespace.*}}' // -// RUN: cp %S/Inputs/test* %T/clang-move/ -// RUN: cd %T/clang-move -// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=%T/clang-move/test.cpp -old_header=%T/clang-move/test.h %T/clang-move/test.cpp +// RUN: cp %S/Inputs/test.h %T/clang-move/include +// RUN: cp %S/Inputs/test.cpp %T/clang-move +// RUN: cd %T/clang-move/build +// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=%T/clang-move/test.cpp -old_header=%T/clang-move/include/test.h %T/clang-move/test.cpp // RUN: FileCheck -input-file=%T/clang-move/new_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s // RUN: FileCheck -input-file=%T/clang-move/new_test.h -check-prefix=CHECK-NEW-TEST-H %s // RUN: FileCheck -input-file=%T/clang-move/test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s -// RUN: FileCheck -input-file=%T/clang-move/test.h %s -implicit-check-not='{{namespace.*}}' +// RUN: FileCheck -input-file=%T/clang-move/include/test.h %s -implicit-check-not='{{namespace.*}}' // // CHECK-NEW-TEST-H: namespace a { // CHECK-NEW-TEST-H: class Foo { Index: test/clang-move/Inputs/database_template.json === --- test/clang-move/Inputs/database_template.json +++ test/clang-move/Inputs/database_template.json @@ -1,7 +1,7 @@ [ { "directory": "$test_dir/build", - "command": "clang++ -o test.o $test_dir/test.cpp", + "command": "clang++ -o test.o -I../include $test_dir/test.cpp", "file": "$test_dir/test.cpp" } ] Index: clang-move/ClangMove.cpp === --- clang-move/ClangMove.cpp +++ clang-move/ClangMove.cpp @@ -51,8 +51,18 @@ SM.getFileManager().getVirtualFileSystem()->makeAbsolute(AbsolutePath)) llvm::errs() << "Warning: could not make absolute file: '" << EC.message() << '\n'; - llvm::sys::path::remove_dots(AbsolutePath, /*remove_dot_dot=*/true); - llvm::sys::path::native(AbsolutePath); + // Handle symbolic link path cases. + // We are trying to get the real file path of the symlink. + const DirectoryEntry *Dir = SM.getFileManager().getDirectory( + llvm::sys::path::parent_path(AbsolutePath.str())); + if (Dir) { +StringRef DirName = SM.getFileManager().getCanonicalName(Dir); +SmallVector AbsoluteFilename; +llvm::sys::path::append(AbsoluteFilename, DirName, +llvm::sys::path::filename(AbsolutePath.str())); +return llvm::StringRef(AbsoluteFilename.data(), AbsoluteFilename.size()) +.str(); + } return AbsolutePath.str(); } @@ -382,12 +392,14 @@ llvm::StringRef SearchPath, llvm::StringRef FileName, const SourceManager& SM) { - auto AbsoluteSearchPath = MakeAbsolutePath(SM, SearchPath); + SmallVector HeaderWithSearchPath; + llvm::sys::path::append(HeaderWithSearchPath, SearchPath, IncludeHeader); // FIXME: Add old.h to the new.cc/h when the new target has dependencies on // old.h/c. For instance, when moved class uses another class defined in
[PATCH] D25153: preprocessor supports `-dI` flag
elsteveogrande added a comment. Ping again -- addressed all issues, looking ok now? Note about this change + review process here. First I know the every 1-2 day pinging generates noise on the lists, and for that I'm SorryNotSorry :-p I just want to ensure this is reaching at least the right people for feedback + eventually accepting. Also this diff is pretty low-risk... - It's short and doesn't change too much. - What it does change is essentially opt-in with a new flag. So this shouldn't break existing toolchains and projects, because nothing uses this yet. - It's largely "additive" and again shouldn't change existing behavior, just allowing for new functionality. - This new flag is for feature parity w/ gcc, and so there is some prescription for its behavior. Though not officially documented (absent from GCC docs, for example, but with a small amount of info in `man 1 gcc`), it seems to work roughly the same. - Has unit test coverage which I believe covers all possible usage cases (different ways to `#include` files). - I stripped away unneeded code which was creating some sticking points, working around that for now, shortening this diff more. (And reducing mystery and having to make decisions about e.g. string escaping and weird stuff.) - Had quite a bit of feedback already from @rsmith, @majnemer, @vsk (thank you all!) -- addressed a number of issues and cleaned this up a lot. Is this in acceptable shape? Any objections to accept, land, then revert if catastrophe (doubt it for reasons above)? Thanks again! https://reviews.llvm.org/D25153 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24644: Pass -ffunction-sections/-fdata-sections along to gold-plugin
tejohnson added a comment. Ping. It seems like using attributes is not feasible at this time due to the lack of data attributes. https://reviews.llvm.org/D24644 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25508: [clang-move] Compare with real paths of symlinks
ioeric accepted this revision. ioeric added a comment. This revision is now accepted and ready to land. Lg with one nit. Comment at: clang-move/ClangMove.cpp:410 std::string AbsolutePath = MakeAbsolutePath(SM, FileName); if (MakeAbsolutePath(OriginalRunningDirectory, Spec.OldHeader) == AbsolutePath) { This duplicates `MakeAbsolutePath` in line 400 https://reviews.llvm.org/D25508 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25480: __builtin_fpclassify missing one int parameter
taniabarg updated this revision to Diff 74377. taniabarg added a comment. Added test to test/Sema/builtin-unary-fp.c that will fail without the proposed change (without the change, the test will -not- attempt to implicitly cast the 5th parameter to int). https://reviews.llvm.org/D25480 Files: include/clang/Basic/Builtins.def test/Sema/builtin-unary-fp.c Index: test/Sema/builtin-unary-fp.c === --- test/Sema/builtin-unary-fp.c +++ test/Sema/builtin-unary-fp.c @@ -11,6 +11,7 @@ check(__builtin_isnan(1,2)); // expected-error{{too many arguments}} check(__builtin_fpclassify(0, 0, 0, 0, 0, 1.0)); check(__builtin_fpclassify(0, 0, 0, 0, 0, 1)); // expected-error{{requires argument of floating point type}} + check(__builtin_fpclassify(0, 1, 2, 3, 4.5, 5.0)); // expected-warning{{implicit conversion from 'double' to 'int' changes value from 4.5 to 4}} check(__builtin_fpclassify(0, 0, 0, 0, 1)); // expected-error{{too few arguments}} check(__builtin_fpclassify(0, 0, 0, 0, 0, 1, 0)); // expected-error{{too many arguments}} } Index: include/clang/Basic/Builtins.def === --- include/clang/Basic/Builtins.def +++ include/clang/Basic/Builtins.def @@ -367,7 +367,7 @@ BUILTIN(__builtin_isunordered , "i.", "Fnc") // Unary FP classification -BUILTIN(__builtin_fpclassify, "i.", "Fnc") +BUILTIN(__builtin_fpclassify, "ii.", "Fnc") BUILTIN(__builtin_isfinite, "i.", "Fnc") BUILTIN(__builtin_isinf, "i.", "Fnc") BUILTIN(__builtin_isinf_sign, "i.", "Fnc") Index: test/Sema/builtin-unary-fp.c === --- test/Sema/builtin-unary-fp.c +++ test/Sema/builtin-unary-fp.c @@ -11,6 +11,7 @@ check(__builtin_isnan(1,2)); // expected-error{{too many arguments}} check(__builtin_fpclassify(0, 0, 0, 0, 0, 1.0)); check(__builtin_fpclassify(0, 0, 0, 0, 0, 1)); // expected-error{{requires argument of floating point type}} + check(__builtin_fpclassify(0, 1, 2, 3, 4.5, 5.0)); // expected-warning{{implicit conversion from 'double' to 'int' changes value from 4.5 to 4}} check(__builtin_fpclassify(0, 0, 0, 0, 1)); // expected-error{{too few arguments}} check(__builtin_fpclassify(0, 0, 0, 0, 0, 1, 0)); // expected-error{{too many arguments}} } Index: include/clang/Basic/Builtins.def === --- include/clang/Basic/Builtins.def +++ include/clang/Basic/Builtins.def @@ -367,7 +367,7 @@ BUILTIN(__builtin_isunordered , "i.", "Fnc") // Unary FP classification -BUILTIN(__builtin_fpclassify, "i.", "Fnc") +BUILTIN(__builtin_fpclassify, "ii.", "Fnc") BUILTIN(__builtin_isfinite, "i.", "Fnc") BUILTIN(__builtin_isinf, "i.", "Fnc") BUILTIN(__builtin_isinf_sign, "i.", "Fnc") ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference with OpenMP array access
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG with a nit Comment at: lib/CodeGen/CGStmtOpenMP.cpp:312 + assert(ArgLVal.getType()->isPointerType()); + ArgAddr = this->EmitLoadOfPointer( + ArgAddr, ArgLVal.getType()->castAs()); Remove `this->` https://reviews.llvm.org/D25373 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25508: [clang-move] Compare with real paths of symlinks
hokein updated this revision to Diff 74382. hokein added a comment. Update. https://reviews.llvm.org/D25508 Files: clang-move/ClangMove.cpp test/clang-move/Inputs/database_template.json test/clang-move/move-class.cpp Index: test/clang-move/move-class.cpp === --- test/clang-move/move-class.cpp +++ test/clang-move/move-class.cpp @@ -1,21 +1,24 @@ // RUN: mkdir -p %T/clang-move/build +// RUN: mkdir -p %T/clang-move/include // RUN: sed 's|$test_dir|%/T/clang-move|g' %S/Inputs/database_template.json > %T/clang-move/compile_commands.json -// RUN: cp %S/Inputs/test* %T/clang-move/ -// RUN: touch %T/clang-move/test2.h -// RUN: cd %T/clang-move -// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=../clang-move/test.cpp -old_header=../clang-move/test.h %T/clang-move/test.cpp +// RUN: cp %S/Inputs/test.h %T/clang-move/include +// RUN: cp %S/Inputs/test.cpp %T/clang-move +// RUN: touch %T/clang-move/include/test2.h +// RUN: cd %T/clang-move/build +// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=../test.cpp -old_header=../include/test.h %T/clang-move/test.cpp // RUN: FileCheck -input-file=%T/clang-move/new_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s // RUN: FileCheck -input-file=%T/clang-move/new_test.h -check-prefix=CHECK-NEW-TEST-H %s // RUN: FileCheck -input-file=%T/clang-move/test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s -// RUN: FileCheck -input-file=%T/clang-move/test.h %s -implicit-check-not='{{namespace.*}}' +// RUN: FileCheck -input-file=%T/clang-move/include/test.h %s -implicit-check-not='{{namespace.*}}' // -// RUN: cp %S/Inputs/test* %T/clang-move/ -// RUN: cd %T/clang-move -// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=%T/clang-move/test.cpp -old_header=%T/clang-move/test.h %T/clang-move/test.cpp +// RUN: cp %S/Inputs/test.h %T/clang-move/include +// RUN: cp %S/Inputs/test.cpp %T/clang-move +// RUN: cd %T/clang-move/build +// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=%T/clang-move/test.cpp -old_header=%T/clang-move/include/test.h %T/clang-move/test.cpp // RUN: FileCheck -input-file=%T/clang-move/new_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s // RUN: FileCheck -input-file=%T/clang-move/new_test.h -check-prefix=CHECK-NEW-TEST-H %s // RUN: FileCheck -input-file=%T/clang-move/test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s -// RUN: FileCheck -input-file=%T/clang-move/test.h %s -implicit-check-not='{{namespace.*}}' +// RUN: FileCheck -input-file=%T/clang-move/include/test.h %s -implicit-check-not='{{namespace.*}}' // // CHECK-NEW-TEST-H: namespace a { // CHECK-NEW-TEST-H: class Foo { Index: test/clang-move/Inputs/database_template.json === --- test/clang-move/Inputs/database_template.json +++ test/clang-move/Inputs/database_template.json @@ -1,7 +1,7 @@ [ { "directory": "$test_dir/build", - "command": "clang++ -o test.o $test_dir/test.cpp", + "command": "clang++ -o test.o -I../include $test_dir/test.cpp", "file": "$test_dir/test.cpp" } ] Index: clang-move/ClangMove.cpp === --- clang-move/ClangMove.cpp +++ clang-move/ClangMove.cpp @@ -51,8 +51,18 @@ SM.getFileManager().getVirtualFileSystem()->makeAbsolute(AbsolutePath)) llvm::errs() << "Warning: could not make absolute file: '" << EC.message() << '\n'; - llvm::sys::path::remove_dots(AbsolutePath, /*remove_dot_dot=*/true); - llvm::sys::path::native(AbsolutePath); + // Handle symbolic link path cases. + // We are trying to get the real file path of the symlink. + const DirectoryEntry *Dir = SM.getFileManager().getDirectory( + llvm::sys::path::parent_path(AbsolutePath.str())); + if (Dir) { +StringRef DirName = SM.getFileManager().getCanonicalName(Dir); +SmallVector AbsoluteFilename; +llvm::sys::path::append(AbsoluteFilename, DirName, +llvm::sys::path::filename(AbsolutePath.str())); +return llvm::StringRef(AbsoluteFilename.data(), AbsoluteFilename.size()) +.str(); + } return AbsolutePath.str(); } @@ -382,24 +392,27 @@ llvm::StringRef SearchPath, llvm::StringRef FileName, const SourceManager& SM) { - auto AbsoluteSearchPath = MakeAbsolutePath(SM, SearchPath); + SmallVector HeaderWithSearchPath; + llvm::sys::path::append(HeaderWithSearchPath, SearchPath, IncludeHeader); + std::string AbsoluteOldHeader = + MakeAbsolutePath(OriginalRunningDirectory, Spec.OldHeader); // FIXME: Add old.h to the new.cc/h when the new target has dependencies on // old.h/c. For instance, when
[PATCH] D22955: [MSVC] Improved late parsing of template functions.
ABataev added a comment. Ping https://reviews.llvm.org/D22955 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference with OpenMP array access
erichkeane updated this revision to Diff 74386. erichkeane marked an inline comment as done. erichkeane added a comment. Fixed Alexey's nit. Will need someone else to commit this, I don't yet have commit access. https://reviews.llvm.org/D25373 Files: lib/CodeGen/CGStmtOpenMP.cpp test/CodeGenCXX/debug-info-openmp-array.cpp test/OpenMP/for_reduction_codegen.cpp test/OpenMP/for_reduction_codegen_UDR.cpp test/OpenMP/target_firstprivate_codegen.cpp test/OpenMP/target_map_codegen.cpp Index: lib/CodeGen/CGStmtOpenMP.cpp === --- lib/CodeGen/CGStmtOpenMP.cpp +++ lib/CodeGen/CGStmtOpenMP.cpp @@ -232,8 +232,15 @@ assert(I->capturesVariableArrayType()); II = &getContext().Idents.get("vla"); } -if (ArgType->isVariablyModifiedType()) - ArgType = getContext().getVariableArrayDecayedType(ArgType); +if (ArgType->isVariablyModifiedType()) { + bool IsReference = ArgType->isLValueReferenceType(); + ArgType = + getContext().getCanonicalParamType(ArgType.getNonReferenceType()); + if (IsReference && !ArgType->isPointerType()) { +ArgType = getContext().getLValueReferenceType( +ArgType, /*SpelledAsLValue=*/false); + } +} Args.push_back(ImplicitParamDecl::Create(getContext(), nullptr, FD->getLocation(), II, ArgType)); ++I; @@ -297,8 +304,14 @@ QualType VarTy = Var->getType(); Address ArgAddr = ArgLVal.getAddress(); if (!VarTy->isReferenceType()) { -ArgAddr = EmitLoadOfReference( -ArgAddr, ArgLVal.getType()->castAs()); +if (ArgLVal.getType()->isLValueReferenceType()) { + ArgAddr = EmitLoadOfReference( + ArgAddr, ArgLVal.getType()->castAs()); +} else { + assert(ArgLVal.getType()->isPointerType()); + ArgAddr = EmitLoadOfPointer( + ArgAddr, ArgLVal.getType()->castAs()); +} } setAddrOfLocalVar( Var, Address(ArgAddr.getPointer(), getContext().getDeclAlign(Var))); Index: test/OpenMP/for_reduction_codegen_UDR.cpp === --- test/OpenMP/for_reduction_codegen_UDR.cpp +++ test/OpenMP/for_reduction_codegen_UDR.cpp @@ -301,7 +301,7 @@ // CHECK: fadd float 5.55e+02, % // CHECK: ret void -// CHECK: define internal void [[MAIN_MICROTASK1]](i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}}, i64 %{{.+}}, i64 %{{.+}}, i32* nonnull %{{.+}}, [2 x i32]* dereferenceable(8) %{{.+}}, [10 x [4 x [[S_FLOAT_TY* dereferenceable(480) %{{.+}}) +// CHECK: define internal void [[MAIN_MICROTASK1]](i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}}, i64 %{{.+}}, i64 %{{.+}}, i32* %{{.+}}, [2 x i32]* dereferenceable(8) %{{.+}}, [10 x [4 x [[S_FLOAT_TY* dereferenceable(480) %{{.+}}) // Reduction list for runtime. // CHECK: [[RED_LIST:%.+]] = alloca [4 x i8*], @@ -500,7 +500,7 @@ // CHECK: ret void -// CHECK: define internal void [[MAIN_MICROTASK2]](i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}}, i64 %{{.+}}, i64 %{{.+}}, i32* nonnull %{{.+}}, [10 x [4 x [[S_FLOAT_TY* dereferenceable(480) %{{.+}}) +// CHECK: define internal void [[MAIN_MICROTASK2]](i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}}, i64 %{{.+}}, i64 %{{.+}}, i32* %{{.+}}, [10 x [4 x [[S_FLOAT_TY* dereferenceable(480) %{{.+}}) // CHECK: [[ARRS_PRIV:%.+]] = alloca [10 x [4 x [[S_FLOAT_TY, Index: test/OpenMP/target_map_codegen.cpp === --- test/OpenMP/target_map_codegen.cpp +++ test/OpenMP/target_map_codegen.cpp @@ -675,7 +675,7 @@ } } -// CK13: define internal void [[KERNEL]](i[[sz]] [[VLA0:%.+]], i[[sz]] [[VLA1:%.+]], double* {{.+}}[[ARG:%.+]]) +// CK13: define internal void [[KERNEL]](i[[sz]] [[VLA0:%.+]], i[[sz]] [[VLA1:%.+]], double* {{.*}}[[ARG:%.+]]) // CK13: [[ADDR0:%.+]] = alloca i[[sz]], // CK13: [[ADDR1:%.+]] = alloca i[[sz]], // CK13: [[ADDR2:%.+]] = alloca double*, Index: test/OpenMP/for_reduction_codegen.cpp === --- test/OpenMP/for_reduction_codegen.cpp +++ test/OpenMP/for_reduction_codegen.cpp @@ -492,7 +492,7 @@ // CHECK: store float [[UP]], float* [[T_VAR1_LHS]], // CHECK: ret void -// CHECK: define internal void [[MAIN_MICROTASK1]](i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}}, i64 %{{.+}}, i64 %{{.+}}, i32* nonnull %{{.+}}, [2 x i32]* dereferenceable(8) %{{.+}}, [10 x [4 x [[S_FLOAT_TY* dereferenceable(160) %{{.+}}) +// CHECK: define internal void [[MAIN_MICROTASK1]](i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}}, i64 %{{.+}}, i64 %{{.+}}, i32* %{{.+}}, [2 x i32]* dereferenceable(8) %{{.+}}, [10 x [4 x [[S_FLOAT_TY* dereferenceable(160) %{{.+}}) // Reduction
r284019 - NFC: CodeCompletionResult's constructor should take const NamedDecl
Author: arphaman Date: Wed Oct 12 10:33:35 2016 New Revision: 284019 URL: http://llvm.org/viewvc/llvm-project?rev=284019&view=rev Log: NFC: CodeCompletionResult's constructor should take const NamedDecl CodeCompletionResult's Declaration field is a const pointer to the NamedDecl, and thus the constructor should take a const pointer as well. Modified: cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h Modified: cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h?rev=284019&r1=284018&r2=284019&view=diff == --- cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h (original) +++ cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h Wed Oct 12 10:33:35 2016 @@ -737,7 +737,7 @@ public: /// \brief Build a result that refers to a pattern with an associated /// declaration. - CodeCompletionResult(CodeCompletionString *Pattern, NamedDecl *D, + CodeCompletionResult(CodeCompletionString *Pattern, const NamedDecl *D, unsigned Priority) : Declaration(D), Pattern(Pattern), Priority(Priority), StartParameter(0), Kind(RK_Pattern), Availability(CXAvailability_Available), Hidden(false), ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference with OpenMP array access
ABataev added a comment. I will commit it for you, Erich, no problems https://reviews.llvm.org/D25373 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25208: [libc++] Make _LIBCPP_TYPE_VIS export members
smeenai added a comment. In https://reviews.llvm.org/D25208#564930, @EricWF wrote: > Why do you want to build `libc++.so` with hidden visibility? What's wrong > with the existing way we build `libc++.so`? There's nothing wrong with the existing way, per se. I personally prefer hidden visibility semantics because I come from a Windows background and hidden visibility matches up well with DLL semantics, but the first section of https://gcc.gnu.org/wiki/Visibility covers the advantages of hidden visibility pretty well. https://reviews.llvm.org/D25208 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25494: Move x86-64 builtins from SemaChecking.cpp to BuiltinsX86_64.def
rnk accepted this revision. rnk added a comment. This revision is now accepted and ready to land. lgtm Comment at: test/Sema/builtins-x86_64.c:17 + v8ll vec8longlongs; + (void)__builtin_ia32_readeflags_u64(); // expected-error{{use of unknown builtin}} expected-note 0+ {{}} + (void)__builtin_ia32_writeeflags_u64(4); // expected-error{{use of unknown builtin}} expected-note 0+ {{}} agutowski wrote: > Is there some way to ignore all notes? I needed to handle typo-correction > notes (like: `did you mean '__builtin_ia32_readeflags_u32'`). If it's all typo correction, I recommend testing with -fno-spell-checking. https://reviews.llvm.org/D25494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25519: [CodeCompletion] Refactor: Extract two Objective-C block formatting related functions from FormatFunctionParameter
arphaman created this revision. arphaman added a reviewer: manmanren. arphaman added a subscriber: cfe-commits. arphaman set the repository for this revision to rL LLVM. This patch extracts two new functions from the function `FormatFunctionParameter` that are related to Objective-C block formatting. It should be two separate commits (the first extracts `findTypeLocationForBlockDecl`, and the second extracts `formatBlockPlaceholder`), but I squashed them to make the review easier. This patch is required for my follow up patch that improves completion for block property setters. Repository: rL LLVM https://reviews.llvm.org/D25519 Files: lib/Sema/SemaCodeComplete.cpp Index: lib/Sema/SemaCodeComplete.cpp === --- lib/Sema/SemaCodeComplete.cpp +++ lib/Sema/SemaCodeComplete.cpp @@ -2162,6 +2162,53 @@ return Result; } +static void findTypeLocationForBlockDecl(const TypeSourceInfo *TSInfo, + FunctionTypeLoc &Block, + FunctionProtoTypeLoc &BlockProto, + bool SuppressBlock = false) { + if (!TSInfo) +return; + TypeLoc TL = TSInfo->getTypeLoc().getUnqualifiedLoc(); + while (true) { +// Look through typedefs. +if (!SuppressBlock) { + if (TypedefTypeLoc TypedefTL = TL.getAs()) { +if (TypeSourceInfo *InnerTSInfo = +TypedefTL.getTypedefNameDecl()->getTypeSourceInfo()) { + TL = InnerTSInfo->getTypeLoc().getUnqualifiedLoc(); + continue; +} + } + + // Look through qualified types + if (QualifiedTypeLoc QualifiedTL = TL.getAs()) { +TL = QualifiedTL.getUnqualifiedLoc(); +continue; + } + + if (AttributedTypeLoc AttrTL = TL.getAs()) { +TL = AttrTL.getModifiedLoc(); +continue; + } +} + +// Try to get the function prototype behind the block pointer type, +// then we're done. +if (BlockPointerTypeLoc BlockPtr = TL.getAs()) { + TL = BlockPtr.getPointeeLoc().IgnoreParens(); + Block = TL.getAs(); + BlockProto = TL.getAs(); +} +break; + } +} + +static std::string +formatBlockPlaceholder(const PrintingPolicy &Policy, const NamedDecl *BlockDecl, + FunctionTypeLoc &Block, FunctionProtoTypeLoc &BlockProto, + bool SuppressBlock = false, + Optional> ObjCSubsts = None); + static std::string FormatFunctionParameter(const PrintingPolicy &Policy, const ParmVarDecl *Param, bool SuppressName = false, @@ -2192,47 +2239,13 @@ } return Result; } - + // The argument for a block pointer parameter is a block literal with // the appropriate type. FunctionTypeLoc Block; FunctionProtoTypeLoc BlockProto; - TypeLoc TL; - if (TypeSourceInfo *TSInfo = Param->getTypeSourceInfo()) { -TL = TSInfo->getTypeLoc().getUnqualifiedLoc(); -while (true) { - // Look through typedefs. - if (!SuppressBlock) { -if (TypedefTypeLoc TypedefTL = TL.getAs()) { - if (TypeSourceInfo *InnerTSInfo = - TypedefTL.getTypedefNameDecl()->getTypeSourceInfo()) { -TL = InnerTSInfo->getTypeLoc().getUnqualifiedLoc(); -continue; - } -} - -// Look through qualified types -if (QualifiedTypeLoc QualifiedTL = TL.getAs()) { - TL = QualifiedTL.getUnqualifiedLoc(); - continue; -} - -if (AttributedTypeLoc AttrTL = TL.getAs()) { - TL = AttrTL.getModifiedLoc(); - continue; -} - } - - // Try to get the function prototype behind the block pointer type, - // then we're done. - if (BlockPointerTypeLoc BlockPtr = TL.getAs()) { -TL = BlockPtr.getPointeeLoc().IgnoreParens(); -Block = TL.getAs(); -BlockProto = TL.getAs(); - } - break; -} - } + findTypeLocationForBlockDecl(Param->getTypeSourceInfo(), Block, BlockProto, + SuppressBlock); if (!Block) { // We were unable to find a FunctionProtoTypeLoc with parameter names @@ -2258,12 +2271,21 @@ // We have the function prototype behind the block pointer type, as it was // written in the source. + return formatBlockPlaceholder(Policy, Param, Block, BlockProto, SuppressBlock, +ObjCSubsts); +} + +static std::string +formatBlockPlaceholder(const PrintingPolicy &Policy, const NamedDecl *BlockDecl, + FunctionTypeLoc &Block, FunctionProtoTypeLoc &BlockProto, + bool SuppressBlock, + Optional> ObjCSubsts) { std::string Result; QualType ResultType = Block.getTypePtr()->getReturnType(); if (ObjCSubsts) -ResultType = ResultType.
[clang-tools-extra] r284020 - [clang-move] Compare with real paths of symlinks
Author: hokein Date: Wed Oct 12 10:50:30 2016 New Revision: 284020 URL: http://llvm.org/viewvc/llvm-project?rev=284020&view=rev Log: [clang-move] Compare with real paths of symlinks Summary: MakeAbsolutePath does wrong things with symlinks previously. When comparing with a symlink, we need to compare with the real path of it. This fixes issues when the build directory is a symlink. Reviewers: ioeric Subscribers: beanz, mgorny, cfe-commits, bkramer Differential Revision: https://reviews.llvm.org/D25508 Modified: clang-tools-extra/trunk/clang-move/ClangMove.cpp clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json clang-tools-extra/trunk/test/clang-move/move-class.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=284020&r1=284019&r2=284020&view=diff == --- clang-tools-extra/trunk/clang-move/ClangMove.cpp (original) +++ clang-tools-extra/trunk/clang-move/ClangMove.cpp Wed Oct 12 10:50:30 2016 @@ -51,8 +51,18 @@ std::string MakeAbsolutePath(const Sourc SM.getFileManager().getVirtualFileSystem()->makeAbsolute(AbsolutePath)) llvm::errs() << "Warning: could not make absolute file: '" << EC.message() << '\n'; - llvm::sys::path::remove_dots(AbsolutePath, /*remove_dot_dot=*/true); - llvm::sys::path::native(AbsolutePath); + // Handle symbolic link path cases. + // We are trying to get the real file path of the symlink. + const DirectoryEntry *Dir = SM.getFileManager().getDirectory( + llvm::sys::path::parent_path(AbsolutePath.str())); + if (Dir) { +StringRef DirName = SM.getFileManager().getCanonicalName(Dir); +SmallVector AbsoluteFilename; +llvm::sys::path::append(AbsoluteFilename, DirName, +llvm::sys::path::filename(AbsolutePath.str())); +return llvm::StringRef(AbsoluteFilename.data(), AbsoluteFilename.size()) +.str(); + } return AbsolutePath.str(); } @@ -382,24 +392,27 @@ void ClangMoveTool::addIncludes(llvm::St llvm::StringRef SearchPath, llvm::StringRef FileName, const SourceManager& SM) { - auto AbsoluteSearchPath = MakeAbsolutePath(SM, SearchPath); + SmallVector HeaderWithSearchPath; + llvm::sys::path::append(HeaderWithSearchPath, SearchPath, IncludeHeader); + std::string AbsoluteOldHeader = + MakeAbsolutePath(OriginalRunningDirectory, Spec.OldHeader); // FIXME: Add old.h to the new.cc/h when the new target has dependencies on // old.h/c. For instance, when moved class uses another class defined in // old.h, the old.h should be added in new.h. - if (MakeAbsolutePath(OriginalRunningDirectory, Spec.OldHeader) == - MakeAbsolutePath(AbsoluteSearchPath, IncludeHeader)) + if (AbsoluteOldHeader == + MakeAbsolutePath(SM, llvm::StringRef(HeaderWithSearchPath.data(), + HeaderWithSearchPath.size( return; std::string IncludeLine = IsAngled ? ("#include <" + IncludeHeader + ">\n").str() : ("#include \"" + IncludeHeader + "\"\n").str(); - std::string AbsolutePath = MakeAbsolutePath(SM, FileName); - if (MakeAbsolutePath(OriginalRunningDirectory, Spec.OldHeader) == - AbsolutePath) { + std::string AbsoluteCurrentFile = MakeAbsolutePath(SM, FileName); + if (AbsoluteOldHeader == AbsoluteCurrentFile) { HeaderIncludes.push_back(IncludeLine); } else if (MakeAbsolutePath(OriginalRunningDirectory, Spec.OldCC) == - AbsolutePath) { + AbsoluteCurrentFile) { CCIncludes.push_back(IncludeLine); } } Modified: clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json?rev=284020&r1=284019&r2=284020&view=diff == --- clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json (original) +++ clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json Wed Oct 12 10:50:30 2016 @@ -1,7 +1,7 @@ [ { "directory": "$test_dir/build", - "command": "clang++ -o test.o $test_dir/test.cpp", - "file": "$test_dir/test.cpp" + "command": "clang++ -o test.o -I../include $test_dir/src/test.cpp", + "file": "$test_dir/src/test.cpp" } ] Modified: clang-tools-extra/trunk/test/clang-move/move-class.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-move/move-class.cpp?rev=284020&r1=284019&r2=284020&view=diff == --- clang-tools-extra/trunk/test/clang-move/move-class.cpp (original) +++ clang-tools-extra/trunk/test/clang-move/move-class.cpp Wed Oct 12 10:50:30 2016
[PATCH] D25508: [clang-move] Compare with real paths of symlinks
This revision was automatically updated to reflect the committed changes. Closed by commit rL284020: [clang-move] Compare with real paths of symlinks (authored by hokein). Changed prior to commit: https://reviews.llvm.org/D25508?vs=74382&id=74391#toc Repository: rL LLVM https://reviews.llvm.org/D25508 Files: clang-tools-extra/trunk/clang-move/ClangMove.cpp clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json clang-tools-extra/trunk/test/clang-move/move-class.cpp Index: clang-tools-extra/trunk/clang-move/ClangMove.cpp === --- clang-tools-extra/trunk/clang-move/ClangMove.cpp +++ clang-tools-extra/trunk/clang-move/ClangMove.cpp @@ -51,8 +51,18 @@ SM.getFileManager().getVirtualFileSystem()->makeAbsolute(AbsolutePath)) llvm::errs() << "Warning: could not make absolute file: '" << EC.message() << '\n'; - llvm::sys::path::remove_dots(AbsolutePath, /*remove_dot_dot=*/true); - llvm::sys::path::native(AbsolutePath); + // Handle symbolic link path cases. + // We are trying to get the real file path of the symlink. + const DirectoryEntry *Dir = SM.getFileManager().getDirectory( + llvm::sys::path::parent_path(AbsolutePath.str())); + if (Dir) { +StringRef DirName = SM.getFileManager().getCanonicalName(Dir); +SmallVector AbsoluteFilename; +llvm::sys::path::append(AbsoluteFilename, DirName, +llvm::sys::path::filename(AbsolutePath.str())); +return llvm::StringRef(AbsoluteFilename.data(), AbsoluteFilename.size()) +.str(); + } return AbsolutePath.str(); } @@ -382,24 +392,27 @@ llvm::StringRef SearchPath, llvm::StringRef FileName, const SourceManager& SM) { - auto AbsoluteSearchPath = MakeAbsolutePath(SM, SearchPath); + SmallVector HeaderWithSearchPath; + llvm::sys::path::append(HeaderWithSearchPath, SearchPath, IncludeHeader); + std::string AbsoluteOldHeader = + MakeAbsolutePath(OriginalRunningDirectory, Spec.OldHeader); // FIXME: Add old.h to the new.cc/h when the new target has dependencies on // old.h/c. For instance, when moved class uses another class defined in // old.h, the old.h should be added in new.h. - if (MakeAbsolutePath(OriginalRunningDirectory, Spec.OldHeader) == - MakeAbsolutePath(AbsoluteSearchPath, IncludeHeader)) + if (AbsoluteOldHeader == + MakeAbsolutePath(SM, llvm::StringRef(HeaderWithSearchPath.data(), + HeaderWithSearchPath.size( return; std::string IncludeLine = IsAngled ? ("#include <" + IncludeHeader + ">\n").str() : ("#include \"" + IncludeHeader + "\"\n").str(); - std::string AbsolutePath = MakeAbsolutePath(SM, FileName); - if (MakeAbsolutePath(OriginalRunningDirectory, Spec.OldHeader) == - AbsolutePath) { + std::string AbsoluteCurrentFile = MakeAbsolutePath(SM, FileName); + if (AbsoluteOldHeader == AbsoluteCurrentFile) { HeaderIncludes.push_back(IncludeLine); } else if (MakeAbsolutePath(OriginalRunningDirectory, Spec.OldCC) == - AbsolutePath) { + AbsoluteCurrentFile) { CCIncludes.push_back(IncludeLine); } } Index: clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json === --- clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json +++ clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json @@ -1,7 +1,7 @@ [ { "directory": "$test_dir/build", - "command": "clang++ -o test.o $test_dir/test.cpp", - "file": "$test_dir/test.cpp" + "command": "clang++ -o test.o -I../include $test_dir/src/test.cpp", + "file": "$test_dir/src/test.cpp" } ] Index: clang-tools-extra/trunk/test/clang-move/move-class.cpp === --- clang-tools-extra/trunk/test/clang-move/move-class.cpp +++ clang-tools-extra/trunk/test/clang-move/move-class.cpp @@ -1,21 +1,25 @@ // RUN: mkdir -p %T/clang-move/build +// RUN: mkdir -p %T/clang-move/include +// RUN: mkdir -p %T/clang-move/src // RUN: sed 's|$test_dir|%/T/clang-move|g' %S/Inputs/database_template.json > %T/clang-move/compile_commands.json -// RUN: cp %S/Inputs/test* %T/clang-move/ -// RUN: touch %T/clang-move/test2.h -// RUN: cd %T/clang-move -// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=../clang-move/test.cpp -old_header=../clang-move/test.h %T/clang-move/test.cpp +// RUN: cp %S/Inputs/test.h %T/clang-move/include +// RUN: cp %S/Inputs/test.cpp %T/clang-move/src +// RUN: touch %T/clang-move/include/test2.h +// RUN: cd %T/clang-move/build +// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=../src/test.cpp -old_header=..
[PATCH] D25520: [CodeCompletion] Add block placeholders when completing member access for Objective-C block property setters
arphaman created this revision. arphaman added reviewers: manmanren, doug.gregor. arphaman added a subscriber: cfe-commits. arphaman set the repository for this revision to rL LLVM. This patch depends on https://reviews.llvm.org/D25519. This patch changes the way that Objective-C block properties are code complete: clang now suggests completion with an additional '=' and the block literal placeholder when providing member access completions for appropriate readwrite block properties. This patch uses a simple heuristic to determine if it's appropriate to suggest a setter completion for block properties: if we are completing member access that is a standalone statement, we provide setter completion. Otherwise we fallback to the default property completion. The following example illustrates when the setter completion is triggered: @interface Test : Obj @property (readonly, nonatomic, copy) void (^onReadonly)(int *someParameter); @end @implementation Test - foo { self. // will complete with ‘=‘ and block } - fooNot { // These will code complete normally: (self.) return self. [self foo: self.] if (self.) { } } @end Repository: rL LLVM https://reviews.llvm.org/D25520 Files: include/clang/Parse/Parser.h include/clang/Sema/Sema.h lib/Parse/ParseExpr.cpp lib/Parse/ParseStmt.cpp lib/Sema/SemaCodeComplete.cpp test/Index/complete-block-property-assignment.m Index: test/Index/complete-block-property-assignment.m === --- /dev/null +++ test/Index/complete-block-property-assignment.m @@ -0,0 +1,66 @@ +// Note: the run lines follow their respective tests, since line/column +// matter in this test. + +// rdar://28481726 + +void func(int x); +typedef int Foo; +typedef void (^FooBlock)(Foo *someParameter); + +@interface Obj +@property (readwrite, nonatomic, copy) void (^onAction)(Obj *object); +@property (readwrite, nonatomic) int foo; +@end + +@interface Test : Obj +@property (readwrite, nonatomic, copy) FooBlock onEventHandler; +@property (readonly, nonatomic, copy) void (^onReadonly)(int *someParameter); +@property (readonly, nonatomic, strong) Obj *obj; +@end + +@implementation Test + +#define SELFY self + +- (void)test { + self.foo = 2; + [self takeInt: 2]; self.foo = 2; + /* Comment */ self.foo = 2; + SELFY.foo = 2 +} + +// RUN: c-index-test -code-completion-at=%s:26:8 %s | FileCheck -check-prefix=CHECK-CC1 %s +// RUN: c-index-test -code-completion-at=%s:27:27 %s | FileCheck -check-prefix=CHECK-CC1 %s +// RUN: c-index-test -code-completion-at=%s:28:22 %s | FileCheck -check-prefix=CHECK-CC1 %s +// RUN: c-index-test -code-completion-at=%s:29:9 %s | FileCheck -check-prefix=CHECK-CC1 %s +// CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText foo} (35) +// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType Obj *}{TypedText obj} (35) +// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void (^)(Obj *)}{TypedText onAction}{Equal = }{Placeholder ^(Obj *object)} (35) +// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType FooBlock}{TypedText onEventHandler}{Equal = }{Placeholder ^(Foo *someParameter)} (35) +// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void (^)(int *)}{TypedText onReadonly} (35) + +- (void) takeInt:(int)x { } + +- (int) testFailures { + (self.foo); + int x = self.foo; + [self takeInt: self.foo]; + if (self.foo) { +func(self.foo); + } + return self.foo; +} + +// RUN: c-index-test -code-completion-at=%s:45:9 %s | FileCheck -check-prefix=CHECK-NO %s +// RUN: c-index-test -code-completion-at=%s:46:16 %s | FileCheck -check-prefix=CHECK-NO %s +// RUN: c-index-test -code-completion-at=%s:47:23 %s | FileCheck -check-prefix=CHECK-NO %s +// RUN: c-index-test -code-completion-at=%s:48:12 %s | FileCheck -check-prefix=CHECK-NO %s +// RUN: c-index-test -code-completion-at=%s:49:15 %s | FileCheck -check-prefix=CHECK-NO %s +// RUN: c-index-test -code-completion-at=%s:51:15 %s | FileCheck -check-prefix=CHECK-NO %s +// CHECK-NO: ObjCPropertyDecl:{ResultType int}{TypedText foo} (35) +// CHECK-NO-NEXT: ObjCPropertyDecl:{ResultType Obj *}{TypedText obj} (35) +// CHECK-NO-NEXT: ObjCPropertyDecl:{ResultType void (^)(Obj *)}{TypedText onAction} (35) +// CHECK-NO-NEXT: ObjCPropertyDecl:{ResultType FooBlock}{TypedText onEventHandler} (35) +// CHECK-NO-NEXT: ObjCPropertyDecl:{ResultType void (^)(int *)}{TypedText onReadonly} (35) + +@end Index: lib/Sema/SemaCodeComplete.cpp === --- lib/Sema/SemaCodeComplete.cpp +++ lib/Sema/SemaCodeComplete.cpp @@ -2206,6 +2206,7 @@ static std::string formatBlockPlaceholder(const PrintingPolicy &Policy, const NamedDecl *BlockDecl, FunctionTypeLoc &Block, FunctionProtoTypeLoc &BlockProto, + bool SuppressBlockName = false, bool SuppressBlock = false, Optional> ObjCSubsts = None); @@ -2271,14 +2272,15 @@
[libcxx] r284021 - Mark ostream_iterator's constructors as noexcept.
Author: marshall Date: Wed Oct 12 11:13:48 2016 New Revision: 284021 URL: http://llvm.org/viewvc/llvm-project?rev=284021&view=rev Log: Mark ostream_iterator's constructors as noexcept. Modified: libcxx/trunk/include/iterator Modified: libcxx/trunk/include/iterator URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/iterator?rev=284021&r1=284020&r2=284021&view=diff == --- libcxx/trunk/include/iterator (original) +++ libcxx/trunk/include/iterator Wed Oct 12 11:13:48 2016 @@ -889,9 +889,9 @@ private: ostream_type* __out_stream_; const char_type* __delim_; public: -_LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s) +_LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s) _NOEXCEPT : __out_stream_(_VSTD::addressof(__s)), __delim_(0) {} -_LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter) +_LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter) _NOEXCEPT : __out_stream_(_VSTD::addressof(__s)), __delim_(__delimiter) {} _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value_) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25343: [OpenCL] Mark group functions as convergent in opencl-c.h
yaxunl retitled this revision from "[OpenCL] Mark group functions as noduplicate in opencl-c.h" to "[OpenCL] Mark group functions as convergent in opencl-c.h". yaxunl updated the summary for this revision. yaxunl added a reviewer: aaron.ballman. yaxunl updated this revision to Diff 74394. https://reviews.llvm.org/D25343 Files: include/clang/Basic/Attr.td include/clang/Basic/AttrDocs.td lib/CodeGen/CGCall.cpp lib/Headers/opencl-c.h lib/Sema/SemaDeclAttr.cpp test/CodeGenOpenCL/convergent.cl Index: test/CodeGenOpenCL/convergent.cl === --- /dev/null +++ test/CodeGenOpenCL/convergent.cl @@ -0,0 +1,118 @@ +// RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm %s -o - | FileCheck %s + +void convfun(void) __attribute__((convergent)); +void non_convfun(void); +void nodupfun(void) __attribute__((noduplicate)); + +void f(void); +void g(void); + +// Test two if's are merged and non_convfun duplicated. +// The LLVM IR is equivalent to: +//if (a) { +// f(); +// non_convfun(); +// g(); +//} else { +// non_conffun(); +//} +// +// CHECK: define spir_func void @test_merge_if(i32 %[[a:.+]]) +// CHECK: %[[tobool:.+]] = icmp eq i32 %[[a]], 0 +// CHECK: br i1 %[[tobool]], label %[[if_end3_critedge:.+]], label %[[if_then:.+]] +// CHECK: [[if_then]]: +// CHECK: tail call spir_func void @f() +// CHECK: tail call spir_func void @non_convfun() +// CHECK: tail call spir_func void @g() +// CHECK: br label %[[if_end3:.+]] +// CHECK: [[if_end3_critedge]]: +// CHECK: tail call spir_func void @non_convfun() +// CHECK: br label %[[if_end3]] +// CHECK: [[if_end3]]: +// CHECK-LABEL: ret void + +void test_merge_if(int a) { + if (a) { +f(); + } + non_convfun(); + if (a) { +g(); + } +} + +// CHECK-DAG: declare spir_func void @f() +// CHECK-DAG: declare spir_func void @non_convfun() +// CHECK-DAG: declare spir_func void @g() + +// Test two if's are not merged. +// CHECK: define spir_func void @test_no_merge_if(i32 %[[a:.+]]) +// CHECK: %[[tobool:.+]] = icmp eq i32 %[[a]], 0 +// CHECK: br i1 %[[tobool]], label %[[if_end:.+]], label %[[if_then:.+]] +// CHECK: [[if_then]]: +// CHECK: tail call spir_func void @f() +// CHECK-NOT: call spir_func void @non_convfun() +// CHECK-NOT: call spir_func void @g() +// CHECK: br label %[[if_end]] +// CHECK: [[if_end]]: +// CHECK: %[[tobool_pr:.+]] = phi i1 [ true, %[[if_then]] ], [ false, %{{.+}} ] +// CHECK: tail call spir_func void @convfun() #[[attr5:.+]] +// CHECK: br i1 %[[tobool_pr]], label %[[if_then2:.+]], label %[[if_end3:.+]] +// CHECK: [[if_then2]]: +// CHECK: tail call spir_func void @g() +// CHECK: br label %[[if_end3:.+]] +// CHECK: [[if_end3]]: +// CHECK-LABEL: ret void + +void test_no_merge_if(int a) { + if (a) { +f(); + } + convfun(); + if(a) { +g(); + } +} + +// CHECK: declare spir_func void @convfun(){{[^#]*}} #[[attr2:[0-9]+]] + +// Test loop is unrolled for convergent function. +// CHECK-LABEL: define spir_func void @test_unroll() +// CHECK: tail call spir_func void @convfun() #[[attr5:[0-9]+]] +// CHECK: tail call spir_func void @convfun() #[[attr5]] +// CHECK: tail call spir_func void @convfun() #[[attr5]] +// CHECK: tail call spir_func void @convfun() #[[attr5]] +// CHECK: tail call spir_func void @convfun() #[[attr5]] +// CHECK: tail call spir_func void @convfun() #[[attr5]] +// CHECK: tail call spir_func void @convfun() #[[attr5]] +// CHECK: tail call spir_func void @convfun() #[[attr5]] +// CHECK: tail call spir_func void @convfun() #[[attr5]] +// CHECK: tail call spir_func void @convfun() #[[attr5]] +// CHECK-LABEL: ret void + +void test_unroll() { + for (int i = 0; i < 10; i++) +convfun(); +} + +// Test loop is not unrolled for noduplicate function. +// CHECK-LABEL: define spir_func void @test_not_unroll() +// CHECK: br label %[[for_body:.+]] +// CHECK: [[for_cond_cleanup:.+]]: +// CHECK: ret void +// CHECK: [[for_body]]: +// CHECK: tail call spir_func void @nodupfun() #[[attr6:[0-9]+]] +// CHECK-NOT: call spir_func void @nodupfun() +// CHECK: br i1 %{{.+}}, label %[[for_body]], label %[[for_cond_cleanup]] + +void test_not_unroll() { + for (int i = 0; i < 10; i++) +nodupfun(); +} + +// CHECK: declare spir_func void @nodupfun(){{[^#]*}} #[[attr3:[0-9]+]] + +// CHECK-DAG: attributes #[[attr2]] = { {{[^}]*}}convergent{{[^}]*}} } +// CHECK-DAG: attributes #[[attr3]] = { {{[^}]*}}noduplicate{{[^}]*}} } +// CHECK-DAG: attributes #[[attr5]] = { {{[^}]*}}convergent{{[^}]*}} } +// CHECK-DAG: attributes #[[attr6]] = { {{[^}]*}}noduplicate{{[^}]*}} } Index: lib/Sema/SemaDeclAttr.cpp === --- lib/Sema/SemaDeclAttr.cpp +++ lib/Sema/SemaDeclAttr.cpp @@ -5809,6 +5809,9 @@ case AttributeList::AT_NoDuplicate: handleSimpleAttribute(S, D, Attr); break; + case AttributeList::AT_Convergent: +handleSimpleAttribute(S, D, Attr); +break; case Attribu
[PATCH] D25522: Remove warnings from google-benchmarks in libcxx
hiraditya created this revision. hiraditya added reviewers: EricWF, mclow.lists. hiraditya added subscribers: sebpop, cfe-commits. https://reviews.llvm.org/D25522 Files: libcxx/benchmarks/ContainerBenchmarks.hpp libcxx/benchmarks/GenerateInput.hpp Index: libcxx/benchmarks/GenerateInput.hpp === --- libcxx/benchmarks/GenerateInput.hpp +++ libcxx/benchmarks/GenerateInput.hpp @@ -112,7 +112,7 @@ inline std::vector getRandomStringInputs(size_t N) { std::vector inputs; -for (int i=0; i < N; ++i) { +for (size_t i=0; i < N; ++i) { inputs.push_back(getRandomString(1024)); } return inputs; Index: libcxx/benchmarks/ContainerBenchmarks.hpp === --- libcxx/benchmarks/ContainerBenchmarks.hpp +++ libcxx/benchmarks/ContainerBenchmarks.hpp @@ -11,10 +11,11 @@ template void BM_ConstructIterIter(benchmark::State& st, Container, GenInputs gen) { auto in = gen(st.range(0)); +const auto begin = in.begin(); const auto end = in.end(); benchmark::DoNotOptimize(&in); while (st.KeepRunning()) { -Container c(in.begin(), in.end()); +Container c(begin, end); benchmark::DoNotOptimize(c.data()); } } Index: libcxx/benchmarks/GenerateInput.hpp === --- libcxx/benchmarks/GenerateInput.hpp +++ libcxx/benchmarks/GenerateInput.hpp @@ -112,7 +112,7 @@ inline std::vector getRandomStringInputs(size_t N) { std::vector inputs; -for (int i=0; i < N; ++i) { +for (size_t i=0; i < N; ++i) { inputs.push_back(getRandomString(1024)); } return inputs; Index: libcxx/benchmarks/ContainerBenchmarks.hpp === --- libcxx/benchmarks/ContainerBenchmarks.hpp +++ libcxx/benchmarks/ContainerBenchmarks.hpp @@ -11,10 +11,11 @@ template void BM_ConstructIterIter(benchmark::State& st, Container, GenInputs gen) { auto in = gen(st.range(0)); +const auto begin = in.begin(); const auto end = in.end(); benchmark::DoNotOptimize(&in); while (st.KeepRunning()) { -Container c(in.begin(), in.end()); +Container c(begin, end); benchmark::DoNotOptimize(c.data()); } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25494: Move x86-64 builtins from SemaChecking.cpp to BuiltinsX86_64.def
agutowski updated this revision to Diff 74398. agutowski added a comment. add -fno-spell-checking to tests https://reviews.llvm.org/D25494 Files: include/clang/Basic/BuiltinsX86.def include/clang/Basic/BuiltinsX86_64.def lib/Basic/Targets.cpp lib/Sema/SemaChecking.cpp test/CodeGen/builtins-x86-disabled.c test/Sema/builtins-x86_64.c Index: lib/Sema/SemaChecking.cpp === --- lib/Sema/SemaChecking.cpp +++ lib/Sema/SemaChecking.cpp @@ -1590,58 +1590,6 @@ return false; } -static bool isX86_64Builtin(unsigned BuiltinID) { - // These builtins only work on x86-64 targets. - switch (BuiltinID) { - case X86::BI__builtin_ia32_addcarryx_u64: - case X86::BI__builtin_ia32_addcarry_u64: - case X86::BI__builtin_ia32_subborrow_u64: - case X86::BI__builtin_ia32_readeflags_u64: - case X86::BI__builtin_ia32_writeeflags_u64: - case X86::BI__builtin_ia32_bextr_u64: - case X86::BI__builtin_ia32_bextri_u64: - case X86::BI__builtin_ia32_bzhi_di: - case X86::BI__builtin_ia32_pdep_di: - case X86::BI__builtin_ia32_pext_di: - case X86::BI__builtin_ia32_crc32di: - case X86::BI__builtin_ia32_fxsave64: - case X86::BI__builtin_ia32_fxrstor64: - case X86::BI__builtin_ia32_xsave64: - case X86::BI__builtin_ia32_xrstor64: - case X86::BI__builtin_ia32_xsaveopt64: - case X86::BI__builtin_ia32_xrstors64: - case X86::BI__builtin_ia32_xsavec64: - case X86::BI__builtin_ia32_xsaves64: - case X86::BI__builtin_ia32_rdfsbase64: - case X86::BI__builtin_ia32_rdgsbase64: - case X86::BI__builtin_ia32_wrfsbase64: - case X86::BI__builtin_ia32_wrgsbase64: - case X86::BI__builtin_ia32_pbroadcastq512_gpr_mask: - case X86::BI__builtin_ia32_pbroadcastq256_gpr_mask: - case X86::BI__builtin_ia32_pbroadcastq128_gpr_mask: - case X86::BI__builtin_ia32_vcvtsd2si64: - case X86::BI__builtin_ia32_vcvtsd2usi64: - case X86::BI__builtin_ia32_vcvtss2si64: - case X86::BI__builtin_ia32_vcvtss2usi64: - case X86::BI__builtin_ia32_vcvttsd2si64: - case X86::BI__builtin_ia32_vcvttsd2usi64: - case X86::BI__builtin_ia32_vcvttss2si64: - case X86::BI__builtin_ia32_vcvttss2usi64: - case X86::BI__builtin_ia32_cvtss2si64: - case X86::BI__builtin_ia32_cvttss2si64: - case X86::BI__builtin_ia32_cvtsd2si64: - case X86::BI__builtin_ia32_cvttsd2si64: - case X86::BI__builtin_ia32_cvtsi2sd64: - case X86::BI__builtin_ia32_cvtsi2ss64: - case X86::BI__builtin_ia32_cvtusi2sd64: - case X86::BI__builtin_ia32_cvtusi2ss64: - case X86::BI__builtin_ia32_rdseed64_step: -return true; - } - - return false; -} - // Check if the rounding mode is legal. bool Sema::CheckX86BuiltinRoundingOrSAE(unsigned BuiltinID, CallExpr *TheCall) { // Indicates if this instruction has rounding control or just SAE. @@ -1838,12 +1786,6 @@ if (BuiltinID == X86::BI__builtin_ms_va_start) return SemaBuiltinMSVAStart(TheCall); - // Check for 64-bit only builtins on a 32-bit target. - const llvm::Triple &TT = Context.getTargetInfo().getTriple(); - if (TT.getArch() != llvm::Triple::x86_64 && isX86_64Builtin(BuiltinID)) -return Diag(TheCall->getCallee()->getLocStart(), -diag::err_x86_builtin_32_bit_tgt); - // If the intrinsic has rounding or SAE make sure its valid. if (CheckX86BuiltinRoundingOrSAE(BuiltinID, TheCall)) return true; Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -2362,6 +2362,8 @@ #define BUILTIN(ID, TYPE, ATTRS) \ { #ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, nullptr }, +#define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) \ + { #ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, FEATURE }, #define TARGET_HEADER_BUILTIN(ID, TYPE, ATTRS, HEADER, LANGS, FEATURE) \ { #ID, TYPE, ATTRS, HEADER, LANGS, FEATURE }, #include "clang/Basic/BuiltinsX86_64.def" Index: include/clang/Basic/BuiltinsX86_64.def === --- include/clang/Basic/BuiltinsX86_64.def +++ include/clang/Basic/BuiltinsX86_64.def @@ -14,6 +14,10 @@ // The format of this database matches clang/Basic/Builtins.def. +#if defined(BUILTIN) && !defined(TARGET_BUILTIN) +# define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS) +#endif + #if defined(BUILTIN) && !defined(TARGET_HEADER_BUILTIN) # define TARGET_HEADER_BUILTIN(ID, TYPE, ATTRS, HEADER, LANG, FEATURE) BUILTIN(ID, TYPE, ATTRS) #endif @@ -25,6 +29,50 @@ TARGET_HEADER_BUILTIN(__faststorefence, "v", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_BUILTIN(__builtin_ia32_readeflags_u64, "ULLi", "n", "") +TARGET_BUILTIN(__builtin_ia32_writeeflags_u64, "vULLi", "n", "") +TARGET_BUILTIN(__builtin_ia32_cvtss2si64, "LLiV4f", "", "sse") +TARGET_BUILTIN(__builtin_ia32_cvttss2si64, "LLiV4f", "", "sse") +TARGET_BUILTIN(__builtin_ia32_cvtsd2si64, "LLiV2d", "", "sse2") +TARGET_BUILTIN(__builtin_ia
r284026 - Move x86-64 builtins from SemaChecking.cpp to BuiltinsX86_64.def
Author: agutowski Date: Wed Oct 12 12:28:44 2016 New Revision: 284026 URL: http://llvm.org/viewvc/llvm-project?rev=284026&view=rev Log: Move x86-64 builtins from SemaChecking.cpp to BuiltinsX86_64.def Summary: Follow-up to https://reviews.llvm.org/D24598 (separating builtins for x84-64 and i386). Reviewers: hans, thakis, rnk Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25494 Added: cfe/trunk/test/Sema/builtins-x86_64.c Removed: cfe/trunk/test/CodeGen/builtins-x86-disabled.c Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def cfe/trunk/include/clang/Basic/BuiltinsX86_64.def cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/lib/Sema/SemaChecking.cpp Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=284026&r1=284025&r2=284026&view=diff == --- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original) +++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Wed Oct 12 12:28:44 2016 @@ -48,9 +48,7 @@ TARGET_BUILTIN(__builtin_ia32_undef512, // FLAGS // TARGET_BUILTIN(__builtin_ia32_readeflags_u32, "Ui", "n", "") -TARGET_BUILTIN(__builtin_ia32_readeflags_u64, "ULLi", "n", "") TARGET_BUILTIN(__builtin_ia32_writeeflags_u32, "vUi", "n", "") -TARGET_BUILTIN(__builtin_ia32_writeeflags_u64, "vULLi", "n", "") // 3DNow! // @@ -310,8 +308,6 @@ TARGET_BUILTIN(__builtin_ia32_stmxcsr, " TARGET_HEADER_BUILTIN(_mm_getcsr, "Ui", "h", "xmmintrin.h", ALL_LANGUAGES, "sse") TARGET_BUILTIN(__builtin_ia32_cvtss2si, "iV4f", "", "sse") TARGET_BUILTIN(__builtin_ia32_cvttss2si, "iV4f", "", "sse") -TARGET_BUILTIN(__builtin_ia32_cvtss2si64, "LLiV4f", "", "sse") -TARGET_BUILTIN(__builtin_ia32_cvttss2si64, "LLiV4f", "", "sse") TARGET_BUILTIN(__builtin_ia32_storehps, "vV2i*V4f", "", "sse") TARGET_BUILTIN(__builtin_ia32_storelps, "vV2i*V4f", "", "sse") TARGET_BUILTIN(__builtin_ia32_movmskps, "iV4f", "", "sse") @@ -338,8 +334,6 @@ TARGET_BUILTIN(__builtin_ia32_cvtpd2ps, TARGET_BUILTIN(__builtin_ia32_cvttpd2dq, "V4iV2d", "", "sse2") TARGET_BUILTIN(__builtin_ia32_cvtsd2si, "iV2d", "", "sse2") TARGET_BUILTIN(__builtin_ia32_cvttsd2si, "iV2d", "", "sse2") -TARGET_BUILTIN(__builtin_ia32_cvtsd2si64, "LLiV2d", "", "sse2") -TARGET_BUILTIN(__builtin_ia32_cvttsd2si64, "LLiV2d", "", "sse2") TARGET_BUILTIN(__builtin_ia32_cvtsd2ss, "V4fV4fV2d", "", "sse2") TARGET_BUILTIN(__builtin_ia32_cvtps2dq, "V4iV4f", "", "sse2") TARGET_BUILTIN(__builtin_ia32_cvttps2dq, "V4iV4f", "", "sse2") @@ -424,7 +418,6 @@ TARGET_BUILTIN(__builtin_ia32_pcmpestriz TARGET_BUILTIN(__builtin_ia32_crc32qi, "UiUiUc", "", "sse4.2") TARGET_BUILTIN(__builtin_ia32_crc32hi, "UiUiUs", "", "sse4.2") TARGET_BUILTIN(__builtin_ia32_crc32si, "UiUiUi", "", "sse4.2") -TARGET_BUILTIN(__builtin_ia32_crc32di, "ULLiULLiULLi", "", "sse4.2") // SSE4a TARGET_BUILTIN(__builtin_ia32_extrqi, "V2LLiV2LLiIcIc", "", "sse4a") @@ -638,65 +631,44 @@ TARGET_BUILTIN(__builtin_ia32_rdrand64_s // FSGSBASE TARGET_BUILTIN(__builtin_ia32_rdfsbase32, "Ui", "", "fsgsbase") -TARGET_BUILTIN(__builtin_ia32_rdfsbase64, "ULLi", "", "fsgsbase") TARGET_BUILTIN(__builtin_ia32_rdgsbase32, "Ui", "", "fsgsbase") -TARGET_BUILTIN(__builtin_ia32_rdgsbase64, "ULLi", "", "fsgsbase") TARGET_BUILTIN(__builtin_ia32_wrfsbase32, "vUi", "", "fsgsbase") -TARGET_BUILTIN(__builtin_ia32_wrfsbase64, "vULLi", "", "fsgsbase") TARGET_BUILTIN(__builtin_ia32_wrgsbase32, "vUi", "", "fsgsbase") -TARGET_BUILTIN(__builtin_ia32_wrgsbase64, "vULLi", "", "fsgsbase") // FXSR TARGET_BUILTIN(__builtin_ia32_fxrstor, "vv*", "", "fxsr") -TARGET_BUILTIN(__builtin_ia32_fxrstor64, "vv*", "", "fxsr") TARGET_BUILTIN(__builtin_ia32_fxsave, "vv*", "", "fxsr") -TARGET_BUILTIN(__builtin_ia32_fxsave64, "vv*", "", "fxsr") // XSAVE TARGET_BUILTIN(__builtin_ia32_xsave, "vv*ULLi", "", "xsave") -TARGET_BUILTIN(__builtin_ia32_xsave64, "vv*ULLi", "", "xsave") TARGET_BUILTIN(__builtin_ia32_xrstor, "vv*ULLi", "", "xsave") -TARGET_BUILTIN(__builtin_ia32_xrstor64, "vv*ULLi", "", "xsave") TARGET_BUILTIN(__builtin_ia32_xsaveopt, "vv*ULLi", "", "xsaveopt") -TARGET_BUILTIN(__builtin_ia32_xsaveopt64, "vv*ULLi", "", "xsaveopt") TARGET_BUILTIN(__builtin_ia32_xrstors, "vv*ULLi", "", "xsaves") -TARGET_BUILTIN(__builtin_ia32_xrstors64, "vv*ULLi", "", "xsaves") TARGET_BUILTIN(__builtin_ia32_xsavec, "vv*ULLi", "", "xsavec") -TARGET_BUILTIN(__builtin_ia32_xsavec64, "vv*ULLi", "", "xsavec") TARGET_BUILTIN(__builtin_ia32_xsaves, "vv*ULLi", "", "xsaves") -TARGET_BUILTIN(__builtin_ia32_xsaves64, "vv*ULLi", "", "xsaves") //CLFLUSHOPT TARGET_BUILTIN(__builtin_ia32_clflushopt, "vc*", "", "clflushopt") // ADX TARGET_BUILTIN(__builtin_ia32_addcarryx_u32, "UcUcUiUiUi*", "", "adx") -TARGET_BUILTIN(__builtin_ia32_addcarryx_u64, "UcUcULLiULLiULLi*", "", "adx") TARGET_BUILTIN(__builtin_ia32_addcarry_u32, "UcUcUiUiUi*", "", "") -TARGET_BUILTIN
[PATCH] D25519: [CodeCompletion] Refactor: Extract two Objective-C block formatting related functions from FormatFunctionParameter
manmanren added a comment. Cheers, Manman Comment at: lib/Sema/SemaCodeComplete.cpp:2165 +static void findTypeLocationForBlockDecl(const TypeSourceInfo *TSInfo, + FunctionTypeLoc &Block, Please add comments for the helper function. Comment at: lib/Sema/SemaCodeComplete.cpp:2279 +static std::string +formatBlockPlaceholder(const PrintingPolicy &Policy, const NamedDecl *BlockDecl, + FunctionTypeLoc &Block, FunctionProtoTypeLoc &BlockProto, Comments here as well. Repository: rL LLVM https://reviews.llvm.org/D25519 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D22955: [MSVC] Improved late parsing of template functions.
majnemer added inline comments. Comment at: lib/Sema/SemaLookup.cpp:1044-1070 +static bool isBaseClass(const CXXRecordDecl *Record, CXXRecordDecl *Base) { + SmallVector Queue; + + while (true) { +for (const auto &I : Record->bases()) { + const RecordType *Ty = I.getType()->getAs(); + if (!Ty) This looks a lot like forallBases, any chance it could be reused? https://reviews.llvm.org/D22955 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25491: [libcxx] Use C++14 when building libc++ with musl
phosek updated this revision to Diff 74402. phosek marked an inline comment as done. Repository: rL LLVM https://reviews.llvm.org/D25491 Files: CMakeLists.txt Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -325,6 +325,9 @@ # Required flags == set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build dialect") +if (LIBCXX_HAS_MUSL_LIBC) + set(LIBCXX_STANDARD_VER c++14) +endif() add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER}) mangle_name("LIBCXX_SUPPORTS_STD_EQ_${LIBCXX_STANDARD_VER}_FLAG" SUPPORTS_DIALECT_NAME) if (NOT MSVC AND NOT ${SUPPORTS_DIALECT_NAME}) Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -325,6 +325,9 @@ # Required flags == set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build dialect") +if (LIBCXX_HAS_MUSL_LIBC) + set(LIBCXX_STANDARD_VER c++14) +endif() add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER}) mangle_name("LIBCXX_SUPPORTS_STD_EQ_${LIBCXX_STANDARD_VER}_FLAG" SUPPORTS_DIALECT_NAME) if (NOT MSVC AND NOT ${SUPPORTS_DIALECT_NAME}) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25406: Fix doubled whitespace in modernize-use-auto fixit
aaron.ballman added inline comments. Comment at: clang-tidy/modernize/UseAutoCheck.cpp:378 + Lexer::getLocForEndOfToken(Range.getEnd(), 0, SM, Context->getLangOpts()); + bool Whitespace = isWhitespace(*FullSourceLoc(Next, SM).getCharacterData()); + malcolm.parsons wrote: > aaron.ballman wrote: > > malcolm.parsons wrote: > > > aaron.ballman wrote: > > > > Oye, this is deceptively expensive because you now have to go back to > > > > the actual source file for this information. That source file may live > > > > on a network share somewhere, for instance. > > > > > > > > Can you use `Token::hasLeadingSpace()` instead? > > > > > > > > Also, doesn't this still need to care about the `RemoveStars` option? > > > Where would I get a Token from? > > Hrm, might not be as trivial as I was hoping (I thought we had a way to go > > from a `SourceLocation` back to a `Token`, but I'm not seeing one > > off-hand). Regardless, I worry about the expense of going all the way back > > to the source for this. > > > > @alexfh -- should this functionality be a part of a more general "we've > > made a fixit, now make it not look ugly?" pass? At least then, if we go > > back to the source, we can do it in a more controlled manner and hopefully > > get some performance back from that. > `LineIsMarkedWithNOLINT` is going to read the source anyway, so I don't see > any additional expense. The additional expense comes from many checks needing similar functionality -- generally, fixit replacements are going to require formatting modifications of some sort. It's better to handle all of those in the same place and transparently rather than have every check with a fixit manually handle formatting. Additionally, this means we can go back to the source as infrequently as possible. https://reviews.llvm.org/D25406 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25343: [OpenCL] Mark group functions as convergent in opencl-c.h
aaron.ballman added inline comments. Comment at: include/clang/Basic/AttrDocs.td:612 + let Content = [{ +The ``convergent`` attribute can be placed on function declarations. It is +translated to LLVM ``convergent`` attribute, which indicates the call on a function declaration Comment at: include/clang/Basic/AttrDocs.td:613 +The ``convergent`` attribute can be placed on function declarations. It is +translated to LLVM ``convergent`` attribute, which indicates the call +instructions of a function with this attribute cannot be made control-dependent s/to/into the s/the call/that the call Comment at: include/clang/Basic/AttrDocs.td:621 + +This attribute is different from ``noduplicate`` since it allows duplicating +function calls if it can be proved that the duplicated function calls are s/since/because Comment at: include/clang/Basic/AttrDocs.td:629 + + void convfunc() __attribute__((convergent)); + // Setting it as a C++11 attribute is also valid Since this is a C block, perhaps that should be `void convfunc(void)` instead? Comment at: test/CodeGenOpenCL/convergent.cl:118 +// CHECK-DAG: attributes #[[attr5]] = { {{[^}]*}}convergent{{[^}]*}} } +// CHECK-DAG: attributes #[[attr6]] = { {{[^}]*}}noduplicate{{[^}]*}} } Missing the Sema tests for the attribute's semantics (applies only to functions, accepts no args, etc). https://reviews.llvm.org/D25343 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r284008 - Reinstate r283887 and r283882.
Hi Vassil, Any change between this commit and “r283887 + r283882”? And what was the issue that caused the revert? Thanks, Manman > On Oct 12, 2016, at 4:57 AM, Vassil Vassilev via cfe-commits > wrote: > > Author: vvassilev > Date: Wed Oct 12 06:57:08 2016 > New Revision: 284008 > > URL: http://llvm.org/viewvc/llvm-project?rev=284008&view=rev > Log: > Reinstate r283887 and r283882. > > Original message: > "[modules] PR28752: Do not instantiate variable declarations which are not > visible. > > https://reviews.llvm.org/D24508 > > Patch developed in collaboration with Richard Smith!" > > Added: >cfe/trunk/test/Modules/Inputs/PR28752/ >cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/ >cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/b.h >cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/c.h >cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/module.modulemap >cfe/trunk/test/Modules/Inputs/PR28752/a.h >cfe/trunk/test/Modules/Inputs/PR28752/module.modulemap >cfe/trunk/test/Modules/Inputs/PR28752/vector >cfe/trunk/test/Modules/pr28752.cpp > Modified: >cfe/trunk/include/clang/AST/Decl.h >cfe/trunk/lib/AST/Decl.cpp >cfe/trunk/lib/Sema/SemaDecl.cpp >cfe/trunk/lib/Sema/SemaTemplate.cpp >cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp >cfe/trunk/lib/Sema/SemaType.cpp >cfe/trunk/lib/Serialization/ASTReaderDecl.cpp >cfe/trunk/lib/Serialization/ASTWriterDecl.cpp > > Modified: cfe/trunk/include/clang/AST/Decl.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=284008&r1=284007&r2=284008&view=diff > == > --- cfe/trunk/include/clang/AST/Decl.h (original) > +++ cfe/trunk/include/clang/AST/Decl.h Wed Oct 12 06:57:08 2016 > @@ -865,6 +865,11 @@ protected: > > unsigned : NumVarDeclBits; > > +// FIXME: We need something similar to CXXRecordDecl::DefinitionData. > +/// \brief Whether this variable is a definition which was demoted due to > +/// module merge. > +unsigned IsThisDeclarationADemotedDefinition : 1; > + > /// \brief Whether this variable is the exception variable in a C++ catch > /// or an Objective-C @catch statement. > unsigned ExceptionVar : 1; > @@ -1198,12 +1203,28 @@ public: > InitializationStyle getInitStyle() const { > return static_cast(VarDeclBits.InitStyle); > } > - > /// \brief Whether the initializer is a direct-initializer (list or call). > bool isDirectInit() const { > return getInitStyle() != CInit; > } > > + /// \brief If this definition should pretend to be a declaration. > + bool isThisDeclarationADemotedDefinition() const { > +return isa(this) ? false : > + NonParmVarDeclBits.IsThisDeclarationADemotedDefinition; > + } > + > + /// \brief This is a definition which should be demoted to a declaration. > + /// > + /// In some cases (mostly module merging) we can end up with two visible > + /// definitions one of which needs to be demoted to a declaration to keep > + /// the AST invariants. > + void demoteThisDefinitionToDeclaration() { > +assert (isThisDeclarationADefinition() && "Not a definition!"); > +assert (!isa(this) && "Cannot demote ParmVarDecls!"); > +NonParmVarDeclBits.IsThisDeclarationADemotedDefinition = 1; > + } > + > /// \brief Determine whether this variable is the exception variable in a > /// C++ catch statememt or an Objective-C \@catch statement. > bool isExceptionVariable() const { > @@ -1302,6 +1323,10 @@ public: > NonParmVarDeclBits.PreviousDeclInSameBlockScope = Same; > } > > + /// \brief Retrieve the variable declaration from which this variable could > + /// be instantiated, if it is an instantiation (rather than a > non-template). > + VarDecl *getTemplateInstantiationPattern() const; > + > /// \brief If this variable is an instantiated static data member of a > /// class template specialization, returns the templated static data member > /// from which it was instantiated. > > Modified: cfe/trunk/lib/AST/Decl.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=284008&r1=284007&r2=284008&view=diff > == > --- cfe/trunk/lib/AST/Decl.cpp (original) > +++ cfe/trunk/lib/AST/Decl.cpp Wed Oct 12 06:57:08 2016 > @@ -1926,6 +1926,9 @@ VarDecl::isThisDeclarationADefinition(AS > // > // FIXME: How do you declare (but not define) a partial specialization of > // a static data member template outside the containing class? > + if (isThisDeclarationADemotedDefinition()) > +return DeclarationOnly; > + > if (isStaticDataMember()) { > if (isOutOfLine() && > !(getCanonicalDecl()->isInline() && > @@ -2250,6 +2253,56 @@ bool VarDecl::checkInitIsICE() const { > return Eval->IsICE; > } > > +VarDecl *VarDecl::getTemplateInstantiationPattern() const { > + // If it's a variable template sp
[PATCH] D25520: [CodeCompletion] Add block placeholders when completing member access for Objective-C block property setters
akyrtzi added a comment. What if the user just wants to invoke the block, this is as common or more, like: `self.onEventHandler(10)` The assign literal completion is useful but it should be an additional entry (with maybe lower priority) not replace the property completion. BTW, it would be great we had completion as if it was a function call, so 2 entries, 1 for block invocation and 1 for assigning literal. Absence the block invocation call it should be 1 for normal property completion and 1 for assigning literal. Repository: rL LLVM https://reviews.llvm.org/D25520 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284029 - Document potential implementation of CFI in hardware.
Author: kcc Date: Wed Oct 12 13:33:54 2016 New Revision: 284029 URL: http://llvm.org/viewvc/llvm-project?rev=284029&view=rev Log: Document potential implementation of CFI in hardware. Summary: Document potential implementation of CFI in hardware. Reviewers: eugenis, pcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25455 Modified: cfe/trunk/docs/ControlFlowIntegrityDesign.rst Modified: cfe/trunk/docs/ControlFlowIntegrityDesign.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ControlFlowIntegrityDesign.rst?rev=284029&r1=284028&r2=284029&view=diff == --- cfe/trunk/docs/ControlFlowIntegrityDesign.rst (original) +++ cfe/trunk/docs/ControlFlowIntegrityDesign.rst Wed Oct 12 13:33:54 2016 @@ -497,3 +497,57 @@ Cross-DSO CFI mode requires that the mai In non-PIE executables the address of an external function (taken from the main executable) is the address of that functionâs PLT record in the main executable. This would break the CFI checks. + + +Hardware support + + +We believe that the above design can be efficiently implemented in hardware. +A single new instruction added to an ISA would allow to perform the CFI check +with fewer bytes per check (smaller code size overhead) and potentially more +efficiently. The current software-only instrumentation requires at least +32-bytes per check (on x86_64). +A hardware instruction may probably be less than ~ 12 bytes. +Such instruction would check that the argument pointer is in-bounds, +and is properly aligned, and if the checks fail it will either trap (in monolithic scheme) +or call the slow path function (cross-DSO scheme). +The bit vector lookup is probably too complex for a hardware implementation. + +.. code-block:: none + + // This instruction checks that 'Ptr' + // * is aligned by (1 << kAlignment) and + // * is inside [kRangeBeg, kRangeBeg+(kRangeSize<= kRangeBeg + (kRangeSize << kAlignment) || + Ptr & ((1 << kAlignment) - 1)) + Jump(kFailedCheckTarget); + } + +An alternative and more compact enconding would not use `kFailedCheckTarget`, +and will trap on check failure instead. +This will allow us to fit the instruction into **8-9 bytes**. +The cross-DSO checks will be performed by a trap handler and +performance-critical ones will have to be black-listed and checked using the +software-only scheme. + +Note that such hardware extension would be complementary to checks +at the callee side, such as e.g. **Intel ENDBRANCH**. +Moreover, CFI would have two benefits over ENDBRANCH: a) precision and b) +ability to protect against invalid casts between polymorphic types. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25491: [libcxx] Use C++14 when building libc++ with musl
hfinkel added inline comments. Comment at: CMakeLists.txt:327 # Required flags == set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build dialect") add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER}) EricWF wrote: > phosek wrote: > > EricWF wrote: > > > Why not just set `LIBCXX_STANDARD_VER` differently instead of replacing > > > it after the fact? > > I totally missed it; this change was a part of a downstream patch we were > > using for building Fuchsia toolchain and it predates this option. Using > > this option, I can override the dialect only for our build, which is > > perfectly fine for Fuchsia since we default to C++14. I'd be happy to > > abandon this patch unless you want to persist that setting for musl? > Since we support MUSL it would be nice if libc++ built out of the box. Making > the option persistent for MUSL makes the most sense to me. We should add a comment here, or where ever this logic ends up going, to explain why this is needed. Repository: rL LLVM https://reviews.llvm.org/D25491 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25503: [analyzer] Remove superquadratic behaviour from DataflowWorklist
zaks.anna added a comment. Do you have results that show how this effects performance on average code and machine generated code? One concern is that multiset is malloc intensive. See http://llvm.org/docs/ProgrammersManual.html#picking-the-right-data-structure-for-a-task. Maybe SparseSet/SparseMultiSet would be better? Comment at: lib/Analysis/LiveVariables.cpp:66 return nullptr; - const CFGBlock *b = worklist.pop_back_val(); + const auto I = --worklist.end(); + const CFGBlock *b = *I; '--wroklist.end()' -> 'worklist.rbegin()'? Repository: rL LLVM https://reviews.llvm.org/D25503 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25439: Fixed column shift when formatting line containing bit shift operators
idlecode updated this revision to Diff 74412. https://reviews.llvm.org/D25439 Files: lib/Format/FormatTokenLexer.cpp unittests/Format/FormatTest.cpp Index: unittests/Format/FormatTest.cpp === --- unittests/Format/FormatTest.cpp +++ unittests/Format/FormatTest.cpp @@ -11361,6 +11361,16 @@ "llvm::outs()\n<<"); } +TEST_F(FormatTest, BitshiftOperatorWidth) { + std::string left = "int a = 1 << 2; /* foo\n" + " bar */"; + EXPECT_EQ(left, format(left)); + + std::string right = "int b = 256 >> 2; /* foo\n" + " bar */"; + EXPECT_EQ(right, format(right)); +} + TEST_F(FormatTest, HandleUnbalancedImplicitBracesAcrossPPBranches) { std::string code = "#if A\n" "#if B\n" Index: lib/Format/FormatTokenLexer.cpp === --- lib/Format/FormatTokenLexer.cpp +++ lib/Format/FormatTokenLexer.cpp @@ -525,10 +525,12 @@ } else if (FormatTok->Tok.is(tok::greatergreater)) { FormatTok->Tok.setKind(tok::greater); FormatTok->TokenText = FormatTok->TokenText.substr(0, 1); +Column += 1; StateStack.push(LexerState::TOKEN_STASHED); } else if (FormatTok->Tok.is(tok::lessless)) { FormatTok->Tok.setKind(tok::less); FormatTok->TokenText = FormatTok->TokenText.substr(0, 1); +Column += 1; StateStack.push(LexerState::TOKEN_STASHED); } Index: unittests/Format/FormatTest.cpp === --- unittests/Format/FormatTest.cpp +++ unittests/Format/FormatTest.cpp @@ -11361,6 +11361,16 @@ "llvm::outs()\n<<"); } +TEST_F(FormatTest, BitshiftOperatorWidth) { + std::string left = "int a = 1 << 2; /* foo\n" + " bar */"; + EXPECT_EQ(left, format(left)); + + std::string right = "int b = 256 >> 2; /* foo\n" + " bar */"; + EXPECT_EQ(right, format(right)); +} + TEST_F(FormatTest, HandleUnbalancedImplicitBracesAcrossPPBranches) { std::string code = "#if A\n" "#if B\n" Index: lib/Format/FormatTokenLexer.cpp === --- lib/Format/FormatTokenLexer.cpp +++ lib/Format/FormatTokenLexer.cpp @@ -525,10 +525,12 @@ } else if (FormatTok->Tok.is(tok::greatergreater)) { FormatTok->Tok.setKind(tok::greater); FormatTok->TokenText = FormatTok->TokenText.substr(0, 1); +Column += 1; StateStack.push(LexerState::TOKEN_STASHED); } else if (FormatTok->Tok.is(tok::lessless)) { FormatTok->Tok.setKind(tok::less); FormatTok->TokenText = FormatTok->TokenText.substr(0, 1); +Column += 1; StateStack.push(LexerState::TOKEN_STASHED); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25503: [analyzer] Remove superquadratic behaviour from DataflowWorklist
NoQ added a reviewer: a.sidorin. NoQ added a comment. This looks familiar, i think i've seen significant slowdowns around there on some very rare files. Nice catch! Probably a binary-search insert could have also been much better than re-sorting, even if it's still a vector. Repository: rL LLVM https://reviews.llvm.org/D25503 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284032 - Declare WinX86_64ABIInfo to satisfy SwiftABI info
Author: arnolds Date: Wed Oct 12 13:59:24 2016 New Revision: 284032 URL: http://llvm.org/viewvc/llvm-project?rev=284032&view=rev Log: Declare WinX86_64ABIInfo to satisfy SwiftABI info This is minimal support that allows swift's test cases on non windows platforms to pass. rdar://28738985 Added: cfe/trunk/test/CodeGen/windows-swiftcall.c Modified: cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/lib/CodeGen/TargetInfo.cpp cfe/trunk/test/Sema/attr-swiftcall.c Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=284032&r1=284031&r2=284032&view=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Wed Oct 12 13:59:24 2016 @@ -4551,6 +4551,7 @@ public: case CC_X86VectorCall: case CC_IntelOclBicc: case CC_X86_64SysV: +case CC_Swift: return CCCR_OK; default: return CCCR_Warning; Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=284032&r1=284031&r2=284032&view=diff == --- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Wed Oct 12 13:59:24 2016 @@ -2003,10 +2003,10 @@ public: }; /// WinX86_64ABIInfo - The Windows X86_64 ABI information. -class WinX86_64ABIInfo : public ABIInfo { +class WinX86_64ABIInfo : public SwiftABIInfo { public: WinX86_64ABIInfo(CodeGen::CodeGenTypes &CGT) - : ABIInfo(CGT), + : SwiftABIInfo(CGT), IsMingw64(getTarget().getTriple().isWindowsGNUEnvironment()) {} void computeInfo(CGFunctionInfo &FI) const override; @@ -2025,6 +2025,12 @@ public: return isX86VectorCallAggregateSmallEnough(NumMembers); } + bool shouldPassIndirectlyForSwift(CharUnits totalSize, +ArrayRef scalars, +bool asReturnValue) const override { +return occupiesMoreThan(CGT, scalars, /*total*/ 4); + } + private: ABIArgInfo classify(QualType Ty, unsigned &FreeSSERegs, bool IsReturnType) const; Added: cfe/trunk/test/CodeGen/windows-swiftcall.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/windows-swiftcall.c?rev=284032&view=auto == --- cfe/trunk/test/CodeGen/windows-swiftcall.c (added) +++ cfe/trunk/test/CodeGen/windows-swiftcall.c Wed Oct 12 13:59:24 2016 @@ -0,0 +1,459 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-windows -emit-llvm -o - %s | FileCheck %s + +#define SWIFTCALL __attribute__((swiftcall)) +#define OUT __attribute__((swift_indirect_result)) +#define ERROR __attribute__((swift_error_result)) +#define CONTEXT __attribute__((swift_context)) + +// CHECK: [[STRUCT2_RESULT:@.*]] = private {{.*}} constant [[STRUCT2_TYPE:%.*]] { i32 0, i8 0, i8 undef, i8 0, float 0.00e+00, float 0.00e+00 } + +/*/ +/** PARAMETER ABIS ***/ +/*/ + +SWIFTCALL void indirect_result_1(OUT int *arg0, OUT float *arg1) {} +// CHECK-LABEL: define {{.*}} void @indirect_result_1(i32* noalias sret align 4 dereferenceable(4){{.*}}, float* noalias align 4 dereferenceable(4){{.*}}) + +// TODO: maybe this shouldn't suppress sret. +SWIFTCALL int indirect_result_2(OUT int *arg0, OUT float *arg1) { __builtin_unreachable(); } +// CHECK-LABEL: define {{.*}} i32 @indirect_result_2(i32* noalias align 4 dereferenceable(4){{.*}}, float* noalias align 4 dereferenceable(4){{.*}}) + +typedef struct { char array[1024]; } struct_reallybig; +SWIFTCALL struct_reallybig indirect_result_3(OUT int *arg0, OUT float *arg1) { __builtin_unreachable(); } +// CHECK-LABEL: define {{.*}} void @indirect_result_3({{.*}}* noalias sret {{.*}}, i32* noalias align 4 dereferenceable(4){{.*}}, float* noalias align 4 dereferenceable(4){{.*}}) + +SWIFTCALL void context_1(CONTEXT void *self) {} +// CHECK-LABEL: define {{.*}} void @context_1(i8* swiftself + +SWIFTCALL void context_2(void *arg0, CONTEXT void *self) {} +// CHECK-LABEL: define {{.*}} void @context_2(i8*{{.*}}, i8* swiftself + +SWIFTCALL void context_error_1(CONTEXT int *self, ERROR float **error) {} +// CHECK-LABEL: define {{.*}} void @context_error_1(i32* swiftself{{.*}}, float** swifterror) +// CHECK: [[TEMP:%.*]] = alloca float*, align 8 +// CHECK: [[T0:%.*]] = load float*, float** [[ERRORARG:%.*]], align 8 +// CHECK: store float* [[T0]], float** [[TEMP]], align 8 +// CHECK: [[T0:%.*]] = load float*, float** [[TEMP]], align 8 +// CHECK: store float* [[T0]], float** [[ERRORARG]], align 8 +void test_context_error_1() {
r284033 - [NFC] Trial change to remove a redundant blank line.
Author: ygao Date: Wed Oct 12 14:33:33 2016 New Revision: 284033 URL: http://llvm.org/viewvc/llvm-project?rev=284033&view=rev Log: [NFC] Trial change to remove a redundant blank line. Modified: cfe/trunk/lib/Headers/xmmintrin.h Modified: cfe/trunk/lib/Headers/xmmintrin.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/xmmintrin.h?rev=284033&r1=284032&r2=284033&view=diff == --- cfe/trunk/lib/Headers/xmmintrin.h (original) +++ cfe/trunk/lib/Headers/xmmintrin.h Wed Oct 12 14:33:33 2016 @@ -1727,7 +1727,6 @@ _mm_loadr_ps(const float *__p) /// This intrinsic has no corresponding instruction. /// /// \returns A 128-bit vector of [4 x float] containing undefined values. - static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_undefined_ps(void) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25531: [libcxx] [test] Include in string_view::copy test
BillyONeal created this revision. BillyONeal added reviewers: EricWF, mclow.lists. BillyONeal added a subscriber: cfe-commits. The string_view::copy test calls std::min, which is not required to be made available by including . (The MSVC++ STL does not use std::min internally because we need to avoid the *macro* named min which is defined by windows.h) https://reviews.llvm.org/D25531 Files: test/std/strings/string.view/string.view.ops/copy.pass.cpp Index: test/std/strings/string.view/string.view.ops/copy.pass.cpp === --- test/std/strings/string.view/string.view.ops/copy.pass.cpp +++ test/std/strings/string.view/string.view.ops/copy.pass.cpp @@ -19,6 +19,7 @@ #include +#include #include #include "test_macros.h" Index: test/std/strings/string.view/string.view.ops/copy.pass.cpp === --- test/std/strings/string.view/string.view.ops/copy.pass.cpp +++ test/std/strings/string.view/string.view.ops/copy.pass.cpp @@ -19,6 +19,7 @@ #include +#include #include #include "test_macros.h" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25531: [libcxx] [test] Include in string_view::copy test
EricWF accepted this revision. EricWF added a comment. This revision is now accepted and ready to land. @BillyONeal Do you have commit access? https://reviews.llvm.org/D25531 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25531: [libcxx] [test] Include in string_view::copy test
BillyONeal added a comment. No, I don't believe any of us in MSVC++ land have commit access. https://reviews.llvm.org/D25531 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25406: Fix doubled whitespace in modernize-use-auto fixit
malcolm.parsons added inline comments. Comment at: clang-tidy/modernize/UseAutoCheck.cpp:378 + Lexer::getLocForEndOfToken(Range.getEnd(), 0, SM, Context->getLangOpts()); + bool Whitespace = isWhitespace(*FullSourceLoc(Next, SM).getCharacterData()); + aaron.ballman wrote: > malcolm.parsons wrote: > > aaron.ballman wrote: > > > malcolm.parsons wrote: > > > > aaron.ballman wrote: > > > > > Oye, this is deceptively expensive because you now have to go back to > > > > > the actual source file for this information. That source file may > > > > > live on a network share somewhere, for instance. > > > > > > > > > > Can you use `Token::hasLeadingSpace()` instead? > > > > > > > > > > Also, doesn't this still need to care about the `RemoveStars` option? > > > > Where would I get a Token from? > > > Hrm, might not be as trivial as I was hoping (I thought we had a way to > > > go from a `SourceLocation` back to a `Token`, but I'm not seeing one > > > off-hand). Regardless, I worry about the expense of going all the way > > > back to the source for this. > > > > > > @alexfh -- should this functionality be a part of a more general "we've > > > made a fixit, now make it not look ugly?" pass? At least then, if we go > > > back to the source, we can do it in a more controlled manner and > > > hopefully get some performance back from that. > > `LineIsMarkedWithNOLINT` is going to read the source anyway, so I don't see > > any additional expense. > The additional expense comes from many checks needing similar functionality > -- generally, fixit replacements are going to require formatting > modifications of some sort. It's better to handle all of those in the same > place and transparently rather than have every check with a fixit manually > handle formatting. Additionally, this means we can go back to the source as > infrequently as possible. I ran strace -c on clang-tidy on several real world source files that modernize-use-auto warns about before and after this change and the counts for read, write, stat, open, close, openat and fstat syscalls were all unchanged. The expense is exactly zero. It will still be zero when multiplied by many checks. There is no performance issue here. Do you have any other issues with this change? https://reviews.llvm.org/D25406 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25503: [analyzer] Remove superquadratic behaviour from DataflowWorklist
alexshap added inline comments. Comment at: lib/Analysis/LiveVariables.cpp:66 return nullptr; - const CFGBlock *b = worklist.pop_back_val(); + const auto I = --worklist.end(); + const CFGBlock *b = *I; zaks.anna wrote: > '--wroklist.end()' -> 'worklist.rbegin()'? 1. rbegin - OK - will update the diff 2. regarding http://llvm.org/docs/doxygen/html/classllvm_1_1SparseSet.html and http://llvm.org/docs/ProgrammersManual.html#set-like-containers-std-set-smallset-setvector-etc (i took a look at it before) - the problem is that i don't see any containers which take a custom comparator & provide "ordered set"-like functionality there. 3. regarding the performance - i can run static analyzer against LLVM and measure the time (compare the old version with this one). Will post the results here. Repository: rL LLVM https://reviews.llvm.org/D25503 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25406: Fix doubled whitespace in modernize-use-auto fixit
aaron.ballman added inline comments. Comment at: clang-tidy/modernize/UseAutoCheck.cpp:378 + Lexer::getLocForEndOfToken(Range.getEnd(), 0, SM, Context->getLangOpts()); + bool Whitespace = isWhitespace(*FullSourceLoc(Next, SM).getCharacterData()); + malcolm.parsons wrote: > aaron.ballman wrote: > > malcolm.parsons wrote: > > > aaron.ballman wrote: > > > > malcolm.parsons wrote: > > > > > aaron.ballman wrote: > > > > > > Oye, this is deceptively expensive because you now have to go back > > > > > > to the actual source file for this information. That source file > > > > > > may live on a network share somewhere, for instance. > > > > > > > > > > > > Can you use `Token::hasLeadingSpace()` instead? > > > > > > > > > > > > Also, doesn't this still need to care about the `RemoveStars` > > > > > > option? > > > > > Where would I get a Token from? > > > > Hrm, might not be as trivial as I was hoping (I thought we had a way to > > > > go from a `SourceLocation` back to a `Token`, but I'm not seeing one > > > > off-hand). Regardless, I worry about the expense of going all the way > > > > back to the source for this. > > > > > > > > @alexfh -- should this functionality be a part of a more general "we've > > > > made a fixit, now make it not look ugly?" pass? At least then, if we go > > > > back to the source, we can do it in a more controlled manner and > > > > hopefully get some performance back from that. > > > `LineIsMarkedWithNOLINT` is going to read the source anyway, so I don't > > > see any additional expense. > > The additional expense comes from many checks needing similar functionality > > -- generally, fixit replacements are going to require formatting > > modifications of some sort. It's better to handle all of those in the same > > place and transparently rather than have every check with a fixit manually > > handle formatting. Additionally, this means we can go back to the source as > > infrequently as possible. > I ran strace -c on clang-tidy on several real world source files that > modernize-use-auto warns about before and after this change and the counts > for read, write, stat, open, close, openat and fstat syscalls were all > unchanged. > The expense is exactly zero. > It will still be zero when multiplied by many checks. > There is no performance issue here. > Do you have any other issues with this change? Thank you for running strace to see what the behavior is. From what I understand, this is hard to judge because it depends on when the SourceManager elects to drop its underlying memory buffer (if at all). We definitely try to avoid going back to source when possible in Clang; I think clang-tidy should take a similar policy. I don't think the fix you have is incorrect. I am, however, not convinced this is the best way to solve the problem because we're playing whack-a-mole with fixing replacements already, and this is one more instance of such need. @alexfh had suggested (in a different review thread about a similar need) that we solve this through a convenient bottleneck (such as the diagnostics engine) that basically runs clang-format over replaced text, handles extraneous commas, etc and I would prefer to hear if efforts are being made/planned for that approach before committing another one-off solution. The extra space included in the current behavior is not a correctness issue, so I'm not too worried about getting this fix in immediately if there's work in progress on a better approach. https://reviews.llvm.org/D25406 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25503: [analyzer] Remove superquadratic behaviour from DataflowWorklist
alexshap added inline comments. Comment at: lib/Analysis/LiveVariables.cpp:66 return nullptr; - const CFGBlock *b = worklist.pop_back_val(); + const auto I = --worklist.end(); + const CFGBlock *b = *I; alexshap wrote: > zaks.anna wrote: > > '--wroklist.end()' -> 'worklist.rbegin()'? > 1. rbegin - OK - will update the diff > 2. regarding http://llvm.org/docs/doxygen/html/classllvm_1_1SparseSet.html > and > http://llvm.org/docs/ProgrammersManual.html#set-like-containers-std-set-smallset-setvector-etc > (i took a look at it before) - the problem is that i don't see any containers > which take a custom comparator & provide "ordered set"-like functionality > there. > 3. regarding the performance - i can run static analyzer against LLVM and > measure the time (compare the old version with this one). Will post the > results here. 4. Will test the approach suggested by @NoQ as well. Repository: rL LLVM https://reviews.llvm.org/D25503 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24644: Pass -ffunction-sections/-fdata-sections along to gold-plugin
mehdi_amini accepted this revision. mehdi_amini added a comment. This revision is now accepted and ready to land. LGTM. https://reviews.llvm.org/D24644 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25503: [analyzer] Remove superquadratic behaviour from DataflowWorklist
alexshap added inline comments. Comment at: lib/Analysis/LiveVariables.cpp:66 return nullptr; - const CFGBlock *b = worklist.pop_back_val(); + const auto I = --worklist.end(); + const CFGBlock *b = *I; alexshap wrote: > alexshap wrote: > > zaks.anna wrote: > > > '--wroklist.end()' -> 'worklist.rbegin()'? > > 1. rbegin - OK - will update the diff > > 2. regarding http://llvm.org/docs/doxygen/html/classllvm_1_1SparseSet.html > > and > > http://llvm.org/docs/ProgrammersManual.html#set-like-containers-std-set-smallset-setvector-etc > > (i took a look at it before) - the problem is that i don't see any > > containers which take a custom comparator & provide "ordered set"-like > > functionality there. > > 3. regarding the performance - i can run static analyzer against LLVM and > > measure the time (compare the old version with this one). Will post the > > results here. > 4. Will test the approach suggested by @NoQ as well. actually it looks like llvm::PriorityQueue might work here - will check. Repository: rL LLVM https://reviews.llvm.org/D25503 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r284047 - Disable trivial pair copy/move tests when unsupported
Author: dim Date: Wed Oct 12 15:26:47 2016 New Revision: 284047 URL: http://llvm.org/viewvc/llvm-project?rev=284047&view=rev Log: Disable trivial pair copy/move tests when unsupported Summary: On FreeBSD, for ABI compatibility reasons, the pair trivial copy constructor is disabled, using the aptly-named `_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR` define. Disable the related tests when this define is on, so they don't fail unexpectedly. Reviewers: emaste, rsmith, theraven, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25449 Modified: libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp Modified: libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp?rev=284047&r1=284046&r2=284047&view=diff == --- libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp Wed Oct 12 15:26:47 2016 @@ -32,19 +32,25 @@ int main() typedef std::pair P; { static_assert(std::is_copy_constructible::value, ""); +#if !defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) static_assert(std::is_trivially_copy_constructible::value, ""); +#endif } #if TEST_STD_VER >= 11 { static_assert(std::is_move_constructible::value, ""); +#if !defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) static_assert(std::is_trivially_move_constructible::value, ""); +#endif } { using P1 = std::pair; static_assert(!std::is_copy_constructible::value, ""); static_assert(!std::is_trivially_copy_constructible::value, ""); static_assert(std::is_move_constructible::value, ""); +#if !defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) static_assert(std::is_trivially_move_constructible::value, ""); +#endif } #endif } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r284008 - Reinstate r283887 and r283882.
Hi Manman, On 12/10/16 20:28, Manman wrote: Hi Vassil, Any change between this commit and “r283887 + r283882”? The only extra change is in: + bool isThisDeclarationADemotedDefinition() const { +return isa(this) ? false : + NonParmVarDeclBits.IsThisDeclarationADemotedDefinition; + } The old patch failed because we read the IsThisDeclarationADemotedDefinition bit of ParmVarDecls. We allow demoting only VarDecls, which are not ParmVarDecls, and thus we serialize/deserialize this bit only for non ParmVarDecls. Reading the IsThisDeclarationADemotedDefinition of ParmVarDecls caused random behavior. Cheers, Vassil And what was the issue that caused the revert? Thanks, Manman On Oct 12, 2016, at 4:57 AM, Vassil Vassilev via cfe-commits wrote: Author: vvassilev Date: Wed Oct 12 06:57:08 2016 New Revision: 284008 URL: http://llvm.org/viewvc/llvm-project?rev=284008&view=rev Log: Reinstate r283887 and r283882. Original message: "[modules] PR28752: Do not instantiate variable declarations which are not visible. https://reviews.llvm.org/D24508 Patch developed in collaboration with Richard Smith!" Added: cfe/trunk/test/Modules/Inputs/PR28752/ cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/ cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/b.h cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/c.h cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/module.modulemap cfe/trunk/test/Modules/Inputs/PR28752/a.h cfe/trunk/test/Modules/Inputs/PR28752/module.modulemap cfe/trunk/test/Modules/Inputs/PR28752/vector cfe/trunk/test/Modules/pr28752.cpp Modified: cfe/trunk/include/clang/AST/Decl.h cfe/trunk/lib/AST/Decl.cpp cfe/trunk/lib/Sema/SemaDecl.cpp cfe/trunk/lib/Sema/SemaTemplate.cpp cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp cfe/trunk/lib/Sema/SemaType.cpp cfe/trunk/lib/Serialization/ASTReaderDecl.cpp cfe/trunk/lib/Serialization/ASTWriterDecl.cpp Modified: cfe/trunk/include/clang/AST/Decl.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=284008&r1=284007&r2=284008&view=diff == --- cfe/trunk/include/clang/AST/Decl.h (original) +++ cfe/trunk/include/clang/AST/Decl.h Wed Oct 12 06:57:08 2016 @@ -865,6 +865,11 @@ protected: unsigned : NumVarDeclBits; +// FIXME: We need something similar to CXXRecordDecl::DefinitionData. +/// \brief Whether this variable is a definition which was demoted due to +/// module merge. +unsigned IsThisDeclarationADemotedDefinition : 1; + /// \brief Whether this variable is the exception variable in a C++ catch /// or an Objective-C @catch statement. unsigned ExceptionVar : 1; @@ -1198,12 +1203,28 @@ public: InitializationStyle getInitStyle() const { return static_cast(VarDeclBits.InitStyle); } - /// \brief Whether the initializer is a direct-initializer (list or call). bool isDirectInit() const { return getInitStyle() != CInit; } + /// \brief If this definition should pretend to be a declaration. + bool isThisDeclarationADemotedDefinition() const { +return isa(this) ? false : + NonParmVarDeclBits.IsThisDeclarationADemotedDefinition; + } + + /// \brief This is a definition which should be demoted to a declaration. + /// + /// In some cases (mostly module merging) we can end up with two visible + /// definitions one of which needs to be demoted to a declaration to keep + /// the AST invariants. + void demoteThisDefinitionToDeclaration() { +assert (isThisDeclarationADefinition() && "Not a definition!"); +assert (!isa(this) && "Cannot demote ParmVarDecls!"); +NonParmVarDeclBits.IsThisDeclarationADemotedDefinition = 1; + } + /// \brief Determine whether this variable is the exception variable in a /// C++ catch statememt or an Objective-C \@catch statement. bool isExceptionVariable() const { @@ -1302,6 +1323,10 @@ public: NonParmVarDeclBits.PreviousDeclInSameBlockScope = Same; } + /// \brief Retrieve the variable declaration from which this variable could + /// be instantiated, if it is an instantiation (rather than a non-template). + VarDecl *getTemplateInstantiationPattern() const; + /// \brief If this variable is an instantiated static data member of a /// class template specialization, returns the templated static data member /// from which it was instantiated. Modified: cfe/trunk/lib/AST/Decl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=284008&r1=284007&r2=284008&view=diff == --- cfe/trunk/lib/AST/Decl.cpp (original) +++ cfe/trunk/lib/AST/Decl.cpp Wed Oct 12 06:57:08 2016 @@ -1926,6 +1926,9 @@ VarDecl::isThisDeclarationADefinition(AS // // FIXME: How do you declare (but not define) a partial specialization of // a static data member template outside the containing c
r284048 - Specify a target cpu in test case
Author: arnolds Date: Wed Oct 12 15:30:24 2016 New Revision: 284048 URL: http://llvm.org/viewvc/llvm-project?rev=284048&view=rev Log: Specify a target cpu in test case Hopefully, this makes the bots happy Modified: cfe/trunk/test/CodeGen/windows-swiftcall.c Modified: cfe/trunk/test/CodeGen/windows-swiftcall.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/windows-swiftcall.c?rev=284048&r1=284047&r2=284048&view=diff == --- cfe/trunk/test/CodeGen/windows-swiftcall.c (original) +++ cfe/trunk/test/CodeGen/windows-swiftcall.c Wed Oct 12 15:30:24 2016 @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-windows -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-unknown-windows -emit-llvm -target-cpu core2 -o - %s | FileCheck %s #define SWIFTCALL __attribute__((swiftcall)) #define OUT __attribute__((swift_indirect_result)) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25264: Implement MS _BitScan intrinsics
agutowski updated this revision to Diff 74435. agutowski added a comment. rebase https://reviews.llvm.org/D25264 Files: include/clang/Basic/BuiltinsARM.def include/clang/Basic/BuiltinsX86.def include/clang/Basic/BuiltinsX86_64.def lib/Basic/Targets.cpp lib/CodeGen/CGBuiltin.cpp lib/CodeGen/CodeGenFunction.h lib/Headers/intrin.h test/CodeGen/ms-intrinsics.c Index: lib/Headers/intrin.h === --- lib/Headers/intrin.h +++ lib/Headers/intrin.h @@ -432,20 +432,6 @@ |* Bit Counting and Testing \**/ static __inline__ unsigned char __DEFAULT_FN_ATTRS -_BitScanForward(unsigned long *_Index, unsigned long _Mask) { - if (!_Mask) -return 0; - *_Index = __builtin_ctzl(_Mask); - return 1; -} -static __inline__ unsigned char __DEFAULT_FN_ATTRS -_BitScanReverse(unsigned long *_Index, unsigned long _Mask) { - if (!_Mask) -return 0; - *_Index = 31 - __builtin_clzl(_Mask); - return 1; -} -static __inline__ unsigned char __DEFAULT_FN_ATTRS _bittest(long const *_BitBase, long _BitPos) { return (*_BitBase >> _BitPos) & 1; } @@ -491,20 +477,6 @@ #endif #ifdef __x86_64__ static __inline__ unsigned char __DEFAULT_FN_ATTRS -_BitScanForward64(unsigned long *_Index, unsigned __int64 _Mask) { - if (!_Mask) -return 0; - *_Index = __builtin_ctzll(_Mask); - return 1; -} -static __inline__ unsigned char __DEFAULT_FN_ATTRS -_BitScanReverse64(unsigned long *_Index, unsigned __int64 _Mask) { - if (!_Mask) -return 0; - *_Index = 63 - __builtin_clzll(_Mask); - return 1; -} -static __inline__ unsigned char __DEFAULT_FN_ATTRS _bittest64(__int64 const *_BitBase, __int64 _BitPos) { return (*_BitBase >> _BitPos) & 1; } Index: lib/CodeGen/CGBuiltin.cpp === --- lib/CodeGen/CGBuiltin.cpp +++ lib/CodeGen/CGBuiltin.cpp @@ -2637,6 +2637,68 @@ } } +// Many of MSVC builtins are on both x64 and ARM; to avoid repeating code, we +// handle them here. +enum class CodeGenFunction::MSVCIntrin { + _BitScanForward, + _BitScanReverse +}; + +Value *CodeGenFunction::EmitMSVCBuiltinExpr(MSVCIntrin BuiltinID, +const CallExpr *E) { + switch (BuiltinID) { + case MSVCIntrin::_BitScanForward: + case MSVCIntrin::_BitScanReverse: { +Value *ArgValue = EmitScalarExpr(E->getArg(1)); + +llvm::Type *ArgType = ArgValue->getType(); +llvm::Type *IndexType = +EmitScalarExpr(E->getArg(0))->getType()->getPointerElementType(); +llvm::Type *ResultType = ConvertType(E->getType()); + +Value *ArgZero = llvm::Constant::getNullValue(ArgType); +Value *ResZero = llvm::Constant::getNullValue(ResultType); +Value *ResOne = llvm::ConstantInt::get(ResultType, 1); + +BasicBlock *Begin = Builder.GetInsertBlock(); +BasicBlock *End = createBasicBlock("bitscan_end", this->CurFn); +Builder.SetInsertPoint(End); +PHINode *Result = Builder.CreatePHI(ResultType, 2, "bitscan_result"); + +Builder.SetInsertPoint(Begin); +Value *IsZero = Builder.CreateICmpEQ(ArgValue, ArgZero); +BasicBlock *NotZero = createBasicBlock("bitscan_not_zero", this->CurFn); +Builder.CreateCondBr(IsZero, End, NotZero); +Result->addIncoming(ResZero, Begin); + +Builder.SetInsertPoint(NotZero); +Address IndexAddress = EmitPointerWithAlignment(E->getArg(0)); + +if (BuiltinID == MSVCIntrin::_BitScanForward) { + Value *F = CGM.getIntrinsic(Intrinsic::cttz, ArgType); + Value *ZeroCount = Builder.CreateCall(F, {ArgValue, Builder.getTrue()}); + ZeroCount = Builder.CreateIntCast(ZeroCount, IndexType, false); + Builder.CreateStore(ZeroCount, IndexAddress, false); +} else { + unsigned ArgWidth = cast(ArgType)->getBitWidth(); + Value *ArgTypeLastIndex = llvm::ConstantInt::get(IndexType, ArgWidth - 1); + + Value *F = CGM.getIntrinsic(Intrinsic::ctlz, ArgType); + Value *ZeroCount = Builder.CreateCall(F, {ArgValue, Builder.getTrue()}); + ZeroCount = Builder.CreateIntCast(ZeroCount, IndexType, false); + Value *Index = Builder.CreateNSWSub(ArgTypeLastIndex, ZeroCount); + Builder.CreateStore(Index, IndexAddress, false); +} +Builder.CreateBr(End); +Result->addIncoming(ResOne, NotZero); + +Builder.SetInsertPoint(End); +return Result; + } + } + llvm_unreachable("Incorrect MSVC intrinsic!"); +} + Value *CodeGenFunction::EmitTargetBuiltinExpr(unsigned BuiltinID, const CallExpr *E) { if (getContext().BuiltinInfo.isAuxBuiltinID(BuiltinID)) { @@ -4561,6 +4623,12 @@ return Builder.CreateCall(F, {Ops[1], Ops[2], Ops[0], Ops[3], Ops[4], Ops[5]}); } + case ARM::BI_BitScanForward: + case ARM::BI_BitScanForward64: +return EmitMSVCBuiltinExpr(MSVCIntrin::_BitScanForward, E); + case ARM::BI_BitS
[PATCH] D25503: [analyzer] Remove superquadratic behaviour from DataflowWorklist
alexshap updated the summary for this revision. alexshap updated this revision to Diff 74437. alexshap added a comment. Switch to priority queue. I have rerun the tests - they are all green. I will post the numbers about the perf a bit later. Repository: rL LLVM https://reviews.llvm.org/D25503 Files: lib/Analysis/LiveVariables.cpp Index: lib/Analysis/LiveVariables.cpp === --- lib/Analysis/LiveVariables.cpp +++ lib/Analysis/LiveVariables.cpp @@ -19,6 +19,7 @@ #include "clang/Analysis/CFG.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/PostOrderIterator.h" +#include "llvm/ADT/PriorityQueue.h" #include "llvm/Support/raw_ostream.h" #include #include @@ -28,52 +29,44 @@ namespace { class DataflowWorklist { - SmallVector worklist; llvm::BitVector enqueuedBlocks; PostOrderCFGView *POV; + llvm::PriorityQueue, + PostOrderCFGView::BlockOrderCompare> worklist; + public: DataflowWorklist(const CFG &cfg, AnalysisDeclContext &Ctx) : enqueuedBlocks(cfg.getNumBlockIDs()), - POV(Ctx.getAnalysis()) {} + POV(Ctx.getAnalysis()), + worklist(POV->getComparator()) {} void enqueueBlock(const CFGBlock *block); void enqueuePredecessors(const CFGBlock *block); const CFGBlock *dequeue(); - - void sortWorklist(); }; } void DataflowWorklist::enqueueBlock(const clang::CFGBlock *block) { if (block && !enqueuedBlocks[block->getBlockID()]) { enqueuedBlocks[block->getBlockID()] = true; -worklist.push_back(block); +worklist.push(block); } } void DataflowWorklist::enqueuePredecessors(const clang::CFGBlock *block) { - const unsigned OldWorklistSize = worklist.size(); for (CFGBlock::const_pred_iterator I = block->pred_begin(), E = block->pred_end(); I != E; ++I) { enqueueBlock(*I); } - - if (OldWorklistSize == 0 || OldWorklistSize == worklist.size()) -return; - - sortWorklist(); -} - -void DataflowWorklist::sortWorklist() { - std::sort(worklist.begin(), worklist.end(), POV->getComparator()); } const CFGBlock *DataflowWorklist::dequeue() { if (worklist.empty()) return nullptr; - const CFGBlock *b = worklist.pop_back_val(); + const CFGBlock *b = worklist.top(); + worklist.pop(); enqueuedBlocks[b->getBlockID()] = false; return b; } @@ -528,8 +521,6 @@ } } - worklist.sortWorklist(); - while (const CFGBlock *block = worklist.dequeue()) { // Determine if the block's end value has changed. If not, we // have nothing left to do for this block. Index: lib/Analysis/LiveVariables.cpp === --- lib/Analysis/LiveVariables.cpp +++ lib/Analysis/LiveVariables.cpp @@ -19,6 +19,7 @@ #include "clang/Analysis/CFG.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/PostOrderIterator.h" +#include "llvm/ADT/PriorityQueue.h" #include "llvm/Support/raw_ostream.h" #include #include @@ -28,52 +29,44 @@ namespace { class DataflowWorklist { - SmallVector worklist; llvm::BitVector enqueuedBlocks; PostOrderCFGView *POV; + llvm::PriorityQueue, + PostOrderCFGView::BlockOrderCompare> worklist; + public: DataflowWorklist(const CFG &cfg, AnalysisDeclContext &Ctx) : enqueuedBlocks(cfg.getNumBlockIDs()), - POV(Ctx.getAnalysis()) {} + POV(Ctx.getAnalysis()), + worklist(POV->getComparator()) {} void enqueueBlock(const CFGBlock *block); void enqueuePredecessors(const CFGBlock *block); const CFGBlock *dequeue(); - - void sortWorklist(); }; } void DataflowWorklist::enqueueBlock(const clang::CFGBlock *block) { if (block && !enqueuedBlocks[block->getBlockID()]) { enqueuedBlocks[block->getBlockID()] = true; -worklist.push_back(block); +worklist.push(block); } } void DataflowWorklist::enqueuePredecessors(const clang::CFGBlock *block) { - const unsigned OldWorklistSize = worklist.size(); for (CFGBlock::const_pred_iterator I = block->pred_begin(), E = block->pred_end(); I != E; ++I) { enqueueBlock(*I); } - - if (OldWorklistSize == 0 || OldWorklistSize == worklist.size()) -return; - - sortWorklist(); -} - -void DataflowWorklist::sortWorklist() { - std::sort(worklist.begin(), worklist.end(), POV->getComparator()); } const CFGBlock *DataflowWorklist::dequeue() { if (worklist.empty()) return nullptr; - const CFGBlock *b = worklist.pop_back_val(); + const CFGBlock *b = worklist.top(); + worklist.pop(); enqueuedBlocks[b->getBlockID()] = false; return b; } @@ -528,8 +521,6 @@ } } - worklist.sortWorklist(); - while (const CFGBlock *block = worklist.dequeue()) { // Determine if the block's end value has changed. If not, we // have nothing left to do for this block. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm
[PATCH] D25491: [libcxx] Use C++14 when building libc++ with musl
phosek updated this revision to Diff 74439. phosek marked an inline comment as done. Repository: rL LLVM https://reviews.llvm.org/D25491 Files: CMakeLists.txt Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -325,6 +325,11 @@ # Required flags == set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build dialect") +if (LIBCXX_HAS_MUSL_LIBC) + # musl's pthread implementations uses volatile types in their structs which is + # not a constexpr in C++11 but is in C++14, so we use C++14 with musl. + set(LIBCXX_STANDARD_VER c++14) +endif() add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER}) mangle_name("LIBCXX_SUPPORTS_STD_EQ_${LIBCXX_STANDARD_VER}_FLAG" SUPPORTS_DIALECT_NAME) if (NOT MSVC AND NOT ${SUPPORTS_DIALECT_NAME}) Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -325,6 +325,11 @@ # Required flags == set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build dialect") +if (LIBCXX_HAS_MUSL_LIBC) + # musl's pthread implementations uses volatile types in their structs which is + # not a constexpr in C++11 but is in C++14, so we use C++14 with musl. + set(LIBCXX_STANDARD_VER c++14) +endif() add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER}) mangle_name("LIBCXX_SUPPORTS_STD_EQ_${LIBCXX_STANDARD_VER}_FLAG" SUPPORTS_DIALECT_NAME) if (NOT MSVC AND NOT ${SUPPORTS_DIALECT_NAME}) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r284008 - Reinstate r283887 and r283882.
> On Oct 12, 2016, at 1:39 PM, Vassil Vassilev wrote: > > Hi Manman, > On 12/10/16 20:28, Manman wrote: >> Hi Vassil, >> >> Any change between this commit and “r283887 + r283882”? > The only extra change is in: > > + bool isThisDeclarationADemotedDefinition() const { > +return isa(this) ? false : > + NonParmVarDeclBits.IsThisDeclarationADemotedDefinition; > + } > > The old patch failed because we read the IsThisDeclarationADemotedDefinition > bit of ParmVarDecls. We allow demoting only VarDecls, which are not > ParmVarDecls, and thus we serialize/deserialize this bit only for non > ParmVarDecls. Reading the IsThisDeclarationADemotedDefinition of ParmVarDecls > caused random behavior. Thanks, Manman > > Cheers, > Vassil >> And what was the issue that caused the revert? >> >> Thanks, >> Manman >> >>> On Oct 12, 2016, at 4:57 AM, Vassil Vassilev via cfe-commits >>> wrote: >>> >>> Author: vvassilev >>> Date: Wed Oct 12 06:57:08 2016 >>> New Revision: 284008 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=284008&view=rev >>> Log: >>> Reinstate r283887 and r283882. >>> >>> Original message: >>> "[modules] PR28752: Do not instantiate variable declarations which are not >>> visible. >>> >>> https://reviews.llvm.org/D24508 >>> >>> Patch developed in collaboration with Richard Smith!" >>> >>> Added: >>>cfe/trunk/test/Modules/Inputs/PR28752/ >>>cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/ >>>cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/b.h >>>cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/c.h >>>cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/module.modulemap >>>cfe/trunk/test/Modules/Inputs/PR28752/a.h >>>cfe/trunk/test/Modules/Inputs/PR28752/module.modulemap >>>cfe/trunk/test/Modules/Inputs/PR28752/vector >>>cfe/trunk/test/Modules/pr28752.cpp >>> Modified: >>>cfe/trunk/include/clang/AST/Decl.h >>>cfe/trunk/lib/AST/Decl.cpp >>>cfe/trunk/lib/Sema/SemaDecl.cpp >>>cfe/trunk/lib/Sema/SemaTemplate.cpp >>>cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp >>>cfe/trunk/lib/Sema/SemaType.cpp >>>cfe/trunk/lib/Serialization/ASTReaderDecl.cpp >>>cfe/trunk/lib/Serialization/ASTWriterDecl.cpp >>> >>> Modified: cfe/trunk/include/clang/AST/Decl.h >>> URL: >>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=284008&r1=284007&r2=284008&view=diff >>> == >>> --- cfe/trunk/include/clang/AST/Decl.h (original) >>> +++ cfe/trunk/include/clang/AST/Decl.h Wed Oct 12 06:57:08 2016 >>> @@ -865,6 +865,11 @@ protected: >>> >>> unsigned : NumVarDeclBits; >>> >>> +// FIXME: We need something similar to CXXRecordDecl::DefinitionData. >>> +/// \brief Whether this variable is a definition which was demoted due >>> to >>> +/// module merge. >>> +unsigned IsThisDeclarationADemotedDefinition : 1; >>> + >>> /// \brief Whether this variable is the exception variable in a C++ >>> catch >>> /// or an Objective-C @catch statement. >>> unsigned ExceptionVar : 1; >>> @@ -1198,12 +1203,28 @@ public: >>> InitializationStyle getInitStyle() const { >>> return static_cast(VarDeclBits.InitStyle); >>> } >>> - >>> /// \brief Whether the initializer is a direct-initializer (list or call). >>> bool isDirectInit() const { >>> return getInitStyle() != CInit; >>> } >>> >>> + /// \brief If this definition should pretend to be a declaration. >>> + bool isThisDeclarationADemotedDefinition() const { >>> +return isa(this) ? false : >>> + NonParmVarDeclBits.IsThisDeclarationADemotedDefinition; >>> + } >>> + >>> + /// \brief This is a definition which should be demoted to a declaration. >>> + /// >>> + /// In some cases (mostly module merging) we can end up with two visible >>> + /// definitions one of which needs to be demoted to a declaration to keep >>> + /// the AST invariants. >>> + void demoteThisDefinitionToDeclaration() { >>> +assert (isThisDeclarationADefinition() && "Not a definition!"); >>> +assert (!isa(this) && "Cannot demote ParmVarDecls!"); >>> +NonParmVarDeclBits.IsThisDeclarationADemotedDefinition = 1; >>> + } >>> + >>> /// \brief Determine whether this variable is the exception variable in a >>> /// C++ catch statememt or an Objective-C \@catch statement. >>> bool isExceptionVariable() const { >>> @@ -1302,6 +1323,10 @@ public: >>> NonParmVarDeclBits.PreviousDeclInSameBlockScope = Same; >>> } >>> >>> + /// \brief Retrieve the variable declaration from which this variable >>> could >>> + /// be instantiated, if it is an instantiation (rather than a >>> non-template). >>> + VarDecl *getTemplateInstantiationPattern() const; >>> + >>> /// \brief If this variable is an instantiated static data member of a >>> /// class template specialization, returns the templated static data >>> member >>> /// from which it was instantiated. >>> >>> Modified: cf
r284055 - Remove basic block label in test case
Author: arnolds Date: Wed Oct 12 16:36:15 2016 New Revision: 284055 URL: http://llvm.org/viewvc/llvm-project?rev=284055&view=rev Log: Remove basic block label in test case Another attempt to make a bot happy Modified: cfe/trunk/test/CodeGen/windows-swiftcall.c Modified: cfe/trunk/test/CodeGen/windows-swiftcall.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/windows-swiftcall.c?rev=284055&r1=284054&r2=284055&view=diff == --- cfe/trunk/test/CodeGen/windows-swiftcall.c (original) +++ cfe/trunk/test/CodeGen/windows-swiftcall.c Wed Oct 12 16:36:15 2016 @@ -121,7 +121,6 @@ TEST(struct_1); // CHECK: ret void // CHECK: } // CHECK-LABEL: define void @test_struct_1() {{.*}}{ -// CHECK: entry: // CHECK: [[AGG:%.*]] = alloca [[STRUCT1:%.*]], align 4 // CHECK: [[RET:%.*]] = call swiftcc { i64, i64 } @return_struct_1() // CHECK: [[CAST:%.*]] = bitcast [[STRUCT1]]* [[AGG]] to { i64, i64 }* ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits