[PATCH] D39438: [analyzer] Diagnose stack leaks via block captures
NoQ added a comment. Looks great, thanks! Minor inline stuff. Comment at: lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp:116 + const StackSpaceRegion *S = cast(R->getMemorySpace()); + return S->getStackFrame() != C.getLocationContext()->getCurrentStackFrame(); +} Because stack address escapes are not fatal errors, it is not necessarily true that any other stack frame context here would be an ancestor of the current context. It may be an escaped stack variable from a function that has exited long time ago. You might want to check the `getParent()` chain. Hmm, or rather rename the function to "isNotInCurrentFrame" because that's how you seem to be using it. Comment at: lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp:173 + // To avoid false-positives (for now) we ignore all the blocks + // which have capatured a variable of the type "dispatch_semaphore_t". + if (isSemaphoreCaptured(*B.getDecl())) Typo: cap~~a~~tured -> captured. Comment at: lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp:177 + for (const MemRegion *Region : getCapturedStackRegions(B, C)) { +if (isa(Region)) + continue; Hmm, why would such region even be in the list? Comment at: lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp:184 + BT_capturedstackasync = llvm::make_unique( + this, "Address of stack-allocated memory"); +SmallString<512> Buf; I think bugtype should describe the bug, so that the user knew what sort of bug it is by looking at the list. Maybe add "...is captured" here? Repository: rL LLVM https://reviews.llvm.org/D39438 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39821: Add CLANG_DEFAULT_OBJCOPY to allow Clang to use llvm-objcopy for dwarf fission
phosek accepted this revision. phosek added a comment. This revision is now accepted and ready to land. LGTM Repository: rL LLVM https://reviews.llvm.org/D39821 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39829: add new check for property declaration
hokein added inline comments. Comment at: clang-tidy/objc/PropertyDeclarationCheck.cpp:22 + +/// we will do best effort to generate a fix, however, if the +/// case can not be solved with a simple fix (e.g. CamelCase I think we need to update the comment according to the new change (it is a bit ambiguous to users). We only fix "camelCase" currently. Comment at: clang-tidy/objc/PropertyDeclarationCheck.cpp:25 +/// is a simple fix), we will leave the fix to the user. +/// TODO: provide fix for snake_case to snakeCase +FixItHint generateFixItHint(const ObjCPropertyDecl *Decl) { nit: llvm uses `FIXME`. Comment at: clang-tidy/objc/PropertyDeclarationCheck.cpp:27 +FixItHint generateFixItHint(const ObjCPropertyDecl *Decl) { + if (isupper(Decl->getName()[0])) { +auto NewName = Decl->getName().str(); nit: I would add an assert to make sure the name is not empty. Comment at: docs/ReleaseNotes.rst:63 + + FIXME: add release notes. + nit: this can be removed. Comment at: docs/clang-tidy/checks/objc-property-declaration.rst:7 +Finds property declarations in Objective-C files that do not follow the pattern +of property names in Google's Objective-C Style Guide. The property name should +be in the format of Lower Camel Case. benhamilton wrote: > hokein wrote: > > Google style? but the link you provided is Apple. > Google's Objective-C style guide is a list of additions on top of Apple's > Objective-C style guide. > > Property naming standards are defined in Apple's style guide, and not changed > by Google's. I see, thanks for the clarification, I think the "Apple" would be clearer. Comment at: docs/clang-tidy/checks/objc-property-declaration.rst:22 + +The check will do best effort to give a fix, however, in some cases it is +difficult to give a proper fix since the property name could be complicated. The same. Comment at: test/clang-tidy/objc-property-declaration.m:8 +@property(assign, nonatomic) int camelCase; +// CHECK-MESSAGES-NOT: :[[@LINE-1]]:34: warning: property 'camelCase' is not in proper format according to property naming convention [objc-property-declaration] +@end Why does the check catch this case? Isn't `camelCase` a correct name? https://reviews.llvm.org/D39829 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39806: [clang-format] Support python-style comments in text protos
djasper accepted this revision. djasper added inline comments. This revision is now accepted and ready to land. Comment at: lib/Format/FormatTokenLexer.cpp:344 + size_t To = Lex->getBuffer().find_first_of('\n', From); + if (To == StringRef::npos) To = Lex->getBuffer().size(); + size_t Len = To - From; There should be a linebreak here. Comment at: lib/Format/UnwrappedLineParser.cpp:59 static bool isLineComment(const FormatToken &FormatTok) { - return FormatTok.is(tok::comment) && FormatTok.TokenText.startswith("//"); + return FormatTok.is(tok::comment) && (FormatTok.TokenText.startswith("//") || +FormatTok.TokenText.startswith("#")); Maybe it's now better to do: return FormatTok.is(tok::comment) && !FormatTok.TokenText.startsWith("/*"); ? https://reviews.llvm.org/D39806 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39829: add new check for property declaration
Wizard added inline comments. Comment at: test/clang-tidy/objc-property-declaration.m:8 +@property(assign, nonatomic) int camelCase; +// CHECK-MESSAGES-NOT: :[[@LINE-1]]:34: warning: property 'camelCase' is not in proper format according to property naming convention [objc-property-declaration] +@end hokein wrote: > Why does the check catch this case? Isn't `camelCase` a correct name? This is CHECK-MESSAGES-NOT https://reviews.llvm.org/D39829 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D37554: [libclang] Allow crash recovery with LIBCLANG_NOTHREADS
nik added a comment. I don't get a review and I also don't know who should I add further to this change. What now? https://reviews.llvm.org/D37554 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39806: [clang-format] Support python-style comments in text protos
krasimir updated this revision to Diff 122420. krasimir marked 3 inline comments as done. krasimir added a comment. - [clang-format] Address review comments https://reviews.llvm.org/D39806 Files: lib/Format/BreakableToken.cpp lib/Format/FormatTokenLexer.cpp lib/Format/FormatTokenLexer.h lib/Format/UnwrappedLineParser.cpp unittests/Format/FormatTestComments.cpp Index: unittests/Format/FormatTestComments.cpp === --- unittests/Format/FormatTestComments.cpp +++ unittests/Format/FormatTestComments.cpp @@ -62,6 +62,12 @@ return Style; } + FormatStyle getTextProtoStyleWithColumns(unsigned ColumnLimit) { +FormatStyle Style = getGoogleStyle(FormatStyle::FormatStyle::LK_TextProto); +Style.ColumnLimit = ColumnLimit; +return Style; + } + void verifyFormat(llvm::StringRef Code, const FormatStyle &Style = getLLVMStyle()) { EXPECT_EQ(Code.str(), format(test::messUp(Code), Style)); @@ -2872,6 +2878,85 @@ "A = B;", getLLVMStyleWithColumns(40))); } + +TEST_F(FormatTestComments, PythonStyleComments) { + // Keeps a space after '#'. + EXPECT_EQ("# comment\n" +"key: value", +format("#comment\n" + "key:value", + getTextProtoStyleWithColumns(20))); + EXPECT_EQ("# comment\n" +"key: value", +format("# comment\n" + "key:value", + getTextProtoStyleWithColumns(20))); + // Breaks long comment. + EXPECT_EQ("# comment comment\n" +"# comment\n" +"key: value", +format("# comment comment comment\n" + "key:value", + getTextProtoStyleWithColumns(20))); + // Indents comments. + EXPECT_EQ("data {\n" +" # comment comment\n" +" # comment\n" +" key: value\n" +"}", +format("data {\n" + "# comment comment comment\n" + "key: value}", + getTextProtoStyleWithColumns(20))); + EXPECT_EQ("data {\n" +" # comment comment\n" +" # comment\n" +" key: value\n" +"}", +format("data {# comment comment comment\n" + "key: value}", + getTextProtoStyleWithColumns(20))); + // Reflows long comments. + EXPECT_EQ("# comment comment\n" +"# comment comment\n" +"key: value", +format("# comment comment comment\n" + "# comment\n" + "key:value", + getTextProtoStyleWithColumns(20))); + // Breaks trailing comments. + EXPECT_EQ("k: val # comment\n" +"# comment\n" +"a: 1", +format("k:val#comment comment\n" + "a:1", + getTextProtoStyleWithColumns(20))); + EXPECT_EQ("id {\n" +" k: val # comment\n" +" # comment\n" +" # line line\n" +" a: 1\n" +"}", +format("id {k:val#comment comment\n" + "# line line\n" + "a:1}", + getTextProtoStyleWithColumns(20))); + // Aligns trailing comments. + EXPECT_EQ("k: val # commen1\n" +"# commen2\n" +"# commen3\n" +"# commen4\n" +"a: 1 # commen5\n" +" # commen6\n" +" # commen7", +format("k:val#commen1 commen2\n" + " # commen3\n" + "# commen4\n" + "a:1#commen5 commen6\n" + " #commen7", + getTextProtoStyleWithColumns(20))); +} + } // end namespace } // end namespace format } // end namespace clang Index: lib/Format/UnwrappedLineParser.cpp === --- lib/Format/UnwrappedLineParser.cpp +++ lib/Format/UnwrappedLineParser.cpp @@ -56,7 +56,7 @@ }; static bool isLineComment(const FormatToken &FormatTok) { - return FormatTok.is(tok::comment) && FormatTok.TokenText.startswith("//"); + return FormatTok.is(tok::comment) && !FormatTok.TokenText.startswith("/*"); } // Checks if \p FormatTok is a line comment that continues the line comment Index: lib/Format/FormatTokenLexer.h === --- lib/Format/FormatTokenLexer.h +++ lib/Format/FormatTokenLexer.h @@ -73,6 +73,8 @@ // nested template parts by balancing curly braces. void handleTemplateStrings(); + void tryParsePythonComment(); + bool tryMerge_TMacro(); bool tryMergeConflictMarkers(); Index: lib/Format/FormatTokenLexer.cpp === --- lib/Format/FormatTokenLexer.cpp +++ lib/Format/FormatTokenLexer.cpp @@ -50,6 +50,8 @@
[PATCH] D39806: [clang-format] Support python-style comments in text protos
This revision was automatically updated to reflect the committed changes. Closed by commit rL317886: [clang-format] Support python-style comments in text protos (authored by krasimir). Repository: rL LLVM https://reviews.llvm.org/D39806 Files: cfe/trunk/lib/Format/BreakableToken.cpp cfe/trunk/lib/Format/FormatTokenLexer.cpp cfe/trunk/lib/Format/FormatTokenLexer.h cfe/trunk/lib/Format/UnwrappedLineParser.cpp cfe/trunk/unittests/Format/FormatTestComments.cpp Index: cfe/trunk/lib/Format/FormatTokenLexer.h === --- cfe/trunk/lib/Format/FormatTokenLexer.h +++ cfe/trunk/lib/Format/FormatTokenLexer.h @@ -73,6 +73,8 @@ // nested template parts by balancing curly braces. void handleTemplateStrings(); + void tryParsePythonComment(); + bool tryMerge_TMacro(); bool tryMergeConflictMarkers(); Index: cfe/trunk/lib/Format/UnwrappedLineParser.cpp === --- cfe/trunk/lib/Format/UnwrappedLineParser.cpp +++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp @@ -56,7 +56,7 @@ }; static bool isLineComment(const FormatToken &FormatTok) { - return FormatTok.is(tok::comment) && FormatTok.TokenText.startswith("//"); + return FormatTok.is(tok::comment) && !FormatTok.TokenText.startswith("/*"); } // Checks if \p FormatTok is a line comment that continues the line comment Index: cfe/trunk/lib/Format/FormatTokenLexer.cpp === --- cfe/trunk/lib/Format/FormatTokenLexer.cpp +++ cfe/trunk/lib/Format/FormatTokenLexer.cpp @@ -50,6 +50,8 @@ tryParseJSRegexLiteral(); handleTemplateStrings(); } +if (Style.Language == FormatStyle::LK_TextProto) + tryParsePythonComment(); tryMergePreviousTokens(); if (Tokens.back()->NewlinesBefore > 0 || Tokens.back()->IsMultiline) FirstInLineIndex = Tokens.size() - 1; @@ -330,6 +332,27 @@ resetLexer(SourceMgr.getFileOffset(loc)); } +void FormatTokenLexer::tryParsePythonComment() { + FormatToken *HashToken = Tokens.back(); + if (HashToken->isNot(tok::hash)) +return; + // Turn the remainder of this line into a comment. + const char *CommentBegin = + Lex->getBufferLocation() - HashToken->TokenText.size(); // at "#" + size_t From = CommentBegin - Lex->getBuffer().begin(); + size_t To = Lex->getBuffer().find_first_of('\n', From); + if (To == StringRef::npos) +To = Lex->getBuffer().size(); + size_t Len = To - From; + HashToken->Type = TT_LineComment; + HashToken->Tok.setKind(tok::comment); + HashToken->TokenText = Lex->getBuffer().substr(From, Len); + SourceLocation Loc = To < Lex->getBuffer().size() + ? Lex->getSourceLocation(CommentBegin + Len) + : SourceMgr.getLocForEndOfFile(ID); + resetLexer(SourceMgr.getFileOffset(Loc)); +} + bool FormatTokenLexer::tryMerge_TMacro() { if (Tokens.size() < 4) return false; Index: cfe/trunk/lib/Format/BreakableToken.cpp === --- cfe/trunk/lib/Format/BreakableToken.cpp +++ cfe/trunk/lib/Format/BreakableToken.cpp @@ -40,9 +40,15 @@ } } -static StringRef getLineCommentIndentPrefix(StringRef Comment) { - static const char *const KnownPrefixes[] = {"///<", "//!<", "///", "//", - "//!"}; +static StringRef getLineCommentIndentPrefix(StringRef Comment, +const FormatStyle &Style) { + static const char *const KnownCStylePrefixes[] = {"///<", "//!<", "///", "//", +"//!"}; + static const char *const KnownTextProtoPrefixes[] = {"//", "#"}; + ArrayRef KnownPrefixes(KnownCStylePrefixes); + if (Style.Language == FormatStyle::LK_TextProto) +KnownPrefixes = KnownTextProtoPrefixes; + StringRef LongestPrefix; for (StringRef KnownPrefix : KnownPrefixes) { if (Comment.startswith(KnownPrefix)) { @@ -732,7 +738,8 @@ CurrentTok = CurrentTok->Next) { LastLineTok = LineTok; StringRef TokenText(CurrentTok->TokenText); -assert(TokenText.startswith("//")); +assert((TokenText.startswith("//") || TokenText.startswith("#")) && + "unsupported line comment prefix, '//' and '#' are supported"); size_t FirstLineIndex = Lines.size(); TokenText.split(Lines, "\n"); Content.resize(Lines.size()); @@ -745,8 +752,9 @@ // We need to trim the blanks in case this is not the first line in a // multiline comment. Then the indent is included in Lines[i]. StringRef IndentPrefix = - getLineCommentIndentPrefix(Lines[i].ltrim(Blanks)); - assert(IndentPrefix.startswith("//")); + getLineCommentIndentPrefix(Lines[i].ltrim(Blanks), Style); + assert((TokenText.startswith("//") || TokenText.startswith("#")) && + "unsupported line comment prefix, '
r317886 - [clang-format] Support python-style comments in text protos
Author: krasimir Date: Fri Nov 10 04:50:09 2017 New Revision: 317886 URL: http://llvm.org/viewvc/llvm-project?rev=317886&view=rev Log: [clang-format] Support python-style comments in text protos Summary: This patch adds support for python-style comments in text protos. Reviewers: djasper Reviewed By: djasper Subscribers: bkramer, cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D39806 Modified: cfe/trunk/lib/Format/BreakableToken.cpp cfe/trunk/lib/Format/FormatTokenLexer.cpp cfe/trunk/lib/Format/FormatTokenLexer.h cfe/trunk/lib/Format/UnwrappedLineParser.cpp cfe/trunk/unittests/Format/FormatTestComments.cpp Modified: cfe/trunk/lib/Format/BreakableToken.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/BreakableToken.cpp?rev=317886&r1=317885&r2=317886&view=diff == --- cfe/trunk/lib/Format/BreakableToken.cpp (original) +++ cfe/trunk/lib/Format/BreakableToken.cpp Fri Nov 10 04:50:09 2017 @@ -40,9 +40,15 @@ static bool IsBlank(char C) { } } -static StringRef getLineCommentIndentPrefix(StringRef Comment) { - static const char *const KnownPrefixes[] = {"///<", "//!<", "///", "//", - "//!"}; +static StringRef getLineCommentIndentPrefix(StringRef Comment, +const FormatStyle &Style) { + static const char *const KnownCStylePrefixes[] = {"///<", "//!<", "///", "//", +"//!"}; + static const char *const KnownTextProtoPrefixes[] = {"//", "#"}; + ArrayRef KnownPrefixes(KnownCStylePrefixes); + if (Style.Language == FormatStyle::LK_TextProto) +KnownPrefixes = KnownTextProtoPrefixes; + StringRef LongestPrefix; for (StringRef KnownPrefix : KnownPrefixes) { if (Comment.startswith(KnownPrefix)) { @@ -732,7 +738,8 @@ BreakableLineCommentSection::BreakableLi CurrentTok = CurrentTok->Next) { LastLineTok = LineTok; StringRef TokenText(CurrentTok->TokenText); -assert(TokenText.startswith("//")); +assert((TokenText.startswith("//") || TokenText.startswith("#")) && + "unsupported line comment prefix, '//' and '#' are supported"); size_t FirstLineIndex = Lines.size(); TokenText.split(Lines, "\n"); Content.resize(Lines.size()); @@ -745,8 +752,9 @@ BreakableLineCommentSection::BreakableLi // We need to trim the blanks in case this is not the first line in a // multiline comment. Then the indent is included in Lines[i]. StringRef IndentPrefix = - getLineCommentIndentPrefix(Lines[i].ltrim(Blanks)); - assert(IndentPrefix.startswith("//")); + getLineCommentIndentPrefix(Lines[i].ltrim(Blanks), Style); + assert((TokenText.startswith("//") || TokenText.startswith("#")) && + "unsupported line comment prefix, '//' and '#' are supported"); OriginalPrefix[i] = Prefix[i] = IndentPrefix; if (Lines[i].size() > Prefix[i].size() && isAlphanumeric(Lines[i][Prefix[i].size()])) { @@ -760,6 +768,9 @@ BreakableLineCommentSection::BreakableLi Prefix[i] = "///< "; else if (Prefix[i] == "//!<") Prefix[i] = "//!< "; +else if (Prefix[i] == "#" && + Style.Language == FormatStyle::LK_TextProto) + Prefix[i] = "# "; } Tokens[i] = LineTok; Modified: cfe/trunk/lib/Format/FormatTokenLexer.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/FormatTokenLexer.cpp?rev=317886&r1=317885&r2=317886&view=diff == --- cfe/trunk/lib/Format/FormatTokenLexer.cpp (original) +++ cfe/trunk/lib/Format/FormatTokenLexer.cpp Fri Nov 10 04:50:09 2017 @@ -50,6 +50,8 @@ ArrayRef FormatTokenLexer tryParseJSRegexLiteral(); handleTemplateStrings(); } +if (Style.Language == FormatStyle::LK_TextProto) + tryParsePythonComment(); tryMergePreviousTokens(); if (Tokens.back()->NewlinesBefore > 0 || Tokens.back()->IsMultiline) FirstInLineIndex = Tokens.size() - 1; @@ -330,6 +332,27 @@ void FormatTokenLexer::handleTemplateStr resetLexer(SourceMgr.getFileOffset(loc)); } +void FormatTokenLexer::tryParsePythonComment() { + FormatToken *HashToken = Tokens.back(); + if (HashToken->isNot(tok::hash)) +return; + // Turn the remainder of this line into a comment. + const char *CommentBegin = + Lex->getBufferLocation() - HashToken->TokenText.size(); // at "#" + size_t From = CommentBegin - Lex->getBuffer().begin(); + size_t To = Lex->getBuffer().find_first_of('\n', From); + if (To == StringRef::npos) +To = Lex->getBuffer().size(); + size_t Len = To - From; + HashToken->Type = TT_LineComment; + HashToken->Tok.setKind(tok::comment); + HashToken->TokenText = Lex->getBuffer().substr(From, Len); + SourceLocation Loc = To < Lex->getBuffer()
[PATCH] D39821: Add CLANG_DEFAULT_OBJCOPY to allow Clang to use llvm-objcopy for dwarf fission
Hahnfeld added a comment. I think the current tests will only pass iff the executable name ends with `objcopy` - can we make this more reliable? Repository: rL LLVM https://reviews.llvm.org/D39821 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39763: [clang] [python] [tests] Rewrite to use standard unittest module
bkramer accepted this revision. bkramer added a comment. This revision is now accepted and ready to land. I can't really check if all the tests are equivalent to the old ones, but not having to install nose is a major usability improvement. Let's ship this. We should totally fix the existing failures. I assume this is because nobody ever runs the tests. Repository: rL LLVM https://reviews.llvm.org/D39763 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39050: Add index-while-building support to Clang
ioeric added a comment. >> - I think the implementation of the index output logic (e.g. >> `IndexUnitWriter` and bit format file) can be abstracted away (and split >> into separate patches) so that you can unit-test the action with a >> custom/mock unit writer; this would also make the action reusable with >> (potentially) other storage formats. > > The added IndexRecordAction and existing IndexAction use the same > functionality from libIndex to collect the indexing data, so I'm not sure > mocking the unit writer to unit test IndexRecordAction would add very much > value – writing the index data out is the new behavior. The existing tests > for IndexAction (under test/Index/Core) are already covering the correctness > of the majority of the collected indexing info and the tests coming in the > follow-up patch (seen in the original version of this patch) test it's still > correct after the write/read round trip. Thanks for the clarification! I still think it's useful to decouple the IndexAction from the bit format file so that it could be reusable elsewhere. For example, I can see the index action be useful to clangd for building in-memory index. I also tried applying your original patch locally but couldn't get it to work mostly due to portability issues (e.g. `blocks` and `if (APPLE)` in make files). AFAIK, many folks compile clang with GCC and/or without APPLE, so it's important that you get the portability right from the very beginning. Thanks! Index-while-build is awesome! I'm looking forward to your patches! https://reviews.llvm.org/D39050 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34030: Fix the postorder visting of the ClassTemplateSpecializationDecl nodes in the RecursiveASTVisitor.
MontyKutyi added a comment. Ping. https://reviews.llvm.org/D34030 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39859: [OpenMP] diagnose assign to firstprivate const
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG https://reviews.llvm.org/D39859 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39900: Refactor ContinuationIndenter's breakProtrudingToken logic into slightly moreorthogonal pieces.
klimek created this revision. This patch allowed me to experiment with various alternatives to https://reviews.llvm.org/D33589. https://reviews.llvm.org/D39900 Files: lib/Format/BreakableToken.cpp lib/Format/ContinuationIndenter.cpp lib/Format/ContinuationIndenter.h unittests/Format/FormatTest.cpp unittests/Format/FormatTestComments.cpp Index: unittests/Format/FormatTestComments.cpp === --- unittests/Format/FormatTestComments.cpp +++ unittests/Format/FormatTestComments.cpp @@ -680,8 +680,7 @@ EXPECT_EQ("{\n" " //\n" " //\\\n" -" // long 1 2 3 4\n" -" // 5\n" +" // long 1 2 3 4 5\n" "}", format("{\n" " //\n" Index: unittests/Format/FormatTest.cpp === --- unittests/Format/FormatTest.cpp +++ unittests/Format/FormatTest.cpp @@ -6319,7 +6319,8 @@ "#include_next " "#include \"abc.h\" // this is included for ABC\n" "#include \"some long include\" // with a comment\n" - "#include \"some very long include paaath\"", + "#include \"some very long include path\"\n" + "#include \n", getLLVMStyleWithColumns(35)); EXPECT_EQ("#include \"a.h\"", format("#include \"a.h\"")); EXPECT_EQ("#include ", format("#include")); Index: lib/Format/ContinuationIndenter.h === --- lib/Format/ContinuationIndenter.h +++ lib/Format/ContinuationIndenter.h @@ -29,6 +29,7 @@ namespace format { class AnnotatedLine; +class BreakableToken; struct FormatToken; struct LineState; struct ParenState; @@ -105,11 +106,20 @@ /// /// \returns An extra penalty induced by reformatting the token. unsigned reformatRawStringLiteral(const FormatToken &Current, -unsigned StartColumn, LineState &State, -StringRef Delimiter, +LineState &State, const FormatStyle &RawStringStyle, bool DryRun); + /// \brief If the current token is at the end of the current line, handle + /// the transition to the next line. + unsigned handleEndOfLine(const FormatToken &Current, LineState &State, + bool DryRun, bool AllowBreak); + + /// \brief If \p Current is a raw string that is configured to be reformatted, + /// return the style to be used. + llvm::Optional getRawStringStyle(const FormatToken &Current, +const LineState &State); + /// \brief If the current token sticks out over the end of the line, break /// it if possible. /// @@ -120,7 +130,13 @@ /// penalty for the column limit violation in the last line (and in single /// line tokens) is handled in \c addNextStateToQueue. unsigned breakProtrudingToken(const FormatToken &Current, LineState &State, -bool DryRun); +bool AllowBreak, bool DryRun); + + /// \brief Returns the \c BreakableToken starting at \p Current, or nullptr + /// if the current token cannot be broken. + std::unique_ptr + createBreakableToken(const FormatToken &Current, LineState &State, + bool AllowBreak); /// \brief Appends the next token to \p State and updates information /// necessary for indentation. Index: lib/Format/ContinuationIndenter.cpp === --- lib/Format/ContinuationIndenter.cpp +++ lib/Format/ContinuationIndenter.cpp @@ -1008,8 +1008,8 @@ moveStatePastFakeLParens(State, Newline); moveStatePastScopeCloser(State); - bool CanBreakProtrudingToken = !State.Stack.back().NoLineBreak && - !State.Stack.back().NoLineBreakInOperand; + bool AllowBreak = !State.Stack.back().NoLineBreak && +!State.Stack.back().NoLineBreakInOperand; moveStatePastScopeOpener(State, Newline); moveStatePastFakeRParens(State); @@ -1023,13 +1023,9 @@ State.Column += Current.ColumnWidth; State.NextToken = State.NextToken->Next; - unsigned Penalty = 0; - if (CanBreakProtrudingToken) -Penalty = breakProtrudingToken(Current, State, DryRun); - if (State.Column > getColumnLimit(State)) { -unsigned ExcessCharacters = State.Column - getColumnLimit(State); -Penalty += Style.PenaltyExcessCharacter * ExcessCharacters; - } + + unsigned Penalty = + handleEndOfLine(Current, State, DryRun, AllowBreak); if (Current.Role) Current.Role->formatFromToken(State, this, DryRun); @@ -1282,8 +1278,10 @@ } unsigned ContinuationIndenter::reformatRawStringLiteral( -const FormatToken &Current, unsign
[PATCH] D37554: [libclang] Allow crash recovery with LIBCLANG_NOTHREADS
klimek accepted this revision. klimek added a comment. This revision is now accepted and ready to land. LG. https://reviews.llvm.org/D37554 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39859: [OpenMP] diagnose assign to firstprivate const
jdenny added a comment. Alexey: Thanks for accepting. I do not have commit privileges. Would you please commit for me? https://reviews.llvm.org/D39859 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39859: [OpenMP] diagnose assign to firstprivate const
ABataev added a comment. In https://reviews.llvm.org/D39859#921780, @jdenny wrote: > Alexey: Thanks for accepting. I do not have commit privileges. Would you > please commit for me? Sure, no problems. https://reviews.llvm.org/D39859 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39900: Refactor ContinuationIndenter's breakProtrudingToken logic into slightly moreorthogonal pieces.
krasimir added inline comments. Comment at: lib/Format/ContinuationIndenter.cpp:1028 + unsigned Penalty = + handleEndOfLine(Current, State, DryRun, AllowBreak); Why `handleEndOfLine`? Is it guaranteed that here we've reached the end of the line? Comment at: lib/Format/ContinuationIndenter.cpp:1284 + unsigned StartColumn = State.Column - Current.ColumnWidth; + auto Delimiter = *getRawStringDelimiter(Current.TokenText); // The text of a raw string is between the leading 'R"delimiter(' and the At this point, we compute `getRawStringDelimiter` twice: once here, and once in `getRawStringStyle` in the caller side. Ideally, we'd only like to compute it once. That's why it was a parameter before. Comment at: lib/Format/ContinuationIndenter.cpp:1408 +std::unique_ptr ContinuationIndenter::createBreakableToken( +const FormatToken &Current, LineState &State, bool AllowBreak) { unsigned StartColumn = State.Column - Current.ColumnWidth; If `AllowBreak == false`, in which cases will this return a non-`nullptr`? Comment at: unittests/Format/FormatTest.cpp:6322 "#include \"some long include\" // with a comment\n" - "#include \"some very long include paaath\"", + "#include \"some very long include path\"\n" + "#include \n", What happened to the old test line? Comment at: unittests/Format/FormatTestComments.cpp:683 " //\\\n" -" // long 1 2 3 4\n" -" // 5\n" +" // long 1 2 3 4 5\n" "}", Please also add a test case adding a ` 6`, which actually gets broken. https://reviews.llvm.org/D39900 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39842: Allow to store precompiled preambles in memory.
klimek added inline comments. Comment at: include/clang/Frontend/PrecompiledPreamble.h:99 /// Changes options inside \p CI to use PCH from this preamble. Also remaps - /// main file to \p MainFileBuffer. + /// main file to \p MainFileBuffer and updates \p VFS to ensure preamble is + /// accessible. ...ensure *the* preamble... Comment at: lib/Frontend/ASTUnit.cpp:1028 +IntrusiveRefCntPtr OldVFS = VFS; +Preamble->AddImplicitPreamble(*CCInvocation, /*ref*/ VFS, + OverrideMainBuffer.get()); Since when are we using the /*ref*/ annotation? Comment at: lib/Frontend/PrecompiledPreamble.cpp:206 + std::unique_ptr Storage; + if (InMemStorage) { +OS = llvm::make_unique(*InMemStorage); It looks like we should pass in the output stream, not the storage? Comment at: lib/Frontend/PrecompiledPreamble.cpp:490 PreprocessorOpts.DisablePCHValidation = true; + if (Storage.getKind() == PCHStorage::Kind::TempFile) { +const TempPCHFile &PCHFile = Storage.asFile(); This looks a bit like we should push it into the PCHStorage. https://reviews.llvm.org/D39842 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39900: Refactor ContinuationIndenter's breakProtrudingToken logic into slightly moreorthogonal pieces.
klimek updated this revision to Diff 122433. klimek marked an inline comment as done. klimek added a comment. - Add test. Updating D39900: Refactor ContinuationIndenter's breakProtrudingToken logic into slightly more == orthogonal pieces. https://reviews.llvm.org/D39900 Files: lib/Format/BreakableToken.cpp lib/Format/ContinuationIndenter.cpp lib/Format/ContinuationIndenter.h unittests/Format/FormatTest.cpp unittests/Format/FormatTestComments.cpp Index: unittests/Format/FormatTestComments.cpp === --- unittests/Format/FormatTestComments.cpp +++ unittests/Format/FormatTestComments.cpp @@ -680,15 +680,26 @@ EXPECT_EQ("{\n" " //\n" " //\\\n" -" // long 1 2 3 4\n" -" // 5\n" +" // long 1 2 3 4 5\n" "}", format("{\n" " //\n" " //\\\n" " // long 1 2 3 4 5\n" "}", getLLVMStyleWithColumns(20))); + EXPECT_EQ("{\n" +" //\n" +" //\\\n" +" // long 1 2 3 4 5\n" +" // 6\n" +"}", +format("{\n" + " //\n" + " //\\\n" + " // long 1 2 3 4 5 6\n" + "}", + getLLVMStyleWithColumns(20))); } TEST_F(FormatTestComments, PreservesHangingIndentInCxxComments) { Index: unittests/Format/FormatTest.cpp === --- unittests/Format/FormatTest.cpp +++ unittests/Format/FormatTest.cpp @@ -6319,7 +6319,8 @@ "#include_next " "#include \"abc.h\" // this is included for ABC\n" "#include \"some long include\" // with a comment\n" - "#include \"some very long include paaath\"", + "#include \"some very long include path\"\n" + "#include \n", getLLVMStyleWithColumns(35)); EXPECT_EQ("#include \"a.h\"", format("#include \"a.h\"")); EXPECT_EQ("#include ", format("#include")); Index: lib/Format/ContinuationIndenter.h === --- lib/Format/ContinuationIndenter.h +++ lib/Format/ContinuationIndenter.h @@ -29,6 +29,7 @@ namespace format { class AnnotatedLine; +class BreakableToken; struct FormatToken; struct LineState; struct ParenState; @@ -105,11 +106,20 @@ /// /// \returns An extra penalty induced by reformatting the token. unsigned reformatRawStringLiteral(const FormatToken &Current, -unsigned StartColumn, LineState &State, -StringRef Delimiter, +LineState &State, const FormatStyle &RawStringStyle, bool DryRun); + /// \brief If the current token is at the end of the current line, handle + /// the transition to the next line. + unsigned handleEndOfLine(const FormatToken &Current, LineState &State, + bool DryRun, bool AllowBreak); + + /// \brief If \p Current is a raw string that is configured to be reformatted, + /// return the style to be used. + llvm::Optional getRawStringStyle(const FormatToken &Current, +const LineState &State); + /// \brief If the current token sticks out over the end of the line, break /// it if possible. /// @@ -120,7 +130,13 @@ /// penalty for the column limit violation in the last line (and in single /// line tokens) is handled in \c addNextStateToQueue. unsigned breakProtrudingToken(const FormatToken &Current, LineState &State, -bool DryRun); +bool AllowBreak, bool DryRun); + + /// \brief Returns the \c BreakableToken starting at \p Current, or nullptr + /// if the current token cannot be broken. + std::unique_ptr + createBreakableToken(const FormatToken &Current, LineState &State, + bool AllowBreak); /// \brief Appends the next token to \p State and updates information /// necessary for indentation. Index: lib/Format/ContinuationIndenter.cpp === --- lib/Format/ContinuationIndenter.cpp +++ lib/Format/ContinuationIndenter.cpp @@ -1008,8 +1008,8 @@ moveStatePastFakeLParens(State, Newline); moveStatePastScopeCloser(State); - bool CanBreakProtrudingToken = !State.Stack.back().NoLineBreak && - !State.Stack.back().NoLineBreakInOperand; + bool AllowBreak = !State.Stack.back().NoLineBreak && +!State.Stack.back().NoLineBreakInOperand; mo
[PATCH] D39900: Refactor ContinuationIndenter's breakProtrudingToken logic into slightly moreorthogonal pieces.
klimek added inline comments. Comment at: lib/Format/ContinuationIndenter.cpp:1028 + unsigned Penalty = + handleEndOfLine(Current, State, DryRun, AllowBreak); krasimir wrote: > Why `handleEndOfLine`? Is it guaranteed that here we've reached the end of > the line? No, this is used to do things in case we have reached the end of the line, as that's hard to check. I also wanted a better name, but wasn't able to come up with one (and we do similar things in other places here, where checking a condition is equivalent to running through all the code to do the things necessary). Comment at: lib/Format/ContinuationIndenter.cpp:1284 + unsigned StartColumn = State.Column - Current.ColumnWidth; + auto Delimiter = *getRawStringDelimiter(Current.TokenText); // The text of a raw string is between the leading 'R"delimiter(' and the krasimir wrote: > At this point, we compute `getRawStringDelimiter` twice: once here, and once > in `getRawStringStyle` in the caller side. Ideally, we'd only like to compute > it once. That's why it was a parameter before. I got that, but I think passing around the delimiter is super awkward, and computing it is cheap. If computing it is the problem we should store it in the FormatToken. Comment at: lib/Format/ContinuationIndenter.cpp:1408 +std::unique_ptr ContinuationIndenter::createBreakableToken( +const FormatToken &Current, LineState &State, bool AllowBreak) { unsigned StartColumn = State.Column - Current.ColumnWidth; krasimir wrote: > If `AllowBreak == false`, in which cases will this return a non-`nullptr`? Only for string literals, as AllowBreak is really about whether we can break in the token space, but for comments (or raw strings, but those are handled differently anyway) we break in the comment space. Comment at: unittests/Format/FormatTest.cpp:6322 "#include \"some long include\" // with a comment\n" - "#include \"some very long include paaath\"", + "#include \"some very long include path\"\n" + "#include \n", krasimir wrote: > What happened to the old test line? It was unnecessarily long. I found it weird that it went out of its way to add more a's over the line limit. https://reviews.llvm.org/D39900 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r317891 - [OpenMP] diagnose assign to firstprivate const, patch by Joel E. Denny
Author: abataev Date: Fri Nov 10 07:39:50 2017 New Revision: 317891 URL: http://llvm.org/viewvc/llvm-project?rev=317891&view=rev Log: [OpenMP] diagnose assign to firstprivate const, patch by Joel E. Denny Summary: [OpenMP] diagnose assign to firstprivate const Clang does not diagnose assignments to const variables declared firstprivate. Furthermore, codegen is broken such that, at run time, such assignments simply have no effect. For example, the following prints 0 not 1: int main() { const int i = 0; #pragma omp parallel firstprivate(i) { i=1; printf("%d\n", i); } return 0; } This commit makes these assignments a compile error, which is consistent with other OpenMP compilers I've tried (pgcc 17.4-0, gcc 6.3.0). Reviewers: ABataev Reviewed By: ABataev Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D39859 Modified: cfe/trunk/lib/Sema/SemaExpr.cpp cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp Modified: cfe/trunk/lib/Sema/SemaExpr.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=317891&r1=317890&r2=317891&view=diff == --- cfe/trunk/lib/Sema/SemaExpr.cpp (original) +++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Nov 10 07:39:50 2017 @@ -14352,8 +14352,13 @@ static bool captureInCapturedRegion(Capt bool ByRef = true; // Using an LValue reference type is consistent with Lambdas (see below). if (S.getLangOpts().OpenMP && RSI->CapRegionKind == CR_OpenMP) { -if (S.IsOpenMPCapturedDecl(Var)) +if (S.IsOpenMPCapturedDecl(Var)) { + bool HasConst = DeclRefType.isConstQualified(); DeclRefType = DeclRefType.getUnqualifiedType(); + // Don't lose diagnostics about assignments to const. + if (HasConst) +DeclRefType.addConst(); +} ByRef = S.IsOpenMPCapturedByRef(Var, RSI->OpenMPLevel); } Modified: cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp?rev=317891&r1=317890&r2=317891&view=diff == --- cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp (original) +++ cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp Fri Nov 10 07:39:50 2017 @@ -56,7 +56,7 @@ using A::x; } int main(int argc, char **argv) { - const int d = 5; + const int d = 5; // expected-note {{variable 'd' declared const here}} const int da[5] = { 0 }; S4 e(4); S5 g(5); @@ -72,6 +72,8 @@ int main(int argc, char **argv) { #pragma omp parallel firstprivate (argc) #pragma omp parallel firstprivate (S1) // expected-error {{'S1' does not refer to a value}} #pragma omp parallel firstprivate (a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} + #pragma omp parallel firstprivate (d) +d = 5; // expected-error {{cannot assign to variable 'd' with const-qualified type}} #pragma omp parallel firstprivate (argv[1]) // expected-error {{expected variable name}} #pragma omp parallel firstprivate(ba) #pragma omp parallel firstprivate(ca) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39859: [OpenMP] diagnose assign to firstprivate const
This revision was automatically updated to reflect the committed changes. Closed by commit rL317891: [OpenMP] diagnose assign to firstprivate const, patch by Joel E. Denny (authored by ABataev). Changed prior to commit: https://reviews.llvm.org/D39859?vs=122329&id=122434#toc Repository: rL LLVM https://reviews.llvm.org/D39859 Files: cfe/trunk/lib/Sema/SemaExpr.cpp cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp Index: cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp === --- cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp +++ cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp @@ -56,7 +56,7 @@ } int main(int argc, char **argv) { - const int d = 5; + const int d = 5; // expected-note {{variable 'd' declared const here}} const int da[5] = { 0 }; S4 e(4); S5 g(5); @@ -72,6 +72,8 @@ #pragma omp parallel firstprivate (argc) #pragma omp parallel firstprivate (S1) // expected-error {{'S1' does not refer to a value}} #pragma omp parallel firstprivate (a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} + #pragma omp parallel firstprivate (d) +d = 5; // expected-error {{cannot assign to variable 'd' with const-qualified type}} #pragma omp parallel firstprivate (argv[1]) // expected-error {{expected variable name}} #pragma omp parallel firstprivate(ba) #pragma omp parallel firstprivate(ca) Index: cfe/trunk/lib/Sema/SemaExpr.cpp === --- cfe/trunk/lib/Sema/SemaExpr.cpp +++ cfe/trunk/lib/Sema/SemaExpr.cpp @@ -14352,8 +14352,13 @@ bool ByRef = true; // Using an LValue reference type is consistent with Lambdas (see below). if (S.getLangOpts().OpenMP && RSI->CapRegionKind == CR_OpenMP) { -if (S.IsOpenMPCapturedDecl(Var)) +if (S.IsOpenMPCapturedDecl(Var)) { + bool HasConst = DeclRefType.isConstQualified(); DeclRefType = DeclRefType.getUnqualifiedType(); + // Don't lose diagnostics about assignments to const. + if (HasConst) +DeclRefType.addConst(); +} ByRef = S.IsOpenMPCapturedByRef(Var, RSI->OpenMPLevel); } Index: cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp === --- cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp +++ cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp @@ -56,7 +56,7 @@ } int main(int argc, char **argv) { - const int d = 5; + const int d = 5; // expected-note {{variable 'd' declared const here}} const int da[5] = { 0 }; S4 e(4); S5 g(5); @@ -72,6 +72,8 @@ #pragma omp parallel firstprivate (argc) #pragma omp parallel firstprivate (S1) // expected-error {{'S1' does not refer to a value}} #pragma omp parallel firstprivate (a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} + #pragma omp parallel firstprivate (d) +d = 5; // expected-error {{cannot assign to variable 'd' with const-qualified type}} #pragma omp parallel firstprivate (argv[1]) // expected-error {{expected variable name}} #pragma omp parallel firstprivate(ba) #pragma omp parallel firstprivate(ca) Index: cfe/trunk/lib/Sema/SemaExpr.cpp === --- cfe/trunk/lib/Sema/SemaExpr.cpp +++ cfe/trunk/lib/Sema/SemaExpr.cpp @@ -14352,8 +14352,13 @@ bool ByRef = true; // Using an LValue reference type is consistent with Lambdas (see below). if (S.getLangOpts().OpenMP && RSI->CapRegionKind == CR_OpenMP) { -if (S.IsOpenMPCapturedDecl(Var)) +if (S.IsOpenMPCapturedDecl(Var)) { + bool HasConst = DeclRefType.isConstQualified(); DeclRefType = DeclRefType.getUnqualifiedType(); + // Don't lose diagnostics about assignments to const. + if (HasConst) +DeclRefType.addConst(); +} ByRef = S.IsOpenMPCapturedByRef(Var, RSI->OpenMPLevel); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39902: [OpenMP] Parse+Sema for copyin clause of 'teams distribute parallel for'
carlo.bertolli created this revision. Simply leverage existing implementation and verify correct functioning with two regression tests. Repository: rL LLVM https://reviews.llvm.org/D39902 Files: include/clang/Basic/OpenMPKinds.def test/OpenMP/teams_distribute_parallel_for_ast_print.cpp test/OpenMP/teams_distribute_parallel_for_copyin_messages.cpp Index: test/OpenMP/teams_distribute_parallel_for_copyin_messages.cpp === --- /dev/null +++ test/OpenMP/teams_distribute_parallel_for_copyin_messages.cpp @@ -0,0 +1,113 @@ +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s + +void foo() { +} + +bool foobool(int argc) { + return argc; +} + +struct S1; // expected-note {{declared here}} +class S2 { + mutable int a; + +public: + S2() : a(0) {} + S2 &operator=(S2 &s2) { return *this; } +}; +class S3 { + int a; + +public: + S3() : a(0) {} + S3 &operator=(S3 &s3) { return *this; } +}; +class S4 { + int a; + S4(); + S4 &operator=(const S4 &s4); // expected-note {{implicitly declared private here}} + +public: + S4(int v) : a(v) {} +}; +class S5 { + int a; + S5() : a(0) {} + S5 &operator=(const S5 &s5) { return *this; } // expected-note {{implicitly declared private here}} + +public: + S5(int v) : a(v) {} +}; +template +class ST { +public: + static T s; +}; + +S2 k; +S3 h; +S4 l(3); +S5 m(4); +#pragma omp threadprivate(h, k, l, m) + +namespace A { +double x; +#pragma omp threadprivate(x) +} +namespace B { +using A::x; +} + +int main(int argc, char **argv) { + int i; +#pragma omp target +#pragma omp teams distribute parallel for copyin // expected-error {{expected '(' after 'copyin'}} + for (i = 0; i < argc; ++i) +foo(); +#pragma omp target +#pragma omp teams distribute parallel for copyin( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + for (i = 0; i < argc; ++i) +foo(); +#pragma omp target +#pragma omp teams distribute parallel for copyin() // expected-error {{expected expression}} + for (i = 0; i < argc; ++i) +foo(); +#pragma omp target +#pragma omp teams distribute parallel for copyin(k // expected-error {{expected ')'}} expected-note {{to match this '('}} + for (i = 0; i < argc; ++i) +foo(); +#pragma omp target +#pragma omp teams distribute parallel for copyin(h, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + for (i = 0; i < argc; ++i) +foo(); +#pragma omp target +#pragma omp teams distribute parallel for copyin(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} + for (i = 0; i < argc; ++i) +foo(); +#pragma omp target +#pragma omp teams distribute parallel for copyin(l) // expected-error {{'operator=' is a private member of 'S4'}} + for (i = 0; i < argc; ++i) +foo(); +#pragma omp target +#pragma omp teams distribute parallel for copyin(S1) // expected-error {{'S1' does not refer to a value}} + for (i = 0; i < argc; ++i) +foo(); +#pragma omp target +#pragma omp teams distribute parallel for copyin(argv[1]) // expected-error {{expected variable name}} + for (i = 0; i < argc; ++i) +foo(); +#pragma omp target +#pragma omp teams distribute parallel for copyin(i) // expected-error {{copyin variable must be threadprivate}} + for (i = 0; i < argc; ++i) +foo(); +#pragma omp target +#pragma omp teams distribute parallel for copyin(m) // expected-error {{'operator=' is a private member of 'S5'}} + for (i = 0; i < argc; ++i) +foo(); +#pragma omp target +#pragma omp teams distribute parallel for copyin(ST::s, B::x) // expected-error {{copyin variable must be threadprivate}} + for (i = 0; i < argc; ++i) +foo(); + + return 0; +} Index: test/OpenMP/teams_distribute_parallel_for_ast_print.cpp === --- test/OpenMP/teams_distribute_parallel_for_ast_print.cpp +++ test/OpenMP/teams_distribute_parallel_for_ast_print.cpp @@ -8,6 +8,9 @@ void foo() {} +int x; +#pragma omp threadprivate(x) + struct S { S(): a(0) {} S(int v) : a(v) {} @@ -40,7 +43,7 @@ void foo() { int b, argv, d, c, e, f; #pragma omp target -#pragma omp teams distribute parallel for default(none), private(b) firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f) thread_limit(d) +#pragma omp teams distribute parallel for default(none), private(b) firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f) thread_limit(d) copyin(x) for (int k = 0; k < a.a; ++k) ++a.a; } @@ -50,7 +53,7 @@ // CHECK: #pragma omp target // CHECK-NEXT: #pragma omp teams distribute parallel for private(this->a) private(this->a) // CHECK: #pragma omp target -// CHECK-NEXT: #pragma omp teams distribute parallel for default(none) private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f) thread_limit(d) +// CHECK-NEXT: #pragma o
[PATCH] D39902: [OpenMP] Parse+Sema for copyin clause of 'teams distribute parallel for'
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG Repository: rL LLVM https://reviews.llvm.org/D39902 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r317893 - [OpenMP] Parse+Sema for copyin clause of 'teams distribute parallel for'
Author: cbertol Date: Fri Nov 10 08:05:00 2017 New Revision: 317893 URL: http://llvm.org/viewvc/llvm-project?rev=317893&view=rev Log: [OpenMP] Parse+Sema for copyin clause of 'teams distribute parallel for' https://reviews.llvm.org/D39902 Simply leverage existing implementation and verify correct functioning with two regression tests. Added: cfe/trunk/test/OpenMP/teams_distribute_parallel_for_copyin_messages.cpp Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def cfe/trunk/test/OpenMP/teams_distribute_parallel_for_ast_print.cpp Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=317893&r1=317892&r2=317893&view=diff == --- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original) +++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Fri Nov 10 08:05:00 2017 @@ -748,6 +748,7 @@ OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLA OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(linear) OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(num_teams) OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(thread_limit) +OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(copyin) // Clauses allowed for OpenMP directive 'target teams'. OPENMP_TARGET_TEAMS_CLAUSE(if) Modified: cfe/trunk/test/OpenMP/teams_distribute_parallel_for_ast_print.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_distribute_parallel_for_ast_print.cpp?rev=317893&r1=317892&r2=317893&view=diff == --- cfe/trunk/test/OpenMP/teams_distribute_parallel_for_ast_print.cpp (original) +++ cfe/trunk/test/OpenMP/teams_distribute_parallel_for_ast_print.cpp Fri Nov 10 08:05:00 2017 @@ -8,6 +8,9 @@ void foo() {} +int x; +#pragma omp threadprivate(x) + struct S { S(): a(0) {} S(int v) : a(v) {} @@ -40,7 +43,7 @@ public: void foo() { int b, argv, d, c, e, f; #pragma omp target -#pragma omp teams distribute parallel for default(none), private(b) firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f) thread_limit(d) +#pragma omp teams distribute parallel for default(none), private(b) firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f) thread_limit(d) copyin(x) for (int k = 0; k < a.a; ++k) ++a.a; } @@ -50,7 +53,7 @@ public: // CHECK: #pragma omp target // CHECK-NEXT: #pragma omp teams distribute parallel for private(this->a) private(this->a) // CHECK: #pragma omp target -// CHECK-NEXT: #pragma omp teams distribute parallel for default(none) private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f) thread_limit(d) +// CHECK-NEXT: #pragma omp teams distribute parallel for default(none) private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f) thread_limit(d) copyin(x) class S8 : public S7 { S8() {} @@ -74,7 +77,7 @@ public: void bar() { int b, argv, d, c, e, f8; #pragma omp target -#pragma omp teams distribute parallel for default(none), private(b) firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f8) thread_limit(d) +#pragma omp teams distribute parallel for default(none), private(b) firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f8) thread_limit(d) copyin(x) for (int k = 0; k < a.a; ++k) ++a.a; } @@ -86,7 +89,7 @@ public: // CHECK: #pragma omp target // CHECK-NEXT: #pragma omp teams distribute parallel for private(this->a) private(this->a) // CHECK: #pragma omp target -// CHECK-NEXT: #pragma omp teams distribute parallel for default(none) private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f8) thread_limit(d) +// CHECK-NEXT: #pragma omp teams distribute parallel for default(none) private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f8) thread_limit(d) copyin(x) template T tmain(T argc) { @@ -127,11 +130,11 @@ T tmain(T argc) { // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: foo(); #pragma omp target -#pragma omp teams distribute parallel for default(none), private(b) firstprivate(argc) shared(d) reduction(+:c) reduction(max:e) num_teams(f) thread_limit(d) +#pragma omp teams distribute parallel for default(none), private(b) firstprivate(argc) shared(d) reduction(+:c) reduction(max:e) num_teams(f) thread_limit(d) copyin(x) for (int k = 0; k < 10; ++k) e += d + argc; // CHECK: #pragma omp target -// CHECK-NEXT: #pragma omp teams distribute parallel for default(none) private(b) firstprivate(argc) shared(d) reduction(+: c) reduction(max: e) num_teams(f) thread_limit(d) +// CHECK-NEXT: #pragma omp teams distribute parallel for default(none) private(b) firstprivate(argc) shared(d) reduction(+: c) reduction(max: e) num_teams(f) thread_limit(d) copyin(x) // CHECK-NEXT: for (int k = 0; k
[PATCH] D39902: [OpenMP] Parse+Sema for copyin clause of 'teams distribute parallel for'
carlo.bertolli closed this revision. carlo.bertolli added a comment. Committed revision 317893. Repository: rL LLVM https://reviews.llvm.org/D39902 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39763: [clang] [python] [tests] Rewrite to use standard unittest module
mgorny added a comment. Thanks. I'll update it to incorporate the lately committed test fixes, and push it later today. Repository: rL LLVM https://reviews.llvm.org/D39763 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39829: add new check for property declaration
benhamilton added inline comments. Comment at: clang-tidy/objc/PropertyDeclarationCheck.cpp:41 + objcPropertyDecl( + // the property name should be in Lower Camel Case like + // 'lowerCamelCase' There are some exceptions we should special case. Acronyms like `URL` and `HTTP` and `HTML` are allowed at the beginning of method names (and property names—although that is not explicitly mentioned, property names follow the same guidelines as method names): https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingBasics.html#//apple_ref/doc/uid/20001281-1002931-BBCFHEAB > For method names, start with a lowercase letter and capitalize the first > letter of embedded words. Don’t use prefixes. > `fileExistsAtPath:isDirectory:` > > An exception to this guideline is method names that start with a well-known > acronym, for example, `TIFFRepresentation` (NSImage). There is a list of well-known acronyms listed here: https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/APIAbbreviations.html#//apple_ref/doc/uid/20001285-BCIHCGAE ``` ASCII PDF XML HTML URL RTF HTTP TIFF JPG PNG GIF LZW ROM RGB CMYK MIDI FTP ``` Comment at: docs/clang-tidy/checks/google-objc-global-variable-declaration.rst:1 .. title:: clang-tidy - google-objc-global-variable-declaration Let's remove "google-" everywhere and mention only Apple's style guide. Comment at: docs/clang-tidy/checks/objc-property-declaration.rst:7 +Finds property declarations in Objective-C files that do not follow the pattern +of property names in Google's Objective-C Style Guide. The property name should +be in the format of Lower Camel Case. hokein wrote: > benhamilton wrote: > > hokein wrote: > > > Google style? but the link you provided is Apple. > > Google's Objective-C style guide is a list of additions on top of Apple's > > Objective-C style guide. > > > > Property naming standards are defined in Apple's style guide, and not > > changed by Google's. > I see, thanks for the clarification, I think the "Apple" would be clearer. Yeah, we don't want to mention Google here. Apple is good. Comment at: test/clang-tidy/objc-property-declaration.m:8 +@property(assign, nonatomic) int camelCase; +// CHECK-MESSAGES-NOT: :[[@LINE-1]]:34: warning: property 'camelCase' is not in proper format according to property naming convention [objc-property-declaration] +@end Wizard wrote: > hokein wrote: > > Why does the check catch this case? Isn't `camelCase` a correct name? > This is CHECK-MESSAGES-NOT I think in that case you don't need an explicit CHECK (there is implicitly a "CHECK-MESSAGES-NOT" on every line for all warnings which fails the test if a warning is raised). https://reviews.llvm.org/D39829 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39829: add new check for property declaration
benhamilton added inline comments. Comment at: clang-tidy/objc/PropertyDeclarationCheck.cpp:41 + objcPropertyDecl( + // the property name should be in Lower Camel Case like + // 'lowerCamelCase' benhamilton wrote: > There are some exceptions we should special case. Acronyms like `URL` and > `HTTP` and `HTML` are allowed at the beginning of method names (and property > names—although that is not explicitly mentioned, property names follow the > same guidelines as method names): > > https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingBasics.html#//apple_ref/doc/uid/20001281-1002931-BBCFHEAB > > > For method names, start with a lowercase letter and capitalize the first > > letter of embedded words. Don’t use prefixes. > > `fileExistsAtPath:isDirectory:` > > > > An exception to this guideline is method names that start with a well-known > > acronym, for example, `TIFFRepresentation` (NSImage). > > There is a list of well-known acronyms listed here: > > https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/APIAbbreviations.html#//apple_ref/doc/uid/20001285-BCIHCGAE > > ``` > ASCII > PDF > XML > HTML > URL > RTF > HTTP > TIFF > JPG > PNG > GIF > LZW > ROM > RGB > CMYK > MIDI > FTP > ``` > Probably the right thing to do is make this a configuration option, the same way I did with `objc-forbidden-subclassing`, and default to the above list. https://github.com/llvm-mirror/clang-tools-extra/blob/master/clang-tidy/objc/ForbiddenSubclassingCheck.cpp#L25 https://github.com/llvm-mirror/clang-tools-extra/blob/master/clang-tidy/objc/ForbiddenSubclassingCheck.cpp#L74 https://github.com/llvm-mirror/clang-tools-extra/blob/master/clang-tidy/objc/ForbiddenSubclassingCheck.cpp#L110 https://reviews.llvm.org/D39829 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r317898 - [NFC] Pacify bbot for OpenMP 'teams distribute parallel for'
Author: cbertol Date: Fri Nov 10 08:49:09 2017 New Revision: 317898 URL: http://llvm.org/viewvc/llvm-project?rev=317898&view=rev Log: [NFC] Pacify bbot for OpenMP 'teams distribute parallel for' Modified: cfe/trunk/test/OpenMP/teams_distribute_parallel_for_messages.cpp Modified: cfe/trunk/test/OpenMP/teams_distribute_parallel_for_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_distribute_parallel_for_messages.cpp?rev=317898&r1=317897&r2=317898&view=diff == --- cfe/trunk/test/OpenMP/teams_distribute_parallel_for_messages.cpp (original) +++ cfe/trunk/test/OpenMP/teams_distribute_parallel_for_messages.cpp Fri Nov 10 08:49:09 2017 @@ -94,7 +94,7 @@ L1: } #pragma omp target -#pragma omp teams distribute parallel for copyin(pvt) // expected-error {{unexpected OpenMP clause 'copyin' in directive '#pragma omp teams distribute parallel for'}} +#pragma omp teams distribute parallel for copyin(pvt) for (int n = 0; n < 100; ++n) {} return 0; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39900: Refactor ContinuationIndenter's breakProtrudingToken logic into slightly moreorthogonal pieces.
krasimir accepted this revision. krasimir added a comment. This revision is now accepted and ready to land. Maybe we should further refactor `getRawStringStyle` into `llvm::Optional> getRawStringStyleAndDelimiter` and that would nicely take care of the duplicated effort? https://reviews.llvm.org/D39900 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39161: [bindings] remove unique_external test failure
mgorny added a comment. I've rewritten the tests to use `unittest`, so this patch needs to be updated now. However, you may want to wait a while since @compnerd promised to look at it and he might have a way to get `uniqueExternal()` linkage. https://reviews.llvm.org/D39161 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r317901 - [clang-format] Handle leading comments in using declaration
Author: djasper Date: Fri Nov 10 09:11:18 2017 New Revision: 317901 URL: http://llvm.org/viewvc/llvm-project?rev=317901&view=rev Log: [clang-format] Handle leading comments in using declaration This fixes clang-format internal assertion for the following code: /* override */ using std::string; Patch by Igor Sugak. Thank you. Modified: cfe/trunk/lib/Format/UsingDeclarationsSorter.cpp cfe/trunk/unittests/Format/UsingDeclarationsSorterTest.cpp Modified: cfe/trunk/lib/Format/UsingDeclarationsSorter.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UsingDeclarationsSorter.cpp?rev=317901&r1=317900&r2=317901&view=diff == --- cfe/trunk/lib/Format/UsingDeclarationsSorter.cpp (original) +++ cfe/trunk/lib/Format/UsingDeclarationsSorter.cpp Fri Nov 10 09:11:18 2017 @@ -172,15 +172,17 @@ std::pair UsingDeclarations; for (size_t I = 0, E = AnnotatedLines.size(); I != E; ++I) { +const auto *FirstTok = AnnotatedLines[I]->First; if (AnnotatedLines[I]->InPPDirective || -!AnnotatedLines[I]->startsWith(tok::kw_using) || -AnnotatedLines[I]->First->Finalized) { +!AnnotatedLines[I]->startsWith(tok::kw_using) || FirstTok->Finalized) { endUsingDeclarationBlock(&UsingDeclarations, SourceMgr, &Fixes); continue; } -if (AnnotatedLines[I]->First->NewlinesBefore > 1) +if (FirstTok->NewlinesBefore > 1) endUsingDeclarationBlock(&UsingDeclarations, SourceMgr, &Fixes); -std::string Label = computeUsingDeclarationLabel(AnnotatedLines[I]->First); +const auto *UsingTok = +FirstTok->is(tok::comment) ? FirstTok->getNextNonComment() : FirstTok; +std::string Label = computeUsingDeclarationLabel(UsingTok); if (Label.empty()) { endUsingDeclarationBlock(&UsingDeclarations, SourceMgr, &Fixes); continue; Modified: cfe/trunk/unittests/Format/UsingDeclarationsSorterTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/UsingDeclarationsSorterTest.cpp?rev=317901&r1=317900&r2=317901&view=diff == --- cfe/trunk/unittests/Format/UsingDeclarationsSorterTest.cpp (original) +++ cfe/trunk/unittests/Format/UsingDeclarationsSorterTest.cpp Fri Nov 10 09:11:18 2017 @@ -348,6 +348,13 @@ TEST_F(UsingDeclarationsSorterTest, Sort {tooling::Range(19, 1)})); } +TEST_F(UsingDeclarationsSorterTest, SortsUsingDeclarationsWithLeadingkComments) { + EXPECT_EQ("/* comment */ using a;\n" +"/* comment */ using b;", +sortUsingDeclarations("/* comment */ using b;\n" + "/* comment */ using a;")); +} + } // end namespace } // end namespace format } // end namespace clang ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39478: [clang-format] Handle leading comments in using declaration
djasper closed this revision. djasper added a comment. Submitted as r317901. https://reviews.llvm.org/D39478 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39611: [CodeGen] change const-ness of complex calls
spatel added a comment. Thanks for the clarification! If I'm reading this properly, we should make the same kind of change as in https://reviews.llvm.org/D39481 ('c' -> 'e') for most of complex.h. Ie, the standard allows errno-setting, and it's (unfortunately for optimization) even more clearly stated in the newer additions to the standards. We can leave these functions as always constant ('c') because they don't actually do any math and therefore won't set errno: cimag ( http://en.cppreference.com/w/c/numeric/complex/cimag ) creal ( http://en.cppreference.com/w/c/numeric/complex/creal ) cproj ( http://en.cppreference.com/w/c/numeric/complex/cproj ) conj (http://en.cppreference.com/w/c/numeric/complex/conj ) https://reviews.llvm.org/D39611 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39161: [bindings] remove unique_external test failure
frutiger added a comment. Thanks for the note, I'll wait. https://reviews.llvm.org/D39161 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39706: [refactor][extract] Initial implementation of variable captures
ioeric added inline comments. Comment at: lib/Tooling/Refactoring/Extract/CaptureVariables.cpp:97 + } + llvm_unreachable("invalid kind!"); +} A more informative message would be better. Comment at: lib/Tooling/Refactoring/Extract/CaptureVariables.h:36 + explicit CapturedExtractedEntity(const VarDecl *VD) + : Kind(CapturedVarDecl), VD(VD) {} + arphaman wrote: > ioeric wrote: > > Maybe a `FIXME` here for `Kind`? > I think this constructor will always set the same kind. Then why do you need `Kind`? Is it changed somewhere else? Please document the behavior, Comment at: lib/Tooling/Refactoring/Extract/CaptureVariables.h:28 +/// passed to the extracted function as an argument. +class CapturedExtractedEntity { + enum EntityKind { The name is a bit hard to parse. Maybe just `CapturedEntity` or simply `CapturedVar`? Repository: rL LLVM https://reviews.llvm.org/D39706 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r315614 - [Sema] Diagnose tautological comparison with type's min/max values
On Thu, Oct 12, 2017 at 2:33 PM, Roman Lebedev via cfe-commits wrote: > On Fri, Oct 13, 2017 at 12:12 AM, Nico Weber wrote: >> Huh, I consider clang not warning on this a feature, not a bug. Why are we >> trying to match what gcc does here? > Because i have been bitten by this more than once. > It did result in big amount of wasted time, and this "thread": > https://lists.llvm.org/pipermail/llvm-dev/2017-August/116390.html > > As with all the clang diagnostics, you can disable them > I personally don't have any opinion on comparisons with > std::numeric_limits<...>::{min,max}() To disable the new warning but keep the ones we used to have enabled, we now need to pass -Wno-tautological-constant-compare -Wtautological-unsigned-zero-compare -Wtautological-constant-out-of-range-compare, which is quite a mouthful. It would perhaps be better if the new warning could have been behind a flag that could be disabled separately. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39611: [CodeGen] change const-ness of complex calls
hfinkel added a comment. In https://reviews.llvm.org/D39611#921923, @spatel wrote: > Thanks for the clarification! > > If I'm reading this properly, we should make the same kind of change as in > https://reviews.llvm.org/D39481 ('c' -> 'e') for most of complex.h. Ie, the > standard allows errno-setting, and it's (unfortunately for optimization) even > more clearly stated in the newer additions to the standards. > > We can leave these functions as always constant ('c') because they don't > actually do any math and therefore won't set errno: > cimag ( http://en.cppreference.com/w/c/numeric/complex/cimag ) > creal ( http://en.cppreference.com/w/c/numeric/complex/creal ) > cproj ( http://en.cppreference.com/w/c/numeric/complex/cproj ) > conj (http://en.cppreference.com/w/c/numeric/complex/conj ) Sounds right to me. https://reviews.llvm.org/D39611 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39730: Enabling constructor code completion
jkorous-apple updated this revision to Diff 122470. jkorous-apple added a comment. I am able to enable ctor completion selectively in translate unit scope and namespace scope so ctor completion does not appear in dot access context. I haven't figured out how to explicitly specify that completion context needs to be qualified id though. https://reviews.llvm.org/D39730 Files: lib/Sema/SemaCodeComplete.cpp test/CodeCompletion/ctor.cpp Index: test/CodeCompletion/ctor.cpp === --- /dev/null +++ test/CodeCompletion/ctor.cpp @@ -0,0 +1,50 @@ +struct foo { + foo(); + ~foo(); + + foo(const foo&) = delete; + foo(foo&&) = delete; + foo& operator=(const foo&) = delete; + foo& operator=(foo&&) = delete; + + static bool faz; + int far; +}; + +foo::foo() { } +// RUN: c-index-test -code-completion-at=%s:14:7 %s | FileCheck -check-prefix=CHECK-TRANSLATION-UNIT %s +// CHECK-TRANSLATION-UNIT:CXXConstructor:{TypedText foo}{LeftParen (}{RightParen )} (35) +// CHECK-TRANSLATION-UNIT:CXXConstructor:{TypedText foo}{LeftParen (}{Placeholder const foo &}{RightParen )} (35) (unavailable) +// CHECK-TRANSLATION-UNIT:CXXConstructor:{TypedText foo}{LeftParen (}{Placeholder foo &&}{RightParen )} (35) (unavailable) + +namespace ns_foo { +struct foo { + foo(); + ~foo(); + + foo(const foo&) = delete; + foo(foo&&) = delete; + foo& operator=(const foo&) = delete; + foo& operator=(foo&&) = delete; + + static bool faz; + int far; +}; + +foo::foo() { } +// RUN: c-index-test -code-completion-at=%s:34:7 %s | FileCheck -check-prefix=CHECK-NAMESPACE %s +// CHECK-NAMESPACE: CXXConstructor:{TypedText foo}{LeftParen (}{RightParen )} (35) +// CHECK-NAMESPACE: CXXConstructor:{TypedText foo}{LeftParen (}{Placeholder const ns_foo::foo &}{RightParen )} (35) (unavailable) +// CHECK-NAMESPACE: CXXConstructor:{TypedText foo}{LeftParen (}{Placeholder ns_foo::foo &&}{RightParen )} (35) (unavailable) + +} + +int main() { + foo baz; + baz.far = 5; + foo::faz = 42; +} +// RUN: c-index-test -code-completion-at=%s:44:7 %s | not grep "CXXConstructor" +// RUN: c-index-test -code-completion-at=%s:44:8 %s | not grep "CXXConstructor" +// RUN: c-index-test -code-completion-at=%s:45:8 %s | not grep "CXXConstructor" +// RUN: c-index-test -code-completion-at=%s:45:9 %s | not grep "CXXConstructor" Index: lib/Sema/SemaCodeComplete.cpp === --- lib/Sema/SemaCodeComplete.cpp +++ lib/Sema/SemaCodeComplete.cpp @@ -975,9 +975,11 @@ bool AsNestedNameSpecifier = false; if (!isInterestingDecl(R.Declaration, AsNestedNameSpecifier)) return; - - // C++ constructors are never found by name lookup. - if (isa(R.Declaration)) + + if (isa(R.Declaration) + && dyn_cast(CurContext) == nullptr + && dyn_cast(CurContext) == nullptr +) return; if (Hiding && CheckHiddenResult(R, CurContext, Hiding)) Index: test/CodeCompletion/ctor.cpp === --- /dev/null +++ test/CodeCompletion/ctor.cpp @@ -0,0 +1,50 @@ +struct foo { + foo(); + ~foo(); + + foo(const foo&) = delete; + foo(foo&&) = delete; + foo& operator=(const foo&) = delete; + foo& operator=(foo&&) = delete; + + static bool faz; + int far; +}; + +foo::foo() { } +// RUN: c-index-test -code-completion-at=%s:14:7 %s | FileCheck -check-prefix=CHECK-TRANSLATION-UNIT %s +// CHECK-TRANSLATION-UNIT:CXXConstructor:{TypedText foo}{LeftParen (}{RightParen )} (35) +// CHECK-TRANSLATION-UNIT:CXXConstructor:{TypedText foo}{LeftParen (}{Placeholder const foo &}{RightParen )} (35) (unavailable) +// CHECK-TRANSLATION-UNIT:CXXConstructor:{TypedText foo}{LeftParen (}{Placeholder foo &&}{RightParen )} (35) (unavailable) + +namespace ns_foo { +struct foo { + foo(); + ~foo(); + + foo(const foo&) = delete; + foo(foo&&) = delete; + foo& operator=(const foo&) = delete; + foo& operator=(foo&&) = delete; + + static bool faz; + int far; +}; + +foo::foo() { } +// RUN: c-index-test -code-completion-at=%s:34:7 %s | FileCheck -check-prefix=CHECK-NAMESPACE %s +// CHECK-NAMESPACE: CXXConstructor:{TypedText foo}{LeftParen (}{RightParen )} (35) +// CHECK-NAMESPACE: CXXConstructor:{TypedText foo}{LeftParen (}{Placeholder const ns_foo::foo &}{RightParen )} (35) (unavailable) +// CHECK-NAMESPACE: CXXConstructor:{TypedText foo}{LeftParen (}{Placeholder ns_foo::foo &&}{RightParen )} (35) (unavailable) + +} + +int main() { + foo baz; + baz.far = 5; + foo::faz = 42; +} +// RUN: c-index-test -code-completion-at=%s:44:7 %s | not grep "CXXConstructor" +// RUN: c-index-test -code-completion-at=%s:44:8 %s | not grep "CXXConstructor" +// RUN: c-index-test -code-completion-at=%s:45:8 %s | not grep "CXXConstructor" +// RUN: c-index-test -code-completion-at=%s:45:9 %s | not grep "CXXConstructor" Index: lib/Sema/SemaCodeComplete.cpp === --- lib/Sema/SemaCo
[PATCH] D39730: Enabling constructor code completion
arphaman added a comment. It doesn't look like this works in the body of the class (at least there's no test for it). For that you might have to inject these kind results by performing another lookup when completing inside the body of the class. Comment at: lib/Sema/SemaCodeComplete.cpp:980 + if (isa(R.Declaration) + && dyn_cast(CurContext) == nullptr + && dyn_cast(CurContext) == nullptr You can use `!isa` https://reviews.llvm.org/D39730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39730: Enabling constructor code completion
arphaman added a comment. Also, Comment at: lib/Sema/SemaCodeComplete.cpp:980 + if (isa(R.Declaration) + && dyn_cast(CurContext) == nullptr + && dyn_cast(CurContext) == nullptr arphaman wrote: > You can use `!isa` Have you checked if this check works correctly in cases like this: ``` // main tu int x = foo:: foo bar; int x = bar. ``` I suspect the scope will be `TranslationUnitDecl` there as well. https://reviews.llvm.org/D39730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39821: Add CLANG_DEFAULT_OBJCOPY to allow Clang to use llvm-objcopy for dwarf fission
jakehehrlich added a comment. In https://reviews.llvm.org/D39821#921703, @Hahnfeld wrote: > I think the current tests will only pass iff the executable name ends with > `objcopy` - can we make this more reliable? If I read the tests (split-debug.h, split-debug.c, and split-debug.s) correctly they check for the existence of the word "objcopy" somewhere in the executables name. I'm not sure how to make it anymore flexible than that. The right thing to do would be to somehow get the string from CMake and use that in this test. I'm not sure of llvm-lit supports any kind of find and replace like that however. Repository: rL LLVM https://reviews.llvm.org/D39821 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39821: Add CLANG_DEFAULT_OBJCOPY to allow Clang to use llvm-objcopy for dwarf fission
Hahnfeld added a comment. In https://reviews.llvm.org/D39821#922026, @jakehehrlich wrote: > In https://reviews.llvm.org/D39821#921703, @Hahnfeld wrote: > > > I think the current tests will only pass iff the executable name ends with > > `objcopy` - can we make this more reliable? > > > If I read the tests (split-debug.h, split-debug.c, and split-debug.s) > correctly they check for the existence of the word "objcopy" somewhere in the > executables name. I'm not sure how to make it anymore flexible than that. The > right thing to do would be to somehow get the string from CMake and use that > in this test. I'm not sure of llvm-lit supports any kind of find and replace > like that however. Right you are, I must have missed `{{.*}}` at the end. Another option would be to restrict `CLANG_DEFAULT_OBJCOPY` to contain `objcopy` or even to only allow `objcopy` or `llvm-objcopy`. I don't know if that's sensible though... Repository: rL LLVM https://reviews.llvm.org/D39821 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39611: [CodeGen] change const-ness of complex calls
spatel updated this revision to Diff 122474. spatel added a comment. Patch updated: Except for cimag, cproj, conj, and creal, everything in is marked 'e' - the functions are not const if we might set errno. https://reviews.llvm.org/D39611 Files: include/clang/Basic/Builtins.def test/CodeGen/complex-builtins.c test/CodeGen/complex-libcalls.c test/CodeGen/libcall-declarations.c Index: test/CodeGen/libcall-declarations.c === --- test/CodeGen/libcall-declarations.c +++ test/CodeGen/libcall-declarations.c @@ -569,50 +569,50 @@ // CHECK-ERRNO: declare double @trunc(double) [[NUWRN]] // CHECK-ERRNO: declare float @truncf(float) [[NUWRN]] // CHECK-ERRNO: declare x86_fp80 @truncl(x86_fp80) [[NUWRN]] -// CHECK-ERRNO: declare double @cabs(double, double) [[NUWRN]] -// CHECK-ERRNO: declare float @cabsf(<2 x float>) [[NUWRN]] -// CHECK-ERRNO: declare { double, double } @cacos(double, double) [[NUWRN]] -// CHECK-ERRNO: declare <2 x float> @cacosf(<2 x float>) [[NUWRN]] -// CHECK-ERRNO: declare { double, double } @cacosh(double, double) [[NUWRN]] -// CHECK-ERRNO: declare <2 x float> @cacoshf(<2 x float>) [[NUWRN]] -// CHECK-ERRNO: declare double @carg(double, double) [[NUWRN]] -// CHECK-ERRNO: declare float @cargf(<2 x float>) [[NUWRN]] -// CHECK-ERRNO: declare { double, double } @casin(double, double) [[NUWRN]] -// CHECK-ERRNO: declare <2 x float> @casinf(<2 x float>) [[NUWRN]] -// CHECK-ERRNO: declare { double, double } @casinh(double, double) [[NUWRN]] -// CHECK-ERRNO: declare <2 x float> @casinhf(<2 x float>) [[NUWRN]] -// CHECK-ERRNO: declare { double, double } @catan(double, double) [[NUWRN]] -// CHECK-ERRNO: declare <2 x float> @catanf(<2 x float>) [[NUWRN]] -// CHECK-ERRNO: declare { double, double } @catanh(double, double) [[NUWRN]] -// CHECK-ERRNO: declare <2 x float> @catanhf(<2 x float>) [[NUWRN]] -// CHECK-ERRNO: declare { double, double } @ccos(double, double) [[NUWRN]] -// CHECK-ERRNO: declare <2 x float> @ccosf(<2 x float>) [[NUWRN]] -// CHECK-ERRNO: declare { double, double } @ccosh(double, double) [[NUWRN]] -// CHECK-ERRNO: declare <2 x float> @ccoshf(<2 x float>) [[NUWRN]] -// CHECK-ERRNO: declare { double, double } @cexp(double, double) [[NUWRN]] -// CHECK-ERRNO: declare <2 x float> @cexpf(<2 x float>) [[NUWRN]] +// CHECK-ERRNO: declare double @cabs(double, double) [[NONCONST]] +// CHECK-ERRNO: declare float @cabsf(<2 x float>) [[NONCONST]] +// CHECK-ERRNO: declare { double, double } @cacos(double, double) [[NONCONST]] +// CHECK-ERRNO: declare <2 x float> @cacosf(<2 x float>) [[NONCONST]] +// CHECK-ERRNO: declare { double, double } @cacosh(double, double) [[NONCONST]] +// CHECK-ERRNO: declare <2 x float> @cacoshf(<2 x float>) [[NONCONST]] +// CHECK-ERRNO: declare double @carg(double, double) [[NONCONST]] +// CHECK-ERRNO: declare float @cargf(<2 x float>) [[NONCONST]] +// CHECK-ERRNO: declare { double, double } @casin(double, double) [[NONCONST]] +// CHECK-ERRNO: declare <2 x float> @casinf(<2 x float>) [[NONCONST]] +// CHECK-ERRNO: declare { double, double } @casinh(double, double) [[NONCONST]] +// CHECK-ERRNO: declare <2 x float> @casinhf(<2 x float>) [[NONCONST]] +// CHECK-ERRNO: declare { double, double } @catan(double, double) [[NONCONST]] +// CHECK-ERRNO: declare <2 x float> @catanf(<2 x float>) [[NONCONST]] +// CHECK-ERRNO: declare { double, double } @catanh(double, double) [[NONCONST]] +// CHECK-ERRNO: declare <2 x float> @catanhf(<2 x float>) [[NONCONST]] +// CHECK-ERRNO: declare { double, double } @ccos(double, double) [[NONCONST]] +// CHECK-ERRNO: declare <2 x float> @ccosf(<2 x float>) [[NONCONST]] +// CHECK-ERRNO: declare { double, double } @ccosh(double, double) [[NONCONST]] +// CHECK-ERRNO: declare <2 x float> @ccoshf(<2 x float>) [[NONCONST]] +// CHECK-ERRNO: declare { double, double } @cexp(double, double) [[NONCONST]] +// CHECK-ERRNO: declare <2 x float> @cexpf(<2 x float>) [[NONCONST]] // CHECK-ERRNO: declare double @cimag(double, double) [[NUWRN]] // CHECK-ERRNO: declare float @cimagf(<2 x float>) [[NUWRN]] // CHECK-ERRNO: declare { double, double } @conj(double, double) [[NUWRN]] // CHECK-ERRNO: declare <2 x float> @conjf(<2 x float>) [[NUWRN]] -// CHECK-ERRNO: declare { double, double } @clog(double, double) [[NUWRN]] -// CHECK-ERRNO: declare <2 x float> @clogf(<2 x float>) [[NUWRN]] +// CHECK-ERRNO: declare { double, double } @clog(double, double) [[NONCONST]] +// CHECK-ERRNO: declare <2 x float> @clogf(<2 x float>) [[NONCONST]] // CHECK-ERRNO: declare { double, double } @cproj(double, double) [[NUWRN]] // CHECK-ERRNO: declare <2 x float> @cprojf(<2 x float>) [[NUWRN]] -// CHECK-ERRNO: declare { double, double } @cpow(double, double, double, double) [[NUWRN]] -// CHECK-ERRNO: declare <2 x float> @cpowf(<2 x float>, <2 x float>) [[NUWRN]] +// CHECK-ERRNO: declare { double, double } @cpow(double, double, double, double) [[NONCONST]] +// CHECK-ERRNO: declare <2 x float> @cpowf(<2 x float>, <2 x f
[PATCH] D39821: Add CLANG_DEFAULT_OBJCOPY to allow Clang to use llvm-objcopy for dwarf fission
jakehehrlich added a comment. > Another option would be to restrict `CLANG_DEFAULT_OBJCOPY` to contain > `objcopy` or even to only allow `objcopy` or `llvm-objcopy`. I don't know if > that's sensible though... I think there are some other strip/objcopy like implementations out there but I think objcopy and llvm-objcopy are the only ones that support --extract-dwo and --strip-dwo right now but more could come. I think objcopy and llvm-objcopy are the only ones that have "objcopy" in the name so the current test kind of enforces that one of them must be used. Also the user might want to pull objcopy or llvm-objcopy from a specific place on their system (not just from PATH) so however we restrict this, it will have to be much more general than just allowing "objcopy" or "llvm-objcopy". That said restricting the set of program names seems reasonable to me since you should in theory be able to add your program to the CMakeList.txt check on CLANG_DEFAULT_OBJCOPY if you want clang to support it. I don't think any other implementation of objcopy is likely to exist anytime soon though so it seems kind of moot to me. Repository: rL LLVM https://reviews.llvm.org/D39821 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39800: [analyzer] pr34404: Fix a crash on pointers to members in nested anonymous structures.
dcoughlin accepted this revision. dcoughlin added a comment. LGTM. I suppose we could move the logic that constructs pointers to members for fields here (right now that logic is in ExprEngine::VisitUnaryOperator()'s handling of '&'). However, since the AST's DeclRefExpr for the field is marked as an lvalue this would be slightly odd -- we would have the value of an lvalue expression be a non-Loc. https://reviews.llvm.org/D39800 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39641: [CodeGen] make cbrt and fma constant (never set errno)
spatel added a comment. Based on the comments in https://reviews.llvm.org/D39611, I think we have to change this (although I'd be happy to be wrong). 1. cbrt() can underflow and could set errno to ERANGE. 2. fma() can overflow or underflow and set errno to ERANGE. We could still make an exception for a GNU environment (as was drafted in https://reviews.llvm.org/D39611) if we're confident that that implementation guarantees that it won't ever set errno for these 2 functions? https://reviews.llvm.org/D39641 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r317909 - AMDGPU/NFC: Move getAMDGPUTargetFeatures to AMDGPU toolchain
Author: kzhuravl Date: Fri Nov 10 11:09:57 2017 New Revision: 317909 URL: http://llvm.org/viewvc/llvm-project?rev=317909&view=rev Log: AMDGPU/NFC: Move getAMDGPUTargetFeatures to AMDGPU toolchain Differential Revision: https://reviews.llvm.org/D39877 Modified: cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp cfe/trunk/lib/Driver/ToolChains/AMDGPU.h cfe/trunk/lib/Driver/ToolChains/Clang.cpp Modified: cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp?rev=317909&r1=317908&r2=317909&view=diff == --- cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp Fri Nov 10 11:09:57 2017 @@ -11,6 +11,7 @@ #include "CommonArgs.h" #include "InputInfo.h" #include "clang/Driver/Compilation.h" +#include "clang/Driver/DriverDiagnostic.h" #include "llvm/Option/ArgList.h" using namespace clang::driver; @@ -35,6 +36,24 @@ void amdgpu::Linker::ConstructJob(Compil CmdArgs, Inputs)); } +void amdgpu::getAMDGPUTargetFeatures(const Driver &D, + const llvm::opt::ArgList &Args, + std::vector &Features) { + if (const Arg *dAbi = Args.getLastArg(options::OPT_mamdgpu_debugger_abi)) { +StringRef value = dAbi->getValue(); +if (value == "1.0") { + Features.push_back("+amdgpu-debugger-insert-nops"); + Features.push_back("+amdgpu-debugger-reserve-regs"); + Features.push_back("+amdgpu-debugger-emit-prologue"); +} else { + D.Diag(diag::err_drv_clang_unsupported) << dAbi->getAsString(Args); +} + } + + handleTargetFeaturesGroup( +Args, Features, options::OPT_m_amdgpu_Features_Group); +} + /// AMDGPU Toolchain AMDGPUToolChain::AMDGPUToolChain(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) Modified: cfe/trunk/lib/Driver/ToolChains/AMDGPU.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/AMDGPU.h?rev=317909&r1=317908&r2=317909&view=diff == --- cfe/trunk/lib/Driver/ToolChains/AMDGPU.h (original) +++ cfe/trunk/lib/Driver/ToolChains/AMDGPU.h Fri Nov 10 11:09:57 2017 @@ -19,7 +19,6 @@ namespace clang { namespace driver { namespace tools { - namespace amdgpu { class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { @@ -33,6 +32,9 @@ public: const char *LinkingOutput) const override; }; +void getAMDGPUTargetFeatures(const Driver &D, const llvm::opt::ArgList &Args, + std::vector &Features); + } // end namespace amdgpu } // end namespace tools Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=317909&r1=317908&r2=317909&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Fri Nov 10 11:09:57 2017 @@ -15,6 +15,7 @@ #include "Arch/Sparc.h" #include "Arch/SystemZ.h" #include "Arch/X86.h" +#include "AMDGPU.h" #include "CommonArgs.h" #include "Hexagon.h" #include "InputInfo.h" @@ -278,23 +279,6 @@ static void getWebAssemblyTargetFeatures handleTargetFeaturesGroup(Args, Features, options::OPT_m_wasm_Features_Group); } -static void getAMDGPUTargetFeatures(const Driver &D, const ArgList &Args, -std::vector &Features) { - if (const Arg *dAbi = Args.getLastArg(options::OPT_mamdgpu_debugger_abi)) { -StringRef value = dAbi->getValue(); -if (value == "1.0") { - Features.push_back("+amdgpu-debugger-insert-nops"); - Features.push_back("+amdgpu-debugger-reserve-regs"); - Features.push_back("+amdgpu-debugger-emit-prologue"); -} else { - D.Diag(diag::err_drv_clang_unsupported) << dAbi->getAsString(Args); -} - } - - handleTargetFeaturesGroup( -Args, Features, options::OPT_m_amdgpu_Features_Group); -} - static void getTargetFeatures(const ToolChain &TC, const llvm::Triple &Triple, const ArgList &Args, ArgStringList &CmdArgs, bool ForAS) { @@ -347,7 +331,7 @@ static void getTargetFeatures(const Tool break; case llvm::Triple::r600: case llvm::Triple::amdgcn: -getAMDGPUTargetFeatures(D, Args, Features); +amdgpu::getAMDGPUTargetFeatures(D, Args, Features); break; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39877: AMDGPU/NFC: Move getAMDGPUTargetFeatures to AMDGPU toolchain
This revision was automatically updated to reflect the committed changes. Closed by commit rL317909: AMDGPU/NFC: Move getAMDGPUTargetFeatures to AMDGPU toolchain (authored by kzhuravl). Changed prior to commit: https://reviews.llvm.org/D39877?vs=122354&id=122487#toc Repository: rL LLVM https://reviews.llvm.org/D39877 Files: cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp cfe/trunk/lib/Driver/ToolChains/AMDGPU.h cfe/trunk/lib/Driver/ToolChains/Clang.cpp Index: cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp === --- cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp +++ cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp @@ -11,6 +11,7 @@ #include "CommonArgs.h" #include "InputInfo.h" #include "clang/Driver/Compilation.h" +#include "clang/Driver/DriverDiagnostic.h" #include "llvm/Option/ArgList.h" using namespace clang::driver; @@ -35,6 +36,24 @@ CmdArgs, Inputs)); } +void amdgpu::getAMDGPUTargetFeatures(const Driver &D, + const llvm::opt::ArgList &Args, + std::vector &Features) { + if (const Arg *dAbi = Args.getLastArg(options::OPT_mamdgpu_debugger_abi)) { +StringRef value = dAbi->getValue(); +if (value == "1.0") { + Features.push_back("+amdgpu-debugger-insert-nops"); + Features.push_back("+amdgpu-debugger-reserve-regs"); + Features.push_back("+amdgpu-debugger-emit-prologue"); +} else { + D.Diag(diag::err_drv_clang_unsupported) << dAbi->getAsString(Args); +} + } + + handleTargetFeaturesGroup( +Args, Features, options::OPT_m_amdgpu_Features_Group); +} + /// AMDGPU Toolchain AMDGPUToolChain::AMDGPUToolChain(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) Index: cfe/trunk/lib/Driver/ToolChains/AMDGPU.h === --- cfe/trunk/lib/Driver/ToolChains/AMDGPU.h +++ cfe/trunk/lib/Driver/ToolChains/AMDGPU.h @@ -19,7 +19,6 @@ namespace clang { namespace driver { namespace tools { - namespace amdgpu { class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { @@ -33,6 +32,9 @@ const char *LinkingOutput) const override; }; +void getAMDGPUTargetFeatures(const Driver &D, const llvm::opt::ArgList &Args, + std::vector &Features); + } // end namespace amdgpu } // end namespace tools Index: cfe/trunk/lib/Driver/ToolChains/Clang.cpp === --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp @@ -15,6 +15,7 @@ #include "Arch/Sparc.h" #include "Arch/SystemZ.h" #include "Arch/X86.h" +#include "AMDGPU.h" #include "CommonArgs.h" #include "Hexagon.h" #include "InputInfo.h" @@ -278,23 +279,6 @@ handleTargetFeaturesGroup(Args, Features, options::OPT_m_wasm_Features_Group); } -static void getAMDGPUTargetFeatures(const Driver &D, const ArgList &Args, -std::vector &Features) { - if (const Arg *dAbi = Args.getLastArg(options::OPT_mamdgpu_debugger_abi)) { -StringRef value = dAbi->getValue(); -if (value == "1.0") { - Features.push_back("+amdgpu-debugger-insert-nops"); - Features.push_back("+amdgpu-debugger-reserve-regs"); - Features.push_back("+amdgpu-debugger-emit-prologue"); -} else { - D.Diag(diag::err_drv_clang_unsupported) << dAbi->getAsString(Args); -} - } - - handleTargetFeaturesGroup( -Args, Features, options::OPT_m_amdgpu_Features_Group); -} - static void getTargetFeatures(const ToolChain &TC, const llvm::Triple &Triple, const ArgList &Args, ArgStringList &CmdArgs, bool ForAS) { @@ -347,7 +331,7 @@ break; case llvm::Triple::r600: case llvm::Triple::amdgcn: -getAMDGPUTargetFeatures(D, Args, Features); +amdgpu::getAMDGPUTargetFeatures(D, Args, Features); break; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39803: [analyzer] pr34766: Fix a crash on explicit construction of std::initializer_list.
dcoughlin accepted this revision. dcoughlin added a comment. This revision is now accepted and ready to land. LGTM. https://reviews.llvm.org/D39803 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38801: [analyzer] In getSVal() API, disable auto-detection of void type as char type.
dcoughlin accepted this revision. dcoughlin added a comment. This revision is now accepted and ready to land. LGTM. Thanks! In https://reviews.llvm.org/D38801#910524, @NoQ wrote: > Also the overload between `getSVal(Ex, LC)` and `getSVal(R, Ty)`, when they > do completely different things, seems confusing. Yes! I think we should change this (possibly rename them both?). I think it is a big barrier to entry -- I certainly found it super confusing when first getting started on the analyzer code base. https://reviews.llvm.org/D38801 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39878: AMDGPU: Add -mxnack/-mno-xnack options that set +/-xnack feature
This revision was automatically updated to reflect the committed changes. Closed by commit rL317917: AMDGPU: Add -mxnack/-mno-xnack options that set +/-xnack feature (authored by kzhuravl). Changed prior to commit: https://reviews.llvm.org/D39878?vs=122355&id=122489#toc Repository: rL LLVM https://reviews.llvm.org/D39878 Files: cfe/trunk/include/clang/Driver/Options.td cfe/trunk/test/Driver/amdgpu-features.c Index: cfe/trunk/include/clang/Driver/Options.td === --- cfe/trunk/include/clang/Driver/Options.td +++ cfe/trunk/include/clang/Driver/Options.td @@ -1822,7 +1822,6 @@ def mgeneral_regs_only : Flag<["-"], "mgeneral-regs-only">, Group, HelpText<"Generate code which only uses the general purpose registers (AArch64 only)">; - def mfix_cortex_a53_835769 : Flag<["-"], "mfix-cortex-a53-835769">, Group, HelpText<"Workaround Cortex-A53 erratum 835769 (AArch64 only)">; @@ -1840,6 +1839,10 @@ Group, HelpText<"Generate additional code for specified of debugger ABI (AMDGPU only)">, MetaVarName<"">; +def mxnack : Flag<["-"], "mxnack">, Group, + HelpText<"Enable XNACK (AMDGPU only)">; +def mno_xnack : Flag<["-"], "mno-xnack">, Group, + HelpText<"Disable XNACK (AMDGPU only)">; def faltivec : Flag<["-"], "faltivec">, Group, Flags<[DriverOption]>; def fno_altivec : Flag<["-"], "fno-altivec">, Group, Flags<[DriverOption]>; Index: cfe/trunk/test/Driver/amdgpu-features.c === --- cfe/trunk/test/Driver/amdgpu-features.c +++ cfe/trunk/test/Driver/amdgpu-features.c @@ -5,3 +5,9 @@ // RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri -mamdgpu-debugger-abi=1.0 %s -o - 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-1-0 %s // CHECK-MAMDGPU-DEBUGGER-ABI-1-0: "-target-feature" "+amdgpu-debugger-insert-nops" "-target-feature" "+amdgpu-debugger-reserve-regs" "-target-feature" "+amdgpu-debugger-emit-prologue" + +// RUN: %clang -### -target amdgcn -mcpu=gfx700 -mxnack %s 2>&1 | FileCheck --check-prefix=XNACK %s +// XNACK: "-target-feature" "+xnack" + +// RUN: %clang -### -target amdgcn -mcpu=gfx700 -mno-xnack %s 2>&1 | FileCheck --check-prefix=NO-XNACK %s +// NO-XNACK: "-target-feature" "-xnack" Index: cfe/trunk/include/clang/Driver/Options.td === --- cfe/trunk/include/clang/Driver/Options.td +++ cfe/trunk/include/clang/Driver/Options.td @@ -1822,7 +1822,6 @@ def mgeneral_regs_only : Flag<["-"], "mgeneral-regs-only">, Group, HelpText<"Generate code which only uses the general purpose registers (AArch64 only)">; - def mfix_cortex_a53_835769 : Flag<["-"], "mfix-cortex-a53-835769">, Group, HelpText<"Workaround Cortex-A53 erratum 835769 (AArch64 only)">; @@ -1840,6 +1839,10 @@ Group, HelpText<"Generate additional code for specified of debugger ABI (AMDGPU only)">, MetaVarName<"">; +def mxnack : Flag<["-"], "mxnack">, Group, + HelpText<"Enable XNACK (AMDGPU only)">; +def mno_xnack : Flag<["-"], "mno-xnack">, Group, + HelpText<"Disable XNACK (AMDGPU only)">; def faltivec : Flag<["-"], "faltivec">, Group, Flags<[DriverOption]>; def fno_altivec : Flag<["-"], "fno-altivec">, Group, Flags<[DriverOption]>; Index: cfe/trunk/test/Driver/amdgpu-features.c === --- cfe/trunk/test/Driver/amdgpu-features.c +++ cfe/trunk/test/Driver/amdgpu-features.c @@ -5,3 +5,9 @@ // RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri -mamdgpu-debugger-abi=1.0 %s -o - 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-1-0 %s // CHECK-MAMDGPU-DEBUGGER-ABI-1-0: "-target-feature" "+amdgpu-debugger-insert-nops" "-target-feature" "+amdgpu-debugger-reserve-regs" "-target-feature" "+amdgpu-debugger-emit-prologue" + +// RUN: %clang -### -target amdgcn -mcpu=gfx700 -mxnack %s 2>&1 | FileCheck --check-prefix=XNACK %s +// XNACK: "-target-feature" "+xnack" + +// RUN: %clang -### -target amdgcn -mcpu=gfx700 -mno-xnack %s 2>&1 | FileCheck --check-prefix=NO-XNACK %s +// NO-XNACK: "-target-feature" "-xnack" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r317917 - AMDGPU: Add -mxnack/-mno-xnack options that set +/-xnack feature
Author: kzhuravl Date: Fri Nov 10 11:28:25 2017 New Revision: 317917 URL: http://llvm.org/viewvc/llvm-project?rev=317917&view=rev Log: AMDGPU: Add -mxnack/-mno-xnack options that set +/-xnack feature Differential Revision: https://reviews.llvm.org/D39878 Modified: cfe/trunk/include/clang/Driver/Options.td cfe/trunk/test/Driver/amdgpu-features.c Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=317917&r1=317916&r2=317917&view=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Fri Nov 10 11:28:25 2017 @@ -1822,7 +1822,6 @@ def mno_neg_immediates: Flag<["-"], "mno def mgeneral_regs_only : Flag<["-"], "mgeneral-regs-only">, Group, HelpText<"Generate code which only uses the general purpose registers (AArch64 only)">; - def mfix_cortex_a53_835769 : Flag<["-"], "mfix-cortex-a53-835769">, Group, HelpText<"Workaround Cortex-A53 erratum 835769 (AArch64 only)">; @@ -1840,6 +1839,10 @@ def mamdgpu_debugger_abi : Joined<["-"], Group, HelpText<"Generate additional code for specified of debugger ABI (AMDGPU only)">, MetaVarName<"">; +def mxnack : Flag<["-"], "mxnack">, Group, + HelpText<"Enable XNACK (AMDGPU only)">; +def mno_xnack : Flag<["-"], "mno-xnack">, Group, + HelpText<"Disable XNACK (AMDGPU only)">; def faltivec : Flag<["-"], "faltivec">, Group, Flags<[DriverOption]>; def fno_altivec : Flag<["-"], "fno-altivec">, Group, Flags<[DriverOption]>; Modified: cfe/trunk/test/Driver/amdgpu-features.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/amdgpu-features.c?rev=317917&r1=317916&r2=317917&view=diff == --- cfe/trunk/test/Driver/amdgpu-features.c (original) +++ cfe/trunk/test/Driver/amdgpu-features.c Fri Nov 10 11:28:25 2017 @@ -5,3 +5,9 @@ // RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri -mamdgpu-debugger-abi=1.0 %s -o - 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-1-0 %s // CHECK-MAMDGPU-DEBUGGER-ABI-1-0: "-target-feature" "+amdgpu-debugger-insert-nops" "-target-feature" "+amdgpu-debugger-reserve-regs" "-target-feature" "+amdgpu-debugger-emit-prologue" + +// RUN: %clang -### -target amdgcn -mcpu=gfx700 -mxnack %s 2>&1 | FileCheck --check-prefix=XNACK %s +// XNACK: "-target-feature" "+xnack" + +// RUN: %clang -### -target amdgcn -mcpu=gfx700 -mno-xnack %s 2>&1 | FileCheck --check-prefix=NO-XNACK %s +// NO-XNACK: "-target-feature" "-xnack" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39913: [ObjC] warn about availability attributes missing from a method's declaration when they're specified for a method's definition
arphaman created this revision. Herald added a subscriber: javed.absar. This patch extends the -Wavailability warning to warn about cases where a method declaration is missing an availability attribute clause that's present in the method's definition. We also warn about missing `deprecated` attributes as well. rdar://15540962 Repository: rL LLVM https://reviews.llvm.org/D39913 Files: include/clang/Basic/DiagnosticSemaKinds.td include/clang/Sema/Sema.h lib/Sema/SemaDecl.cpp lib/Sema/SemaDeclAttr.cpp test/SemaObjC/method-attributes.m test/SemaObjC/unguarded-availability.m test/SemaObjC/warn-missing-method-decl-availability.m Index: test/SemaObjC/warn-missing-method-decl-availability.m === --- /dev/null +++ test/SemaObjC/warn-missing-method-decl-availability.m @@ -0,0 +1,139 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin9.0.0 -fsyntax-only -verify -Wno-objc-root-class %s + +// Warn about availability attribute when they're specified in the definition +// of the method instead of the declaration. +// rdar://15540962 + +@interface MissingAvailabilityThingsInInterface + +- (void)missingIDO; // expected-warning {{method declaration is missing an availability attribute for macOS that is specified in the definition}} + +- (void)missingDO __attribute__((availability(macos, introduced=10.1))); // expected-warning {{method declaration is missing an availability attribute for macOS that is specified in the definition}} + +- (void)missingD __attribute__((availability(macos, introduced=10.1))); // expected-warning {{method declaration is missing an availability attribute for macOS that is specified in the definition}} + +- (void)missingIx2; // expected-warning {{method declaration is missing an availability attribute for macOS that is specified in the definition}} +// expected-warning@-1 {{method declaration is missing an availability attribute for iOS that is specified in the definition}} + +- (void)missingIDOiOS __attribute__((availability(macos, introduced=10.1))); // expected-warning {{method declaration is missing an availability attribute for iOS that is specified in the definition}} + +- (void)differentIMissingD __attribute__((availability(macos, introduced=10.1))); // expected-warning {{method declaration is missing an availability attribute for macOS that is specified in the definition}} +// expected-note@-1 {{previous attribute is here}} + +- (void)missingUnavailable; // expected-warning {{method declaration is missing an availability attribute for macOS that is specified in the definition}} + +- (void)same +__attribute__((availability(macos, introduced=10.1))) +__attribute__((availability(ios, unavailable))); + +- (void)missingDeprecatedAttr; // expected-warning {{method declaration is missing a deprecated attribute that is specified in the definition}} + +- (void)sameDeprecatedAttr __attribute__((deprecated("y"))); + +@end + +@interface MissingAvailabilityThingsInInterface() + +- (void)missingInClassExtension; // expected-warning {{method declaration is missing an availability attribute for macOS that is specified in the definition}} + +@end + +@implementation MissingAvailabilityThingsInInterface + +- (void)missingIDO +__attribute__((availability(macos, introduced=10.1, deprecated=10.2, obsoleted=10.3))) // expected-note {{definition with macOS availability attribute is here}} +{ } + +- (void)missingDO +__attribute__((availability(macos, introduced=10.1))) +__attribute__((availability(macos, deprecated=10.2, obsoleted=10.3))) // expected-note {{definition with macOS availability attribute is here}} +{ } + +- (void)missingD +__attribute__((availability(macos, introduced=10.1, deprecated=10.2))) // expected-note {{definition with macOS availability attribute is here}} +{ } + +- (void)missingIx2 +__attribute__((availability(ios, introduced=10))) // expected-note {{definition with iOS availability attribute is here}} +__attribute__((availability(macos, introduced=10.1))) // expected-note {{definition with macOS availability attribute is here}} +{ } + +- (void)missingIDOiOS +__attribute__((availability(ios, introduced=10, deprecated=11, obsoleted=11.1))) // expected-note {{definition with iOS availability attribute is here}} +__attribute__((availability(macOS, introduced=10.1))) +{ } + +- (void)differentIMissingD __attribute__((availability(macos, introduced=10.2, deprecated=10.3))) // expected-note {{definition with macOS availability attribute is here}} +{ } // expected-warning@-1{{availability does not match previous declaration}} + +- (void)missingInClassExtension +__attribute__((availability(macos, introduced=10.1, deprecated=10.2))) // expected-note {{definition with macOS availability attribute is here}} +{ } + +- (void)missingUnavailable +__attribute__((availability(macos, unavailable))); // expected-note {{definition with macOS availability attribute is here}} +{ } + +- (void)same +__attribute__((availability(mac
[PATCH] D39641: [CodeGen] make cbrt and fma constant (never set errno)
efriedma added a comment. cbrt() can't underflow; that's not how cube roots work. If 0 x. See also the definition of rootn() in IEEE 754 (which specifies no exceptions for n=3). For fma(), sure, I guess we could whitelist glibc and msvcrt, if you're worried there's some unknown implementation which sets ERANGE. https://reviews.llvm.org/D39641 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39915: [clang] Remove redundant return [NFC]
mgrang created this revision. mgrang added a project: clang. Herald added a subscriber: jholewinski. https://reviews.llvm.org/D39915 Files: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp lib/Driver/Driver.cpp lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp Index: lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp === --- lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp +++ lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp @@ -107,8 +107,6 @@ } reportUseAfterDealloc(ReceiverSymbol, Desc, M.getOriginExpr(), C); - - return; } void ObjCSuperDeallocChecker::checkPreCall(const CallEvent &Call, Index: lib/Driver/Driver.cpp === --- lib/Driver/Driver.cpp +++ lib/Driver/Driver.cpp @@ -598,8 +598,6 @@ // // TODO: Add support for other offloading programming models here. // - - return; } Compilation *Driver::BuildCompilation(ArrayRef ArgList) { Index: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp === --- lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp +++ lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp @@ -409,7 +409,6 @@ CodeGen.setAction(Action); emitTargetOutlinedFunctionHelper(D, ParentName, OutlinedFn, OutlinedFnID, IsOffloadEntry, CodeGen); - return; } void CGOpenMPRuntimeNVPTX::emitSpmdEntryHeader( Index: lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp === --- lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp +++ lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp @@ -107,8 +107,6 @@ } reportUseAfterDealloc(ReceiverSymbol, Desc, M.getOriginExpr(), C); - - return; } void ObjCSuperDeallocChecker::checkPreCall(const CallEvent &Call, Index: lib/Driver/Driver.cpp === --- lib/Driver/Driver.cpp +++ lib/Driver/Driver.cpp @@ -598,8 +598,6 @@ // // TODO: Add support for other offloading programming models here. // - - return; } Compilation *Driver::BuildCompilation(ArrayRef ArgList) { Index: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp === --- lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp +++ lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp @@ -409,7 +409,6 @@ CodeGen.setAction(Action); emitTargetOutlinedFunctionHelper(D, ParentName, OutlinedFn, OutlinedFnID, IsOffloadEntry, CodeGen); - return; } void CGOpenMPRuntimeNVPTX::emitSpmdEntryHeader( ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39918: [libunwind] Remove a FIXME about truncated section names
mstorsjo created this revision. Herald added a subscriber: aprantl. If the linker chose to store the full section name instead of truncating it, this field doesn't contain a truncated name, but an offset into the string table of the binary. The string table isn't loaded/mapped into memory during runtime though, so it's not possible to read the full section name, unless we try to locate the DLL/EXE on disk that the HMODULE corresponds to and load that manually. This also has the practical consequence that with the current LLD, we must not enable debug info (i.e. must link with -s with the mingw frontend). If debug info is enabled, the full ".eh_frame" name is written into the string table and the the section name itself is just an offset, e.g. "/4". Alternatives to fixing this consequence are: - Making LLD always output a truncated ".eh_fram" (maybe only when -lldmingw is specified?), even if debug info is enabled. (GNU ld doesn't do this, so this approach in libunwind won't work with binaries built with that.) - Switch to statically registering the .eh_frame sections on startup, instead of dynamically enumerating them when needed. This is what libgcc does. This doesn't match what libunwind does on other platforms though. This only works as long as libunwind is linked dynamically so that all involved DLLs register their sections to the same instance of libunwind. (I haven't succeeded in building a shared libcxx/libcxxabi/libunwind yet for mingw though.) https://reviews.llvm.org/D39918 Files: src/AddressSpace.hpp Index: src/AddressSpace.hpp === --- src/AddressSpace.hpp +++ src/AddressSpace.hpp @@ -382,8 +382,6 @@ found_obj = true; } else if (!strncmp((const char *)pish->Name, ".eh_frame", IMAGE_SIZEOF_SHORT_NAME)) { -// FIXME: This section name actually is truncated, ideally we -// should locate and check the full long name instead. info.dwarf_section = begin; info.dwarf_section_length = pish->Misc.VirtualSize; found_hdr = true; Index: src/AddressSpace.hpp === --- src/AddressSpace.hpp +++ src/AddressSpace.hpp @@ -382,8 +382,6 @@ found_obj = true; } else if (!strncmp((const char *)pish->Name, ".eh_frame", IMAGE_SIZEOF_SHORT_NAME)) { -// FIXME: This section name actually is truncated, ideally we -// should locate and check the full long name instead. info.dwarf_section = begin; info.dwarf_section_length = pish->Misc.VirtualSize; found_hdr = true; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r317925 - [debuginfo-tests] Make debuginfo-tests work in a standard configuration.
Author: zturner Date: Fri Nov 10 12:57:57 2017 New Revision: 317925 URL: http://llvm.org/viewvc/llvm-project?rev=317925&view=rev Log: [debuginfo-tests] Make debuginfo-tests work in a standard configuration. Previously, debuginfo-tests was expected to be checked out into clang/test and then the tests would automatically run as part of check-clang. This is not a standard workflow for handling external projects, and it brings with it some serious drawbacks such as the inability to depend on things other than clang, which we will need going forward. The goal of this patch is to migrate towards a more standard workflow. To ease the transition for build bot maintainers, this patch tries not to break the existing workflow, but instead simply deprecate it to give maintainers a chance to update the build infrastructure. Differential Revision: https://reviews.llvm.org/D39605 Modified: cfe/trunk/test/lit.cfg.py Modified: cfe/trunk/test/lit.cfg.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg.py?rev=317925&r1=317924&r2=317925&view=diff == --- cfe/trunk/test/lit.cfg.py (original) +++ cfe/trunk/test/lit.cfg.py Fri Nov 10 12:57:57 2017 @@ -58,8 +58,6 @@ tool_dirs = [config.clang_tools_dir, con tools = [ 'c-index-test', 'clang-check', 'clang-diff', 'clang-format', 'opt', -ToolSubst('%test_debuginfo', command=os.path.join( -config.llvm_src_root, 'utils', 'test_debuginfo.pl')), ToolSubst('%clang_func_map', command=FindTool( 'clang-func-mapping'), unresolved='ignore'), ] ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39438: [analyzer] Diagnose stack leaks via block captures
alexshap updated this revision to Diff 122507. alexshap added a comment. Address the comments Repository: rL LLVM https://reviews.llvm.org/D39438 Files: lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp test/Analysis/stack-capture-leak-arc.mm test/Analysis/stack-capture-leak-no-arc.mm Index: test/Analysis/stack-capture-leak-no-arc.mm === --- test/Analysis/stack-capture-leak-no-arc.mm +++ test/Analysis/stack-capture-leak-no-arc.mm @@ -0,0 +1,37 @@ +// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 -analyzer-checker=core -fblocks -verify %s + +typedef struct dispatch_queue_s *dispatch_queue_t; +typedef void (^dispatch_block_t)(void); +void dispatch_async(dispatch_queue_t queue, dispatch_block_t block); +extern dispatch_queue_t queue; + +void test_block_inside_block_async_no_leak() { + int x = 123; + int *p = &x; + void (^inner)(void) = ^void(void) { +int y = x; +++y; + }; + // Block_copy(...) copies the captured block ("inner") too, + // there is no leak in this case. + dispatch_async(queue, ^void(void) { +int z = x; +++z; +inner(); + }); // no-warning +} + +dispatch_block_t test_block_inside_block_async_leak() { + int x = 123; + void (^inner)(void) = ^void(void) { +int y = x; +++y; + }; + void (^outer)(void) = ^void(void) { +int z = x; +++z; +inner(); + }; + return outer; // expected-warning-re{{Address of stack-allocated block declared on line {{.+}} is captured by a returned block}} +} + Index: test/Analysis/stack-capture-leak-arc.mm === --- test/Analysis/stack-capture-leak-arc.mm +++ test/Analysis/stack-capture-leak-arc.mm @@ -0,0 +1,175 @@ +// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 -analyzer-checker=core -fblocks -fobjc-arc -verify %s + +typedef struct dispatch_queue_s *dispatch_queue_t; +typedef void (^dispatch_block_t)(void); +void dispatch_async(dispatch_queue_t queue, dispatch_block_t block); +typedef long dispatch_once_t; +void dispatch_once(dispatch_once_t *predicate, dispatch_block_t block); +typedef long dispatch_time_t; +void dispatch_after(dispatch_time_t when, dispatch_queue_t queue, dispatch_block_t block); + +extern dispatch_queue_t queue; +extern dispatch_once_t *predicate; +extern dispatch_time_t when; + +void test_block_expr_async() { + int x = 123; + int *p = &x; + + dispatch_async(queue, ^{ +*p = 321; + }); + // expected-warning@-3 {{Address of stack memory associated with local variable 'x' \ +is captured by an asynchronously-executed block}} +} + +void test_block_expr_once_no_leak() { + int x = 123; + int *p = &x; + // synchronous, no warning + dispatch_once(predicate, ^{ +*p = 321; + }); +} + +void test_block_expr_after() { + int x = 123; + int *p = &x; + dispatch_after(when, queue, ^{ +*p = 321; + }); + // expected-warning@-3 {{Address of stack memory associated with local variable 'x' \ +is captured by an asynchronously-executed block}} +} + +void test_block_expr_async_no_leak() { + int x = 123; + int *p = &x; + // no leak + dispatch_async(queue, ^{ +int y = x; +++y; + }); +} + +void test_block_var_async() { + int x = 123; + int *p = &x; + void (^b)(void) = ^void(void) { +*p = 1; + }; + dispatch_async(queue, b); + // expected-warning@-1 {{Address of stack memory associated with local variable 'x' \ +is captured by an asynchronously-executed block}} +} + +void test_block_with_ref_async() { + int x = 123; + int &r = x; + void (^b)(void) = ^void(void) { +r = 1; + }; + dispatch_async(queue, b); + // expected-warning@-1 {{Address of stack memory associated with local variable 'x' \ +is captured by an asynchronously-executed block}} +} + +dispatch_block_t get_leaking_block() { + int leaked_x = 791; + int *p = &leaked_x; + return ^void(void) { +*p = 1; + }; + // expected-warning@-3 {{Address of stack memory associated with local variable 'leaked_x' \ +is captured by a returned block}} +} + +void test_returned_from_func_block_async() { + dispatch_async(queue, get_leaking_block()); + // expected-warning@-1 {{Address of stack memory associated with local variable 'leaked_x' \ +is captured by an asynchronously-executed block}} +} + +// synchronous, no leak +void test_block_var_once() { + int x = 123; + int *p = &x; + void (^b)(void) = ^void(void) { +*p = 1; + }; + dispatch_once(predicate, b); // no-warning +} + +void test_block_var_after() { + int x = 123; + int *p = &x; + void (^b)(void) = ^void(void) { +*p = 1; + }; + dispatch_after(when, queue, b); + // expected-warning@-1 {{Address of stack memory associated with local variable 'x' \ +is captured by an asynchronously-executed block}} +} + +void test_block_var_async_no_leak() { + int x = 123; + int *p = &x; + void (^b)(void) = ^void(void) { +int y = x; +++y; + }; + dispatch_async(queue, b); // no-warning +}
[PATCH] D39913: [ObjC] warn about availability attributes missing from a method's declaration when they're specified for a method's definition
erik.pilkington added a comment. Any thoughts on having this for regular functions and C++ member functions? Seems just as useful there. Comment at: include/clang/Sema/Sema.h:2406 + /// This will warn on any missing clauses in the declaration. + void checkMissingAvailabilityClausesInDeclaration(NamedDecl *Original, NamedDecl *Implementation); + Looks longer than 80 chars! Comment at: lib/Sema/SemaDeclAttr.cpp:2300 + }; + + llvm::SmallPtrSet MissingPlatformAttributes; I hate to rewrite your function, but have you considered just doing the second loop over the attrs inline instead of hidden in the lambda? I think it would make the function more simple to avoid all the lambdas and callbacks: ``` for (auto *A : Implementation->specific_attrs()) { for (auto *B : Original->specific_attrs()) { if (A->getPlatform() != B->getPlatform()) continue; if (A->getIntroduced() != B->getIntroduced() || ...) { Diag(); } } } ``` You can do the deprecated check outside of the loop like: ``` if (Impl->hasAttr() && !Original->hasAttr()) ``` Repository: rL LLVM https://reviews.llvm.org/D39913 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39923: [ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang
tejohnson created this revision. Herald added subscribers: eraman, inglorion, mehdi_amini. The LTO Config field wasn't being set when invoking a ThinLTO backend via clang (i.e. for distributed builds). https://reviews.llvm.org/D39923 Files: lib/CodeGen/BackendUtil.cpp test/CodeGen/thinlto-debug-pm.c Index: test/CodeGen/thinlto-debug-pm.c === --- /dev/null +++ test/CodeGen/thinlto-debug-pm.c @@ -0,0 +1,9 @@ +// Test to ensure -fdebug-pass-manager works when invoking the +// ThinLTO backend path with the new PM. +// RUN: %clang -O2 %s -flto=thin -c -o %t.o +// RUN: llvm-lto -thinlto -o %t %t.o +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager -fexperimental-new-pass-manager 2>&1 | FileCheck %s +// CHECK: Running pass: + +void foo() { +} Index: lib/CodeGen/BackendUtil.cpp === --- lib/CodeGen/BackendUtil.cpp +++ lib/CodeGen/BackendUtil.cpp @@ -1073,6 +1073,7 @@ initTargetOptions(Conf.Options, CGOpts, TOpts, LOpts, HeaderOpts); Conf.SampleProfile = std::move(SampleProfile); Conf.UseNewPM = CGOpts.ExperimentalNewPassManager; + Conf.DebugPassManager = CGOpts.DebugPassManager; switch (Action) { case Backend_EmitNothing: Conf.PreCodeGenModuleHook = [](size_t Task, const Module &Mod) { Index: test/CodeGen/thinlto-debug-pm.c === --- /dev/null +++ test/CodeGen/thinlto-debug-pm.c @@ -0,0 +1,9 @@ +// Test to ensure -fdebug-pass-manager works when invoking the +// ThinLTO backend path with the new PM. +// RUN: %clang -O2 %s -flto=thin -c -o %t.o +// RUN: llvm-lto -thinlto -o %t %t.o +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager -fexperimental-new-pass-manager 2>&1 | FileCheck %s +// CHECK: Running pass: + +void foo() { +} Index: lib/CodeGen/BackendUtil.cpp === --- lib/CodeGen/BackendUtil.cpp +++ lib/CodeGen/BackendUtil.cpp @@ -1073,6 +1073,7 @@ initTargetOptions(Conf.Options, CGOpts, TOpts, LOpts, HeaderOpts); Conf.SampleProfile = std::move(SampleProfile); Conf.UseNewPM = CGOpts.ExperimentalNewPassManager; + Conf.DebugPassManager = CGOpts.DebugPassManager; switch (Action) { case Backend_EmitNothing: Conf.PreCodeGenModuleHook = [](size_t Task, const Module &Mod) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r317931 - Fix for skipped CMake configuration on debuginfo-tests.
Author: zturner Date: Fri Nov 10 14:12:04 2017 New Revision: 317931 URL: http://llvm.org/viewvc/llvm-project?rev=317931&view=rev Log: Fix for skipped CMake configuration on debuginfo-tests. This should have been part of the change to debuginfo-tests, but it was left out. This should get the buildbots green. Modified: cfe/trunk/test/CMakeLists.txt Modified: cfe/trunk/test/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CMakeLists.txt?rev=317931&r1=317930&r2=317931&view=diff == --- cfe/trunk/test/CMakeLists.txt (original) +++ cfe/trunk/test/CMakeLists.txt Fri Nov 10 14:12:04 2017 @@ -88,6 +88,13 @@ set(CLANG_TEST_PARAMS clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg ) +if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests/CMakeLists.txt") + # This is a hack to keep existing build build infrastructure working while we + # can migrate to the new standard workflow of checking out debuginfo-tests into + # llvm/projects or using it in a mono-repo + add_subdirectory(debuginfo-tests) +endif() + if( NOT CLANG_BUILT_STANDALONE ) list(APPEND CLANG_TEST_DEPS llvm-config ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39923: [ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang
danielcdh accepted this revision. danielcdh added a comment. This revision is now accepted and ready to land. Thanks for the fix. https://reviews.llvm.org/D39923 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libclc] r317932 - native_log2: Switch to generic native intrinsic inc file
Author: jvesely Date: Fri Nov 10 14:16:15 2017 New Revision: 317932 URL: http://llvm.org/viewvc/llvm-project?rev=317932&view=rev Log: native_log2: Switch to generic native intrinsic inc file v2: Add __CLC_XCONCAT instead of function name redirection Use __CLC_XCONCAT for intrinsic functions as well Reviewer: Jeroen Ketema Signed-off-by: Jan Vesely Added: libclc/trunk/generic/include/utils.h libclc/trunk/generic/lib/math/native_unary_intrinsic.inc - copied, changed from r317260, libclc/trunk/generic/lib/math/native_log2.inc Removed: libclc/trunk/generic/lib/math/native_log2.inc Modified: libclc/trunk/generic/lib/math/native_log2.cl Added: libclc/trunk/generic/include/utils.h URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/utils.h?rev=317932&view=auto == --- libclc/trunk/generic/include/utils.h (added) +++ libclc/trunk/generic/include/utils.h Fri Nov 10 14:16:15 2017 @@ -0,0 +1,10 @@ +#ifndef __CLC_UTILS_H_ +#define __CLC_UTILS_H_ + +#define __CLC_CONCAT(x, y) x ## y +#define __CLC_XCONCAT(x, y) __CLC_CONCAT(x, y) + +#define __CLC_STR(x) #x +#define __CLC_XSTR(x) __CLC_STR(x) + +#endif Modified: libclc/trunk/generic/lib/math/native_log2.cl URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_log2.cl?rev=317932&r1=317931&r2=317932&view=diff == --- libclc/trunk/generic/lib/math/native_log2.cl (original) +++ libclc/trunk/generic/lib/math/native_log2.cl Fri Nov 10 14:16:15 2017 @@ -22,11 +22,7 @@ #include -#define __CLC_FUNCTION __clc_native_log2 -#define __CLC_INTRINSIC "llvm.log2" -#undef cl_khr_fp64 -#include - -#define __CLC_BODY +#define __CLC_NATIVE_INTRINSIC log2 +#define __CLC_BODY #define __FLOAT_ONLY #include Removed: libclc/trunk/generic/lib/math/native_log2.inc URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_log2.inc?rev=317931&view=auto == --- libclc/trunk/generic/lib/math/native_log2.inc (original) +++ libclc/trunk/generic/lib/math/native_log2.inc (removed) @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_log2(__CLC_GENTYPE val) { - return __clc_native_log2(val); -} Copied: libclc/trunk/generic/lib/math/native_unary_intrinsic.inc (from r317260, libclc/trunk/generic/lib/math/native_log2.inc) URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_unary_intrinsic.inc?p2=libclc/trunk/generic/lib/math/native_unary_intrinsic.inc&p1=libclc/trunk/generic/lib/math/native_log2.inc&r1=317260&r2=317932&rev=317932&view=diff == --- libclc/trunk/generic/lib/math/native_log2.inc (original) +++ libclc/trunk/generic/lib/math/native_unary_intrinsic.inc Fri Nov 10 14:16:15 2017 @@ -20,6 +20,21 @@ * THE SOFTWARE. */ -_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_log2(__CLC_GENTYPE val) { - return __clc_native_log2(val); +#include + +#ifdef __CLC_SCALAR +#define __CLC_FUNCTION __CLC_XCONCAT(__clc_native_, __CLC_NATIVE_INTRINSIC) +#define __CLC_INTRINSIC "llvm." __CLC_XSTR(__CLC_NATIVE_INTRINSIC) + +#undef cl_khr_fp64 +#include + +#endif + +#define __CLC_FUNCTION __CLC_XCONCAT(native_, __CLC_NATIVE_INTRINSIC) + +_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE val) { + return __CLC_XCONCAT(__clc_native_, __CLC_NATIVE_INTRINSIC)(val); } + +#undef __CLC_FUNCTION ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libclc] r317933 - native_log: Switch to generic native intrinsic inc file
Author: jvesely Date: Fri Nov 10 14:16:20 2017 New Revision: 317933 URL: http://llvm.org/viewvc/llvm-project?rev=317933&view=rev Log: native_log: Switch to generic native intrinsic inc file Reviewer: Jeroen Ketema Signed-off-by: Jan Vesely Removed: libclc/trunk/generic/lib/math/native_log.inc Modified: libclc/trunk/generic/lib/math/native_log.cl Modified: libclc/trunk/generic/lib/math/native_log.cl URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_log.cl?rev=317933&r1=317932&r2=317933&view=diff == --- libclc/trunk/generic/lib/math/native_log.cl (original) +++ libclc/trunk/generic/lib/math/native_log.cl Fri Nov 10 14:16:20 2017 @@ -22,11 +22,8 @@ #include -#define __CLC_FUNCTION __clc_native_log -#define __CLC_INTRINSIC "llvm.log" -#undef cl_khr_fp64 -#include +#define __CLC_NATIVE_INTRINSIC log -#define __CLC_BODY +#define __CLC_BODY #define __FLOAT_ONLY #include Removed: libclc/trunk/generic/lib/math/native_log.inc URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_log.inc?rev=317932&view=auto == --- libclc/trunk/generic/lib/math/native_log.inc (original) +++ libclc/trunk/generic/lib/math/native_log.inc (removed) @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_log(__CLC_GENTYPE val) { - return __clc_native_log(val); -} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libclc] r317934 - native_log10: Switch to generic native intrinsic inc file
Author: jvesely Date: Fri Nov 10 14:16:22 2017 New Revision: 317934 URL: http://llvm.org/viewvc/llvm-project?rev=317934&view=rev Log: native_log10: Switch to generic native intrinsic inc file Reviewer: Jeroen Ketema Signed-off-by: Jan Vesely Removed: libclc/trunk/generic/lib/math/native_log10.inc Modified: libclc/trunk/generic/lib/math/native_log10.cl Modified: libclc/trunk/generic/lib/math/native_log10.cl URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_log10.cl?rev=317934&r1=317933&r2=317934&view=diff == --- libclc/trunk/generic/lib/math/native_log10.cl (original) +++ libclc/trunk/generic/lib/math/native_log10.cl Fri Nov 10 14:16:22 2017 @@ -1,10 +1,7 @@ #include -#define __CLC_FUNCTION __clc_native_log10 -#define __CLC_INTRINSIC "llvm.log10" -#undef cl_khr_fp64 -#include +#define __CLC_NATIVE_INTRINSIC log10 -#define __CLC_BODY +#define __CLC_BODY #define __FLOAT_ONLY #include Removed: libclc/trunk/generic/lib/math/native_log10.inc URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_log10.inc?rev=317933&view=auto == --- libclc/trunk/generic/lib/math/native_log10.inc (original) +++ libclc/trunk/generic/lib/math/native_log10.inc (removed) @@ -1,3 +0,0 @@ -_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_log10(__CLC_GENTYPE val) { - return __clc_native_log10(val); -} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libclc] r317935 - amdgpu: Add workaround for unimplemented llvm.exp intrinsic
Author: jvesely Date: Fri Nov 10 14:16:25 2017 New Revision: 317935 URL: http://llvm.org/viewvc/llvm-project?rev=317935&view=rev Log: amdgpu: Add workaround for unimplemented llvm.exp intrinsic Reviewer: Jeroen Ketema Signed-off-by: Jan Vesely Added: libclc/trunk/amdgpu/lib/math/native_exp.cl libclc/trunk/amdgpu/lib/math/native_exp.inc Modified: libclc/trunk/amdgpu/lib/SOURCES Modified: libclc/trunk/amdgpu/lib/SOURCES URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgpu/lib/SOURCES?rev=317935&r1=317934&r2=317935&view=diff == --- libclc/trunk/amdgpu/lib/SOURCES (original) +++ libclc/trunk/amdgpu/lib/SOURCES Fri Nov 10 14:16:25 2017 @@ -1,3 +1,4 @@ +math/native_exp.cl math/native_log.cl math/native_log10.cl math/nextafter.cl Added: libclc/trunk/amdgpu/lib/math/native_exp.cl URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgpu/lib/math/native_exp.cl?rev=317935&view=auto == --- libclc/trunk/amdgpu/lib/math/native_exp.cl (added) +++ libclc/trunk/amdgpu/lib/math/native_exp.cl Fri Nov 10 14:16:25 2017 @@ -0,0 +1,5 @@ +#include + +#define __CLC_BODY +#define __FLOAT_ONLY +#include Added: libclc/trunk/amdgpu/lib/math/native_exp.inc URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgpu/lib/math/native_exp.inc?rev=317935&view=auto == --- libclc/trunk/amdgpu/lib/math/native_exp.inc (added) +++ libclc/trunk/amdgpu/lib/math/native_exp.inc Fri Nov 10 14:16:25 2017 @@ -0,0 +1,3 @@ +_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_exp(__CLC_GENTYPE val) { + return native_exp2(val * M_LOG2E_F); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38425: [clangd] Document highlights for clangd
Nebiroth updated this revision to Diff 122528. Nebiroth added a comment. - Decls and MacroInfos vectors are now private and passed by reference instead of copied. https://reviews.llvm.org/D38425 Files: clangd/ClangdLSPServer.cpp clangd/ClangdLSPServer.h clangd/ClangdServer.cpp clangd/ClangdServer.h clangd/ClangdUnit.cpp clangd/ClangdUnit.h clangd/Protocol.cpp clangd/Protocol.h clangd/ProtocolHandlers.cpp clangd/ProtocolHandlers.h test/clangd/documenthighlight.test test/clangd/initialize-params-invalid.test test/clangd/initialize-params.test Index: test/clangd/initialize-params.test === --- test/clangd/initialize-params.test +++ test/clangd/initialize-params.test @@ -20,6 +20,7 @@ # CHECK-NEXT: }, # CHECK-NEXT: "definitionProvider": true, # CHECK-NEXT: "documentFormattingProvider": true, +# CHECK-NEXT: "documentHighlightProvider": true, # CHECK-NEXT: "documentOnTypeFormattingProvider": { # CHECK-NEXT:"firstTriggerCharacter": "}", # CHECK-NEXT:"moreTriggerCharacter": [] Index: test/clangd/initialize-params-invalid.test === --- test/clangd/initialize-params-invalid.test +++ test/clangd/initialize-params-invalid.test @@ -20,6 +20,7 @@ # CHECK-NEXT: }, # CHECK-NEXT: "definitionProvider": true, # CHECK-NEXT: "documentFormattingProvider": true, +# CHECK-NEXT: "documentHighlightProvider": true, # CHECK-NEXT: "documentOnTypeFormattingProvider": { # CHECK-NEXT:"firstTriggerCharacter": "}", # CHECK-NEXT:"moreTriggerCharacter": [] @@ -40,6 +41,7 @@ # CHECK-NEXT: "textDocumentSync": 1 # CHECK-NEXT:} # CHECK-NEXT: } + Content-Length: 44 {"jsonrpc":"2.0","id":3,"method":"shutdown"} Index: test/clangd/documenthighlight.test === --- /dev/null +++ test/clangd/documenthighlight.test @@ -0,0 +1,37 @@ +# RUN: clangd -run-synchronously < %s | FileCheck %s +# It is absolutely vital that this file has CRLF line endings. +# +Content-Length: 125 + +{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}} + +Content-Length: 455 + +{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///main.cpp","languageId":"cpp","version":1,"text":"#define MACRO 1\nnamespace ns1 {\nstruct MyClass {\nint xasd;\nvoid anotherOperation() {\n}\nstatic int foo(MyClass*) {\nreturn 0;\n}\n\n};\nstruct Foo {\nint xasd;\n};\n}\nint main() {\nint bonjour;\nbonjour = 2;\nns1::Foo bar = { xasd : 1};\nbar.xasd = 3;\nns1::MyClass* Params;\nParams->anotherOperation();}\n"}}} + +Content-Length: 156 + +{"jsonrpc":"2.0","id":1,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":17,"character":2}}} +# Go to local variable +# CHECK: {"id":1,"jsonrpc":"2.0","result":[{"kind":1,"range":{"end":{"character":12,"line":16},"start":{"character":4,"line":16}}},{"kind":0,"range":{"end":{"character":7,"line":17},"start":{"character":0,"line":17}}}]} + + +Content-Length: 157 + +{"jsonrpc":"2.0","id":1,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":18,"character":17}}} +# Go to local variable +# CHECK: {"id":1,"jsonrpc":"2.0","result":[{"kind":1,"range":{"end":{"character":9,"line":12},"start":{"character":4,"line":12}}},{"kind":1,"range":{"end":{"character":21,"line":18},"start":{"character":17,"line":18}}},{"kind":216,"range":{"end":{"character":21,"line":18},"start":{"character":17,"line":18}}},{"kind":220,"range":{"end":{"character":8,"line":19},"start":{"character":4,"line":19}}}]} + +Content-Length: 157 + +{"jsonrpc":"2.0","id":1,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":21,"character":10}}} +# Go to local variable +# CHECK: {"id":1,"jsonrpc":"2.0","result":[{"kind":1,"range":{"end":{"character":22,"line":4},"start":{"character":5,"line":4}}},{"kind":0,"range":{"end":{"character":25,"line":21},"start":{"character":8,"line":21}}}]} + +Content-Length: 48 + +{"jsonrpc":"2.0","id":1,"method":"shutdown"} + +Content-Length: 33 + +{"jsonrpc":"2.0":"method":"exit"} \ No newline at end of file Index: clangd/ProtocolHandlers.h === --- clangd/ProtocolHandlers.h +++ clangd/ProtocolHandlers.h @@ -31,7 +31,6 @@ public: using Ctx = RequestContext; virtual ~ProtocolCallbacks() = default; - virtual void onInitialize(Ctx C, InitializeParams &Params) = 0; virtual void onShutdown(Ctx C, ShutdownParams &Params) = 0; virtual void onExit(Ctx C, ExitParams &Params) = 0; @@ -54,6 +53,8 @@ virtual void onFileEvent(Ctx C, DidChangeWatchedFilesParams &Params) = 0; virtual void onCommand
[libclc] r317937 - native_exp2: Switch implementation to llvm intrinsic
Author: jvesely Date: Fri Nov 10 14:16:31 2017 New Revision: 317937 URL: http://llvm.org/viewvc/llvm-project?rev=317937&view=rev Log: native_exp2: Switch implementation to llvm intrinsic Reviewer: Jeroen Ketema Signed-off-by: Jan Vesely Added: libclc/trunk/generic/lib/math/native_exp2.cl Modified: libclc/trunk/generic/include/clc/math/native_exp2.h libclc/trunk/generic/lib/SOURCES Modified: libclc/trunk/generic/include/clc/math/native_exp2.h URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_exp2.h?rev=317937&r1=317936&r2=317937&view=diff == --- libclc/trunk/generic/include/clc/math/native_exp2.h (original) +++ libclc/trunk/generic/include/clc/math/native_exp2.h Fri Nov 10 14:16:31 2017 @@ -1 +1,9 @@ -#define native_exp2 exp2 +#define __CLC_BODY +#define __CLC_FUNCTION native_exp2 +#define __FLOAT_ONLY + +#include + +#undef __FLOAT_ONLY +#undef __CLC_BODY +#undef __CLC_FUNCTION Modified: libclc/trunk/generic/lib/SOURCES URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=317937&r1=317936&r2=317937&view=diff == --- libclc/trunk/generic/lib/SOURCES (original) +++ libclc/trunk/generic/lib/SOURCES Fri Nov 10 14:16:31 2017 @@ -120,6 +120,7 @@ math/logb.cl math/mad.cl math/modf.cl math/native_exp.cl +math/native_exp2.cl math/native_log.cl math/native_log10.cl math/native_log2.cl Added: libclc/trunk/generic/lib/math/native_exp2.cl URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_exp2.cl?rev=317937&view=auto == --- libclc/trunk/generic/lib/math/native_exp2.cl (added) +++ libclc/trunk/generic/lib/math/native_exp2.cl Fri Nov 10 14:16:31 2017 @@ -0,0 +1,7 @@ +#include + +#define __CLC_NATIVE_INTRINSIC exp2 + +#define __CLC_BODY +#define __FLOAT_ONLY +#include ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libclc] r317938 - native_cos: Switch implementation to llvm intrinsic
Author: jvesely Date: Fri Nov 10 14:16:33 2017 New Revision: 317938 URL: http://llvm.org/viewvc/llvm-project?rev=317938&view=rev Log: native_cos: Switch implementation to llvm intrinsic Reviewer: Jeroen Ketema Signed-off-by: Jan Vesely Added: libclc/trunk/generic/lib/math/native_cos.cl Modified: libclc/trunk/generic/include/clc/math/native_cos.h libclc/trunk/generic/lib/SOURCES Modified: libclc/trunk/generic/include/clc/math/native_cos.h URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_cos.h?rev=317938&r1=317937&r2=317938&view=diff == --- libclc/trunk/generic/include/clc/math/native_cos.h (original) +++ libclc/trunk/generic/include/clc/math/native_cos.h Fri Nov 10 14:16:33 2017 @@ -1 +1,9 @@ -#define native_cos cos +#define __CLC_BODY +#define __CLC_FUNCTION native_cos +#define __FLOAT_ONLY + +#include + +#undef __FLOAT_ONLY +#undef __CLC_BODY +#undef __CLC_FUNCTION Modified: libclc/trunk/generic/lib/SOURCES URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=317938&r1=317937&r2=317938&view=diff == --- libclc/trunk/generic/lib/SOURCES (original) +++ libclc/trunk/generic/lib/SOURCES Fri Nov 10 14:16:33 2017 @@ -119,6 +119,7 @@ math/log2.cl math/logb.cl math/mad.cl math/modf.cl +math/native_cos.cl math/native_exp.cl math/native_exp2.cl math/native_log.cl Added: libclc/trunk/generic/lib/math/native_cos.cl URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_cos.cl?rev=317938&view=auto == --- libclc/trunk/generic/lib/math/native_cos.cl (added) +++ libclc/trunk/generic/lib/math/native_cos.cl Fri Nov 10 14:16:33 2017 @@ -0,0 +1,7 @@ +#include + +#define __CLC_NATIVE_INTRINSIC cos + +#define __CLC_BODY +#define __FLOAT_ONLY +#include ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libclc] r317939 - native_sin: Switch implementation to llvm intrinsic
Author: jvesely Date: Fri Nov 10 14:16:36 2017 New Revision: 317939 URL: http://llvm.org/viewvc/llvm-project?rev=317939&view=rev Log: native_sin: Switch implementation to llvm intrinsic Reviewer: Jeroen Ketema Signed-off-by: Jan Vesely Added: libclc/trunk/generic/lib/math/native_sin.cl Modified: libclc/trunk/generic/include/clc/math/native_sin.h libclc/trunk/generic/lib/SOURCES Modified: libclc/trunk/generic/include/clc/math/native_sin.h URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_sin.h?rev=317939&r1=317938&r2=317939&view=diff == --- libclc/trunk/generic/include/clc/math/native_sin.h (original) +++ libclc/trunk/generic/include/clc/math/native_sin.h Fri Nov 10 14:16:36 2017 @@ -1 +1,9 @@ -#define native_sin sin +#define __CLC_BODY +#define __CLC_FUNCTION native_sin +#define __FLOAT_ONLY + +#include + +#undef __FLOAT_ONLY +#undef __CLC_BODY +#undef __CLC_FUNCTION Modified: libclc/trunk/generic/lib/SOURCES URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=317939&r1=317938&r2=317939&view=diff == --- libclc/trunk/generic/lib/SOURCES (original) +++ libclc/trunk/generic/lib/SOURCES Fri Nov 10 14:16:36 2017 @@ -125,6 +125,7 @@ math/native_exp2.cl math/native_log.cl math/native_log10.cl math/native_log2.cl +math/native_sin.cl math/tables.cl math/clc_nextafter.cl math/nextafter.cl Added: libclc/trunk/generic/lib/math/native_sin.cl URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_sin.cl?rev=317939&view=auto == --- libclc/trunk/generic/lib/math/native_sin.cl (added) +++ libclc/trunk/generic/lib/math/native_sin.cl Fri Nov 10 14:16:36 2017 @@ -0,0 +1,7 @@ +#include + +#define __CLC_NATIVE_INTRINSIC sin + +#define __CLC_BODY +#define __FLOAT_ONLY +#include ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libclc] r317936 - native_exp: Switch implementation to llvm intrinsic
Author: jvesely Date: Fri Nov 10 14:16:28 2017 New Revision: 317936 URL: http://llvm.org/viewvc/llvm-project?rev=317936&view=rev Log: native_exp: Switch implementation to llvm intrinsic Reviewer: Jeroen Ketema Signed-off-by: Jan Vesely Added: libclc/trunk/generic/lib/math/native_exp.cl Modified: libclc/trunk/generic/include/clc/math/native_exp.h libclc/trunk/generic/lib/SOURCES Modified: libclc/trunk/generic/include/clc/math/native_exp.h URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_exp.h?rev=317936&r1=317935&r2=317936&view=diff == --- libclc/trunk/generic/include/clc/math/native_exp.h (original) +++ libclc/trunk/generic/include/clc/math/native_exp.h Fri Nov 10 14:16:28 2017 @@ -1 +1,9 @@ -#define native_exp exp +#define __CLC_BODY +#define __CLC_FUNCTION native_exp +#define __FLOAT_ONLY + +#include + +#undef __FLOAT_ONLY +#undef __CLC_BODY +#undef __CLC_FUNCTION Modified: libclc/trunk/generic/lib/SOURCES URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=317936&r1=317935&r2=317936&view=diff == --- libclc/trunk/generic/lib/SOURCES (original) +++ libclc/trunk/generic/lib/SOURCES Fri Nov 10 14:16:28 2017 @@ -119,6 +119,7 @@ math/log2.cl math/logb.cl math/mad.cl math/modf.cl +math/native_exp.cl math/native_log.cl math/native_log10.cl math/native_log2.cl Added: libclc/trunk/generic/lib/math/native_exp.cl URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_exp.cl?rev=317936&view=auto == --- libclc/trunk/generic/lib/math/native_exp.cl (added) +++ libclc/trunk/generic/lib/math/native_exp.cl Fri Nov 10 14:16:28 2017 @@ -0,0 +1,7 @@ +#include + +#define __CLC_NATIVE_INTRINSIC exp + +#define __CLC_BODY +#define __FLOAT_ONLY +#include ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libclc] r317940 - native_sqrt: Switch implementation to llvm intrinsic
Author: jvesely Date: Fri Nov 10 14:16:39 2017 New Revision: 317940 URL: http://llvm.org/viewvc/llvm-project?rev=317940&view=rev Log: native_sqrt: Switch implementation to llvm intrinsic Reviewer: Jeroen Ketema Signed-off-by: Jan Vesely Added: libclc/trunk/generic/lib/math/native_sqrt.cl Modified: libclc/trunk/generic/include/clc/math/native_sqrt.h libclc/trunk/generic/lib/SOURCES Modified: libclc/trunk/generic/include/clc/math/native_sqrt.h URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_sqrt.h?rev=317940&r1=317939&r2=317940&view=diff == --- libclc/trunk/generic/include/clc/math/native_sqrt.h (original) +++ libclc/trunk/generic/include/clc/math/native_sqrt.h Fri Nov 10 14:16:39 2017 @@ -1 +1,9 @@ -#define native_sqrt sqrt +#define __CLC_BODY +#define __CLC_FUNCTION native_sqrt +#define __FLOAT_ONLY + +#include + +#undef __FLOAT_ONLY +#undef __CLC_BODY +#undef __CLC_FUNCTION Modified: libclc/trunk/generic/lib/SOURCES URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=317940&r1=317939&r2=317940&view=diff == --- libclc/trunk/generic/lib/SOURCES (original) +++ libclc/trunk/generic/lib/SOURCES Fri Nov 10 14:16:39 2017 @@ -126,6 +126,7 @@ math/native_log.cl math/native_log10.cl math/native_log2.cl math/native_sin.cl +math/native_sqrt.cl math/tables.cl math/clc_nextafter.cl math/nextafter.cl Added: libclc/trunk/generic/lib/math/native_sqrt.cl URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_sqrt.cl?rev=317940&view=auto == --- libclc/trunk/generic/lib/math/native_sqrt.cl (added) +++ libclc/trunk/generic/lib/math/native_sqrt.cl Fri Nov 10 14:16:39 2017 @@ -0,0 +1,7 @@ +#include + +#define __CLC_NATIVE_INTRINSIC sqrt + +#define __CLC_BODY +#define __FLOAT_ONLY +#include ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libclc] r317941 - native_exp10: Switch implementation to llvm intrinsic
Author: jvesely Date: Fri Nov 10 14:16:41 2017 New Revision: 317941 URL: http://llvm.org/viewvc/llvm-project?rev=317941&view=rev Log: native_exp10: Switch implementation to llvm intrinsic v2: Use native_log2 instead of wrong constant Reviewer: Jeroen Ketema Signed-off-by: Jan Vesely Added: libclc/trunk/generic/lib/math/native_exp10.cl libclc/trunk/generic/lib/math/native_exp10.inc Modified: libclc/trunk/generic/include/clc/math/native_exp10.h libclc/trunk/generic/lib/SOURCES Modified: libclc/trunk/generic/include/clc/math/native_exp10.h URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_exp10.h?rev=317941&r1=317940&r2=317941&view=diff == --- libclc/trunk/generic/include/clc/math/native_exp10.h (original) +++ libclc/trunk/generic/include/clc/math/native_exp10.h Fri Nov 10 14:16:41 2017 @@ -1 +1,9 @@ -#define native_exp10 exp10 +#define __CLC_BODY +#define __CLC_FUNCTION native_exp10 +#define __FLOAT_ONLY + +#include + +#undef __FLOAT_ONLY +#undef __CLC_BODY +#undef __CLC_FUNCTION Modified: libclc/trunk/generic/lib/SOURCES URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=317941&r1=317940&r2=317941&view=diff == --- libclc/trunk/generic/lib/SOURCES (original) +++ libclc/trunk/generic/lib/SOURCES Fri Nov 10 14:16:41 2017 @@ -121,6 +121,7 @@ math/mad.cl math/modf.cl math/native_cos.cl math/native_exp.cl +math/native_exp10.cl math/native_exp2.cl math/native_log.cl math/native_log10.cl Added: libclc/trunk/generic/lib/math/native_exp10.cl URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_exp10.cl?rev=317941&view=auto == --- libclc/trunk/generic/lib/math/native_exp10.cl (added) +++ libclc/trunk/generic/lib/math/native_exp10.cl Fri Nov 10 14:16:41 2017 @@ -0,0 +1,5 @@ +#include + +#define __CLC_BODY +#define __FLOAT_ONLY +#include Added: libclc/trunk/generic/lib/math/native_exp10.inc URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_exp10.inc?rev=317941&view=auto == --- libclc/trunk/generic/lib/math/native_exp10.inc (added) +++ libclc/trunk/generic/lib/math/native_exp10.inc Fri Nov 10 14:16:41 2017 @@ -0,0 +1,3 @@ +_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_exp10(__CLC_GENTYPE val) { + return native_exp2(val * native_log2(10)); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38425: [clangd] Document highlights for clangd
Nebiroth updated this revision to Diff 122529. Nebiroth added a comment. Decls and MacroInfos vectors are now private and passed by reference instead of copied. DeclarationLocationsFinder does not store Locations anymore, instead the vector is filled in their respective methods in ClangdUnit.cpp Refactored if condition Removed redundant newlines at end of test file. https://reviews.llvm.org/D38425 Files: clangd/ClangdLSPServer.cpp clangd/ClangdLSPServer.h clangd/ClangdServer.cpp clangd/ClangdServer.h clangd/ClangdUnit.cpp clangd/ClangdUnit.h clangd/Protocol.cpp clangd/Protocol.h clangd/ProtocolHandlers.cpp clangd/ProtocolHandlers.h test/clangd/documenthighlight.test test/clangd/initialize-params-invalid.test test/clangd/initialize-params.test Index: test/clangd/initialize-params.test === --- test/clangd/initialize-params.test +++ test/clangd/initialize-params.test @@ -20,6 +20,7 @@ # CHECK-NEXT: }, # CHECK-NEXT: "definitionProvider": true, # CHECK-NEXT: "documentFormattingProvider": true, +# CHECK-NEXT: "documentHighlightProvider": true, # CHECK-NEXT: "documentOnTypeFormattingProvider": { # CHECK-NEXT:"firstTriggerCharacter": "}", # CHECK-NEXT:"moreTriggerCharacter": [] Index: test/clangd/initialize-params-invalid.test === --- test/clangd/initialize-params-invalid.test +++ test/clangd/initialize-params-invalid.test @@ -20,6 +20,7 @@ # CHECK-NEXT: }, # CHECK-NEXT: "definitionProvider": true, # CHECK-NEXT: "documentFormattingProvider": true, +# CHECK-NEXT: "documentHighlightProvider": true, # CHECK-NEXT: "documentOnTypeFormattingProvider": { # CHECK-NEXT:"firstTriggerCharacter": "}", # CHECK-NEXT:"moreTriggerCharacter": [] @@ -40,6 +41,7 @@ # CHECK-NEXT: "textDocumentSync": 1 # CHECK-NEXT:} # CHECK-NEXT: } + Content-Length: 44 {"jsonrpc":"2.0","id":3,"method":"shutdown"} Index: test/clangd/documenthighlight.test === --- /dev/null +++ test/clangd/documenthighlight.test @@ -0,0 +1,37 @@ +# RUN: clangd -run-synchronously < %s | FileCheck %s +# It is absolutely vital that this file has CRLF line endings. +# +Content-Length: 125 + +{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}} + +Content-Length: 455 + +{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///main.cpp","languageId":"cpp","version":1,"text":"#define MACRO 1\nnamespace ns1 {\nstruct MyClass {\nint xasd;\nvoid anotherOperation() {\n}\nstatic int foo(MyClass*) {\nreturn 0;\n}\n\n};\nstruct Foo {\nint xasd;\n};\n}\nint main() {\nint bonjour;\nbonjour = 2;\nns1::Foo bar = { xasd : 1};\nbar.xasd = 3;\nns1::MyClass* Params;\nParams->anotherOperation();}\n"}}} + +Content-Length: 156 + +{"jsonrpc":"2.0","id":1,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":17,"character":2}}} +# Go to local variable +# CHECK: {"id":1,"jsonrpc":"2.0","result":[{"kind":1,"range":{"end":{"character":12,"line":16},"start":{"character":4,"line":16}}},{"kind":0,"range":{"end":{"character":7,"line":17},"start":{"character":0,"line":17}}}]} + + +Content-Length: 157 + +{"jsonrpc":"2.0","id":1,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":18,"character":17}}} +# Go to local variable +# CHECK: {"id":1,"jsonrpc":"2.0","result":[{"kind":1,"range":{"end":{"character":9,"line":12},"start":{"character":4,"line":12}}},{"kind":1,"range":{"end":{"character":21,"line":18},"start":{"character":17,"line":18}}},{"kind":216,"range":{"end":{"character":21,"line":18},"start":{"character":17,"line":18}}},{"kind":220,"range":{"end":{"character":8,"line":19},"start":{"character":4,"line":19}}}]} + +Content-Length: 157 + +{"jsonrpc":"2.0","id":1,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":21,"character":10}}} +# Go to local variable +# CHECK: {"id":1,"jsonrpc":"2.0","result":[{"kind":1,"range":{"end":{"character":22,"line":4},"start":{"character":5,"line":4}}},{"kind":0,"range":{"end":{"character":25,"line":21},"start":{"character":8,"line":21}}}]} + +Content-Length: 48 + +{"jsonrpc":"2.0","id":1,"method":"shutdown"} + +Content-Length: 33 + +{"jsonrpc":"2.0":"method":"exit"} \ No newline at end of file Index: clangd/ProtocolHandlers.h === --- clangd/ProtocolHandlers.h +++ clangd/ProtocolHandlers.h @@ -31,7 +31,6 @@ public: using Ctx = RequestContext; virtual ~ProtocolCallbacks() = default; - virtual void onInitialize(Ctx C, InitializeParams &Params) = 0; virtual void onShutdown(Ctx
LLVM buildmaster will be unavailable for a short time today
Hello everyone, We will be installing some network hardware in the Lab today. Most likely everything will go well, but there is a chance of network outage around 4:00 PM PST. Thanks for your patience and understanding. Thanks Galina ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r317944 - Remove declaration of EmitMCountInstrumentation(). NFC
Author: hans Date: Fri Nov 10 14:34:23 2017 New Revision: 317944 URL: http://llvm.org/viewvc/llvm-project?rev=317944&view=rev Log: Remove declaration of EmitMCountInstrumentation(). NFC The definition was removed in r280355. Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=317944&r1=317943&r2=317944&view=diff == --- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original) +++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Fri Nov 10 14:34:23 2017 @@ -1785,9 +1785,6 @@ public: /// function instrumentation is enabled. void EmitFunctionInstrumentation(const char *Fn); - /// EmitMCountInstrumentation - Emit call to .mcount. - void EmitMCountInstrumentation(); - /// Encode an address into a form suitable for use in a function prologue. llvm::Constant *EncodeAddrForUseInPrologue(llvm::Function *F, llvm::Constant *Addr); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38425: [clangd] Document highlights for clangd
ioeric added a comment. Drive-by comment: in general, have you considered reusing the existing declarations and occurrences finding functionalities in clang-rename? AFAIK, it deals with templates and macros pretty well. o https://github.com/llvm-mirror/clang/blob/master/include/clang/Tooling/Refactoring/Rename/USRFinder.h o https://github.com/llvm-mirror/clang/blob/master/include/clang/Tooling/Refactoring/Rename/USRLocFinder.h https://reviews.llvm.org/D38425 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38425: [clangd] Document highlights for clangd
Nebiroth added a comment. This updated patch still does not handle highlighting macro references correctly. I will make another patch at a later time for this issue. In https://reviews.llvm.org/D38425#922408, @ioeric wrote: > Drive-by comment: in general, have you considered reusing the existing > declarations and occurrences finding functionalities in clang-rename? AFAIK, > it deals with templates and macros pretty well. > > o > https://github.com/llvm-mirror/clang/blob/master/include/clang/Tooling/Refactoring/Rename/USRFinder.h > > o > https://github.com/llvm-mirror/clang/blob/master/include/clang/Tooling/Refactoring/Rename/USRLocFinder.h I'll take a look at it later. Thanks! https://reviews.llvm.org/D38425 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39923: [ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang
This revision was automatically updated to reflect the committed changes. Closed by commit rL317951: [ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang (authored by tejohnson). Repository: rL LLVM https://reviews.llvm.org/D39923 Files: cfe/trunk/lib/CodeGen/BackendUtil.cpp cfe/trunk/test/CodeGen/thinlto-debug-pm.c Index: cfe/trunk/lib/CodeGen/BackendUtil.cpp === --- cfe/trunk/lib/CodeGen/BackendUtil.cpp +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp @@ -1073,6 +1073,7 @@ initTargetOptions(Conf.Options, CGOpts, TOpts, LOpts, HeaderOpts); Conf.SampleProfile = std::move(SampleProfile); Conf.UseNewPM = CGOpts.ExperimentalNewPassManager; + Conf.DebugPassManager = CGOpts.DebugPassManager; switch (Action) { case Backend_EmitNothing: Conf.PreCodeGenModuleHook = [](size_t Task, const Module &Mod) { Index: cfe/trunk/test/CodeGen/thinlto-debug-pm.c === --- cfe/trunk/test/CodeGen/thinlto-debug-pm.c +++ cfe/trunk/test/CodeGen/thinlto-debug-pm.c @@ -0,0 +1,9 @@ +// Test to ensure -fdebug-pass-manager works when invoking the +// ThinLTO backend path with the new PM. +// RUN: %clang -O2 %s -flto=thin -c -o %t.o +// RUN: llvm-lto -thinlto -o %t %t.o +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager -fexperimental-new-pass-manager 2>&1 | FileCheck %s +// CHECK: Running pass: + +void foo() { +} Index: cfe/trunk/lib/CodeGen/BackendUtil.cpp === --- cfe/trunk/lib/CodeGen/BackendUtil.cpp +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp @@ -1073,6 +1073,7 @@ initTargetOptions(Conf.Options, CGOpts, TOpts, LOpts, HeaderOpts); Conf.SampleProfile = std::move(SampleProfile); Conf.UseNewPM = CGOpts.ExperimentalNewPassManager; + Conf.DebugPassManager = CGOpts.DebugPassManager; switch (Action) { case Backend_EmitNothing: Conf.PreCodeGenModuleHook = [](size_t Task, const Module &Mod) { Index: cfe/trunk/test/CodeGen/thinlto-debug-pm.c === --- cfe/trunk/test/CodeGen/thinlto-debug-pm.c +++ cfe/trunk/test/CodeGen/thinlto-debug-pm.c @@ -0,0 +1,9 @@ +// Test to ensure -fdebug-pass-manager works when invoking the +// ThinLTO backend path with the new PM. +// RUN: %clang -O2 %s -flto=thin -c -o %t.o +// RUN: llvm-lto -thinlto -o %t %t.o +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager -fexperimental-new-pass-manager 2>&1 | FileCheck %s +// CHECK: Running pass: + +void foo() { +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r317951 - [ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang
Author: tejohnson Date: Fri Nov 10 15:37:39 2017 New Revision: 317951 URL: http://llvm.org/viewvc/llvm-project?rev=317951&view=rev Log: [ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang Summary: The LTO Config field wasn't being set when invoking a ThinLTO backend via clang (i.e. for distributed builds). Reviewers: danielcdh Subscribers: mehdi_amini, inglorion, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D39923 Added: cfe/trunk/test/CodeGen/thinlto-debug-pm.c Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=317951&r1=317950&r2=317951&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri Nov 10 15:37:39 2017 @@ -1073,6 +1073,7 @@ static void runThinLTOBackend(ModuleSumm initTargetOptions(Conf.Options, CGOpts, TOpts, LOpts, HeaderOpts); Conf.SampleProfile = std::move(SampleProfile); Conf.UseNewPM = CGOpts.ExperimentalNewPassManager; + Conf.DebugPassManager = CGOpts.DebugPassManager; switch (Action) { case Backend_EmitNothing: Conf.PreCodeGenModuleHook = [](size_t Task, const Module &Mod) { Added: cfe/trunk/test/CodeGen/thinlto-debug-pm.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/thinlto-debug-pm.c?rev=317951&view=auto == --- cfe/trunk/test/CodeGen/thinlto-debug-pm.c (added) +++ cfe/trunk/test/CodeGen/thinlto-debug-pm.c Fri Nov 10 15:37:39 2017 @@ -0,0 +1,9 @@ +// Test to ensure -fdebug-pass-manager works when invoking the +// ThinLTO backend path with the new PM. +// RUN: %clang -O2 %s -flto=thin -c -o %t.o +// RUN: llvm-lto -thinlto -o %t %t.o +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager -fexperimental-new-pass-manager 2>&1 | FileCheck %s +// CHECK: Running pass: + +void foo() { +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39641: [CodeGen] make cbrt and fma constant (never set errno)
spatel updated this revision to Diff 122545. spatel added a comment. Patch updated: cbrt() is always const. fma() is always const with GNU or Win+MSVC. https://reviews.llvm.org/D39641 Files: include/clang/Basic/Builtins.def lib/CodeGen/CGBuiltin.cpp lib/Sema/SemaDecl.cpp test/CodeGen/libcalls.c test/CodeGen/math-builtins.c test/CodeGen/math-libcalls.c Index: test/CodeGen/math-libcalls.c === --- test/CodeGen/math-libcalls.c +++ test/CodeGen/math-libcalls.c @@ -1,5 +1,7 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm %s | FileCheck %s -check-prefix=NO__ERRNO -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm %s | FileCheck %s --check-prefix=NO__ERRNO +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO +// RUN: %clang_cc1 -triple x86_64-unknown-unknown-gnu -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU +// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN // Test attributes and builtin codegen of math library calls. @@ -145,9 +147,9 @@ // NO__ERRNO: declare double @cbrt(double) [[READNONE]] // NO__ERRNO: declare float @cbrtf(float) [[READNONE]] // NO__ERRNO: declare x86_fp80 @cbrtl(x86_fp80) [[READNONE]] -// HAS_ERRNO: declare double @cbrt(double) [[NOT_READNONE]] -// HAS_ERRNO: declare float @cbrtf(float) [[NOT_READNONE]] -// HAS_ERRNO: declare x86_fp80 @cbrtl(x86_fp80) [[NOT_READNONE]] +// HAS_ERRNO: declare double @cbrt(double) [[READNONE]] +// HAS_ERRNO: declare float @cbrtf(float) [[READNONE]] +// HAS_ERRNO: declare x86_fp80 @cbrtl(x86_fp80) [[READNONE]] ceil(f); ceilf(f); ceill(f); @@ -244,9 +246,20 @@ // NO__ERRNO: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC]] // NO__ERRNO: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]] // NO__ERRNO: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]] -// HAS_ERRNO: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]] -// HAS_ERRNO: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]] -// HAS_ERRNO: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare double @fma(double, double, double) [[NOT_READNONE]] +// HAS_ERRNO: declare float @fmaf(float, float, float) [[NOT_READNONE]] +// HAS_ERRNO: declare x86_fp80 @fmal(x86_fp80, x86_fp80, x86_fp80) [[NOT_READNONE]] + +// On GNU or Win, fma never sets errno, so we can convert to the intrinsic. + +// HAS_ERRNO_GNU: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]] +// HAS_ERRNO_GNU: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]] +// HAS_ERRNO_GNU: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]] + +// HAS_ERRNO_WIN: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]] +// HAS_ERRNO_WIN: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]] +// Long double is just double on win, so no f80 use/declaration. +// HAS_ERRNO_WIN-NOT: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) fmax(f,f); fmaxf(f,f); fmaxl(f,f); @@ -528,5 +541,6 @@ // HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} } // HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} } // HAS_ERRNO: attributes [[READONLY]] = { {{.*}}readonly{{.*}} } -// HAS_ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} } +// HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} } +// HAS_ERRNO_WIN: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} } Index: test/CodeGen/math-builtins.c === --- test/CodeGen/math-builtins.c +++ test/CodeGen/math-builtins.c @@ -1,5 +1,7 @@ // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm %s | FileCheck %s -check-prefix=NO__ERRNO // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO +// RUN: %clang_cc1 -triple x86_64-unknown-unknown-gnu -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU +// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN // Test attributes and codegen of math builtins. @@ -175,9 +177,9 @@ // NO__ERRNO: declare double @cbrt(double) [[READNONE]] // NO__ERRNO: declare float @cbrtf(float) [[READNONE]] // NO__ERR
[PATCH] D39446: [PGO] Detect more structural changes with the stable hash
arphaman added a comment. Generally it LG Comment at: lib/CodeGen/CodeGenPGO.cpp:244 + DEFINE_NESTABLE_TRAVERSAL(CXXTryStmt) + DEFINE_NESTABLE_TRAVERSAL(CXXCatchStmt) + What about `ObjCAtTryStmt`? Comment at: lib/CodeGen/CodeGenPGO.cpp:321 +return PGOHash::ReturnStmt; + case Stmt::CXXThrowExprClass: +return PGOHash::ThrowExpr; Might as well include the `ObjCAtThrowStmt` as well. https://reviews.llvm.org/D39446 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39446: [PGO] Detect more structural changes with the stable hash
vsk added inline comments. Comment at: lib/CodeGen/CodeGenPGO.cpp:244 + DEFINE_NESTABLE_TRAVERSAL(CXXTryStmt) + DEFINE_NESTABLE_TRAVERSAL(CXXCatchStmt) + arphaman wrote: > What about `ObjCAtTryStmt`? I thought about this, but: we don't place a counter on ObjC at-try's, so it seems a bit moot to invalidate the profile if we see one change. Comment at: lib/CodeGen/CodeGenPGO.cpp:321 +return PGOHash::ReturnStmt; + case Stmt::CXXThrowExprClass: +return PGOHash::ThrowExpr; arphaman wrote: > Might as well include the `ObjCAtThrowStmt` as well. If profiling at-try isn't very important, I'm not sure the hash should be sensitive to at-throw either. I do see situations where it could be helpful, but IMO the potential benefit is outweighed by having extra invalidations. https://reviews.llvm.org/D39446 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39446: [PGO] Detect more structural changes with the stable hash
arphaman added a comment. ok, sgtm https://reviews.llvm.org/D39446 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r317952 - Add x86-registered-target to REQUIRES for new test
Author: tejohnson Date: Fri Nov 10 16:05:39 2017 New Revision: 317952 URL: http://llvm.org/viewvc/llvm-project?rev=317952&view=rev Log: Add x86-registered-target to REQUIRES for new test Should fix test added in r317951. Modified: cfe/trunk/test/CodeGen/thinlto-debug-pm.c Modified: cfe/trunk/test/CodeGen/thinlto-debug-pm.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/thinlto-debug-pm.c?rev=317952&r1=317951&r2=317952&view=diff == --- cfe/trunk/test/CodeGen/thinlto-debug-pm.c (original) +++ cfe/trunk/test/CodeGen/thinlto-debug-pm.c Fri Nov 10 16:05:39 2017 @@ -1,5 +1,6 @@ // Test to ensure -fdebug-pass-manager works when invoking the // ThinLTO backend path with the new PM. +// REQUIRES: x86-registered-target // RUN: %clang -O2 %s -flto=thin -c -o %t.o // RUN: llvm-lto -thinlto -o %t %t.o // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager -fexperimental-new-pass-manager 2>&1 | FileCheck %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r317953 - [Serialization] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
Author: eugenezelenko Date: Fri Nov 10 16:08:50 2017 New Revision: 317953 URL: http://llvm.org/viewvc/llvm-project?rev=317953&view=rev Log: [Serialization] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). Modified: cfe/trunk/include/clang/Serialization/ASTWriter.h cfe/trunk/include/clang/Serialization/ModuleManager.h cfe/trunk/lib/Serialization/ASTReaderInternals.h cfe/trunk/lib/Serialization/ASTWriter.cpp cfe/trunk/lib/Serialization/ModuleManager.cpp Modified: cfe/trunk/include/clang/Serialization/ASTWriter.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTWriter.h?rev=317953&r1=317952&r2=317953&view=diff == --- cfe/trunk/include/clang/Serialization/ASTWriter.h (original) +++ cfe/trunk/include/clang/Serialization/ASTWriter.h Fri Nov 10 16:08:50 2017 @@ -1,4 +1,4 @@ -//===--- ASTWriter.h - AST File Writer --*- C++ -*-===// +//===- ASTWriter.h - AST File Writer *- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -11,67 +11,89 @@ // containing a serialized representation of a translation unit. // //===--===// + #ifndef LLVM_CLANG_SERIALIZATION_ASTWRITER_H #define LLVM_CLANG_SERIALIZATION_ASTWRITER_H #include "clang/AST/ASTMutationListener.h" #include "clang/AST/Decl.h" +#include "clang/AST/DeclarationName.h" +#include "clang/AST/NestedNameSpecifier.h" #include "clang/AST/TemplateBase.h" +#include "clang/AST/TemplateName.h" +#include "clang/AST/Type.h" +#include "clang/AST/TypeLoc.h" +#include "clang/Basic/LLVM.h" +#include "clang/Basic/SourceLocation.h" #include "clang/Frontend/PCHContainerOperations.h" #include "clang/Sema/SemaConsumer.h" #include "clang/Serialization/ASTBitCodes.h" #include "clang/Serialization/ASTDeserializationListener.h" +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/MapVector.h" #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" #include "llvm/Bitcode/BitstreamWriter.h" +#include +#include +#include +#include +#include #include +#include +#include #include namespace llvm { - class APFloat; - class APInt; -} + +class APFloat; +class APInt; +class APSInt; + +} // namespace llvm namespace clang { -class DeclarationName; class ASTContext; +class ASTReader; +class ASTUnresolvedSet; class Attr; -class NestedNameSpecifier; class CXXBaseSpecifier; class CXXCtorInitializer; +class CXXRecordDecl; +class CXXTemporary; class FileEntry; class FPOptions; +class FunctionDecl; class HeaderSearch; class HeaderSearchOptions; class IdentifierResolver; +class LangOptions; class MacroDefinitionRecord; -class MacroDirective; class MacroInfo; -class OpaqueValueExpr; -class OpenCLOptions; -class ASTReader; class MemoryBufferCache; class Module; class ModuleFileExtension; class ModuleFileExtensionWriter; -class PreprocessedEntity; +class NamedDecl; +class NestedNameSpecifier; +class ObjCInterfaceDecl; class PreprocessingRecord; class Preprocessor; +struct QualifierInfo; class RecordDecl; class Sema; class SourceManager; +class Stmt; struct StoredDeclsList; class SwitchCase; -class TargetInfo; +class TemplateParameterList; class Token; +class TypeSourceInfo; class VersionTuple; -class ASTUnresolvedSet; - -namespace SrcMgr { class SLocEntry; } /// \brief Writes an AST file containing the contents of a translation unit. /// @@ -82,14 +104,15 @@ namespace SrcMgr { class SLocEntry; } class ASTWriter : public ASTDeserializationListener, public ASTMutationListener { public: - typedef SmallVector RecordData; - typedef SmallVectorImpl RecordDataImpl; - typedef ArrayRef RecordDataRef; - friend class ASTDeclWriter; + friend class ASTRecordWriter; friend class ASTStmtWriter; friend class ASTTypeWriter; - friend class ASTRecordWriter; + + using RecordData = SmallVector; + using RecordDataImpl = SmallVectorImpl; + using RecordDataRef = ArrayRef; + private: /// \brief Map that provides the ID numbers of each type within the /// output stream, plus those deserialized from a chained PCH. @@ -100,9 +123,8 @@ private: /// allow for the const/volatile qualifiers. /// /// Keys in the map never have const/volatile qualifiers. - typedef llvm::DenseMap -TypeIdxMap; + using TypeIdxMap = llvm::DenseMap; /// \brief The bitstream writer used to emit this precompiled header. llvm::BitstreamWriter &Stream; @@ -152,8 +174,8 @@ private: /// \brief Stores a declaration or a type to be written to the AST file. class DeclOrType { public: -DeclOrType(Decl *D) : Stored(D), IsType(false) { } -DeclOrType(QualType T) : Stored(T.getAsOpaquePtr()), IsType(true) {
[PATCH] D39641: [CodeGen] make cbrt and fma constant (never set errno)
efriedma added inline comments. Comment at: lib/Sema/SemaDecl.cpp:12853 + const llvm::Triple &Trip = Context.getTargetInfo().getTriple(); + if ((Trip.isGNUEnvironment() || Trip.isKnownWindowsMSVCEnvironment()) && + (Name->isStr("fma") || Name->isStr("fmaf") || Name->isStr("fmal") || isOSMSVCRT(). Please check the BuiltinID rather than using string compares. https://reviews.llvm.org/D39641 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D36790: [ObjC] Messages to 'self' in class methods that return 'instancetype' should use the pointer to the class as the result type of the message
arphaman added a comment. ping Repository: rL LLVM https://reviews.llvm.org/D36790 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39829: add new check for property declaration
Wizard updated this revision to Diff 122552. Wizard marked 9 inline comments as done. Wizard added a comment. add custom options https://reviews.llvm.org/D39829 Files: clang-tidy/objc/CMakeLists.txt clang-tidy/objc/ObjCTidyModule.cpp clang-tidy/objc/PropertyDeclarationCheck.cpp clang-tidy/objc/PropertyDeclarationCheck.h docs/ReleaseNotes.rst docs/clang-tidy/checks/google-objc-global-variable-declaration.rst docs/clang-tidy/checks/list.rst docs/clang-tidy/checks/objc-property-declaration.rst test/clang-tidy/objc-property-declaration-custom.m test/clang-tidy/objc-property-declaration.m Index: test/clang-tidy/objc-property-declaration.m === --- /dev/null +++ test/clang-tidy/objc-property-declaration.m @@ -0,0 +1,10 @@ +// RUN: %check_clang_tidy %s objc-property-declaration %t +@class NSString; + +@interface Foo +@property(assign, nonatomic) int NotCamelCase; +// CHECK-MESSAGES: :[[@LINE-1]]:34: warning: property 'NotCamelCase' is not in proper format according to property naming convention. It should be in the format of lowerCamelCase or has special acronyms [objc-property-declaration] +// CHECK-FIXES: @property(assign, nonatomic) int notCamelCase; +@property(assign, nonatomic) int camelCase; +@property(strong, nonatomic) NSString *URLString; +@end Index: test/clang-tidy/objc-property-declaration-custom.m === --- /dev/null +++ test/clang-tidy/objc-property-declaration-custom.m @@ -0,0 +1,11 @@ +// RUN: %check_clang_tidy %s objc-property-declaration %t \ +// RUN: -config='{CheckOptions: \ +// RUN: [{key: objc-property-declaration.Acronyms, value: "ABC;TGIF"}]}' \ +// RUN: -- + +@interface Foo +@property(assign, nonatomic) int AbcNotRealPrefix; +// CHECK-MESSAGES: :[[@LINE-1]]:34: warning: property 'AbcNotRealPrefix' is not in proper format according to property naming convention. It should be in the format of lowerCamelCase or has special acronyms [objc-property-declaration] +// CHECK-FIXES: @property(assign, nonatomic) int abcNotRealPrefix; +@property(assign, nonatomic) int ABCCustomPrefix; +@end Index: docs/clang-tidy/checks/objc-property-declaration.rst === --- /dev/null +++ docs/clang-tidy/checks/objc-property-declaration.rst @@ -0,0 +1,43 @@ +.. title:: clang-tidy - objc-property-declaration + +objc-property-declaration += + +Finds property declarations in Objective-C files that do not follow the pattern +of property names in Apple's programming guide. The property name should be +in the format of Lower Camel Case. + +For code: + +.. code-block:: objc + +@property(nonatomic, assign) int LowerCamelCase; + +The fix will be: + +.. code-block:: objc + +@property(nonatomic, assign) int lowerCamelCase; + +The check will only fix 'CamelCase' to 'camelCase'. In some other cases we will +only provide warning messages since the property name could be complicated. +Users will need to come up with a proper name by their own. + +This check also accepts special acronyms as prefix. Such prefix will suppress +the check of Lower Camel Case according to the guide: +https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingBasics.html#//apple_ref/doc/uid/20001281-1002931-BBCFHEAB + +For a full list of well-known acronyms: +https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/APIAbbreviations.html#//apple_ref/doc/uid/20001285-BCIHCGAE + +The corresponding style rule: https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingIvarsAndTypes.html#//apple_ref/doc/uid/20001284-1001757 + +Options +--- + +.. option:: Acronyms + + Semicolon-separated list of acronys that can be used as prefix + of property names. + + Defaults to ``ASCII;PDF;XML;HTML;URL;RTF;HTTP;TIFF;JPG;PNG;GIF;LZW;ROM;RGB;CMYK;MIDI;FTP``. Index: docs/clang-tidy/checks/list.rst === --- docs/clang-tidy/checks/list.rst +++ docs/clang-tidy/checks/list.rst @@ -173,15 +173,16 @@ modernize-use-using mpi-buffer-deref mpi-type-mismatch + objc-forbidden-subclassing + objc-property-declaration performance-faster-string-find performance-for-range-copy performance-implicit-conversion-in-loop performance-inefficient-string-concatenation performance-inefficient-vector-operation performance-type-promotion-in-math-fn performance-unnecessary-copy-initialization performance-unnecessary-value-param - objc-forbidden-subclassing readability-avoid-const-params-in-decls readability-braces-around-statements readability-container-size-empty Index: docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
[PATCH] D39829: add new check for property declaration
Wizard marked 2 inline comments as done. Wizard added inline comments. Comment at: clang-tidy/objc/PropertyDeclarationCheck.cpp:27 +FixItHint generateFixItHint(const ObjCPropertyDecl *Decl) { + if (isupper(Decl->getName()[0])) { +auto NewName = Decl->getName().str(); hokein wrote: > nit: I would add an assert to make sure the name is not empty. Added it to the line before generating the warning message. Comment at: docs/clang-tidy/checks/google-objc-global-variable-declaration.rst:1 .. title:: clang-tidy - google-objc-global-variable-declaration benhamilton wrote: > Let's remove "google-" everywhere and mention only Apple's style guide. Discussed offline. The change here is for another doc. Irrelevant to the new check. https://reviews.llvm.org/D39829 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39331: Add flags to control the -finstrument-functions instrumentation calls to __cyg_profile functions
hans updated this revision to Diff 122557. hans added a comment. Updating to match the LLVM-side: https://reviews.llvm.org/D39287#inline-348143 https://reviews.llvm.org/D39331 Files: include/clang/Driver/Options.td include/clang/Frontend/CodeGenOptions.def lib/CodeGen/CodeGenFunction.cpp lib/CodeGen/CodeGenFunction.h lib/Driver/ToolChains/Clang.cpp lib/Frontend/CompilerInvocation.cpp test/CodeGen/instrument-functions.c test/CodeGen/mcount.c test/CodeGen/x86_64-instrument-functions.c test/CodeGenCXX/instrument-functions.cpp test/Frontend/gnu-mcount.c Index: test/Frontend/gnu-mcount.c === --- test/Frontend/gnu-mcount.c +++ test/Frontend/gnu-mcount.c @@ -43,36 +43,36 @@ // CHECK-LABEL: f // TODO: add profiling support for arm-baremetal -// CHECK-ARM-BAREMETAL-EABI-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01mcount"{{.*}} } -// CHECK-ARM-BAREMETAL-EABI-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} } -// CHECK-ARM64-BAREMETAL-EABI: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="mcount"{{.*}} } -// CHECK-ARM64-BAREMETAL-EABI-MEABI-GNU: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01_mcount"{{.*}} } -// CHECK-ARM-IOS-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="_mcount"{{.*}} } -// CHECK-ARM-IOS-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} } -// CHECK-ARM-EABI: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01mcount"{{.*}} } -// CHECK-ARM-EABI-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} } -// CHECK-ARM64-EABI: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="mcount"{{.*}} } -// CHECK-ARM64-EABI-MEABI-GNU: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01_mcount"{{.*}} } -// CHECK-ARM64-EABI-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} } -// CHECK-ARM64-EABI-LINUX: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01_mcount"{{.*}} } -// CHECK-ARM-EABI-FREEBSD: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="__mcount"{{.*}} } -// CHECK-ARM-EABI-FREEBSD-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} } -// CHECK-ARM64-EABI-FREEBSD: attributes #{{[0-9]+}} = { {{.*}}"counting-function"=".mcount"{{.*}} } -// CHECK-ARM64-EABI-FREEBSD-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} } -// CHECK-ARM-EABI-NETBSD: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="_mcount"{{.*}} } -// CHECK-ARM-EABI-NETBSD-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} } -// CHECK-ARM-EABI-OPENBSD: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="__mcount"{{.*}} } -// CHECK-ARM-EABI-OPENBSD-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} } -// CHECK-ARM64-EABI-OPENBSD: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="__mcount"{{.*}} } -// CHECK-ARM64-EABI-OPENBSD-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} } -// CHECK-ARM-EABI-MEABI-GNU-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="mcount"{{.*}} } -// CHECK-ARM-EABI-MEABI-GNU: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} } -// CHECK-ARM-EABI-RTEMS: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="mcount"{{.*}} } -// CHECK-ARM-EABI-RTEMS-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} } -// CHECK-ARM64-EABI-RTEMS: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="mcount"{{.*}} } -// CHECK-ARM64-EABI-RTEMS-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} } -// CHECK-ARM-EABI-CLOUDABI: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="mcount"{{.*}} } -// CHECK-ARM-EABI-CLOUDABI-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} } -// CHECK-ARM64-EABI-CLOUDABI: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="mcount"{{.*}} } -// CHECK-ARM64-EABI-CLOUDABI-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} } +// CHECK-ARM-BAREMETAL-EABI-NOT: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="\01mcount"{{.*}} } +// CHECK-ARM-BAREMETAL-EABI-NOT: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="\01__gnu_mcount_nc"{{.*}} } +// CHECK-ARM64-BAREMETAL-EABI: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="mcount"{{.*}} } +// CHECK-ARM64-BAREMETAL-EABI-MEABI-GNU: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="\01_mcount"{{.*}} } +// CHECK-ARM-IOS-NOT: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="_mcount"{{.*}} } +// CHECK-ARM-IOS-NOT: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="\01__gnu_mcount_nc"{{.*}} } +// CHECK-ARM-EABI: attributes #{{[0
r317957 - Handle lambda captures of variable length arrays in profiling and printing.
Author: rtrieu Date: Fri Nov 10 16:54:25 2017 New Revision: 317957 URL: http://llvm.org/viewvc/llvm-project?rev=317957&view=rev Log: Handle lambda captures of variable length arrays in profiling and printing. From http://reviews.llvm.org/D4368 these cases were thought to not be reachable and the checks removed before the rest of the code was committed in r216649. However, these cases are reachable and the checks are added back. Modified: cfe/trunk/lib/AST/StmtPrinter.cpp cfe/trunk/lib/AST/StmtProfile.cpp cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp Modified: cfe/trunk/lib/AST/StmtPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=317957&r1=317956&r2=317957&view=diff == --- cfe/trunk/lib/AST/StmtPrinter.cpp (original) +++ cfe/trunk/lib/AST/StmtPrinter.cpp Fri Nov 10 16:54:25 2017 @@ -2232,6 +2232,9 @@ void StmtPrinter::VisitLambdaExpr(Lambda CEnd = Node->explicit_capture_end(); C != CEnd; ++C) { +if (C->capturesVLAType()) + continue; + if (NeedComma) OS << ", "; NeedComma = true; Modified: cfe/trunk/lib/AST/StmtProfile.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=317957&r1=317956&r2=317957&view=diff == --- cfe/trunk/lib/AST/StmtProfile.cpp (original) +++ cfe/trunk/lib/AST/StmtProfile.cpp Fri Nov 10 16:54:25 2017 @@ -1590,6 +1590,9 @@ StmtProfiler::VisitLambdaExpr(const Lamb for (LambdaExpr::capture_iterator C = S->explicit_capture_begin(), CEnd = S->explicit_capture_end(); C != CEnd; ++C) { +if (C->capturesVLAType()) + continue; + ID.AddInteger(C->getCaptureKind()); switch (C->getCaptureKind()) { case LCK_StarThis: Modified: cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp?rev=317957&r1=317956&r2=317957&view=diff == --- cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp (original) +++ cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp Fri Nov 10 16:54:25 2017 @@ -55,4 +55,8 @@ struct B : A { ; // CHECK-NOT: ; +void g(int n) { + int buffer[n]; // CHECK: int buffer[n]; + [&buffer]() {}(); // CHECK: [&buffer] +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39930: [CMake] Use libc++ and compiler-rt as default libraries in Fuchsia toolchain
phosek created this revision. Herald added subscribers: mgorny, dberris. Herald added a reviewer: EricWF. Fuchsia already defaults to libc++ and compiler-rt, but we want to use these as default runtimes even on the host platform. Repository: rL LLVM https://reviews.llvm.org/D39930 Files: cmake/caches/Fuchsia-stage2.cmake Index: cmake/caches/Fuchsia-stage2.cmake === --- cmake/caches/Fuchsia-stage2.cmake +++ cmake/caches/Fuchsia-stage2.cmake @@ -17,6 +17,8 @@ set(LLVM_ENABLE_LLD ON CACHE BOOL "") set(CLANG_DEFAULT_LINKER lld CACHE STRING "") endif() +set(CLANG_DEFAULT_CXX_STDLIB libc++ CACHE STRING "") +set(CLANG_DEFAULT_RTLIB compiler-rt CACHE STRING "") # This is a "Does your linker support it?" option that only applies # to x86-64 ELF targets. All Fuchsia target linkers do support it. Index: cmake/caches/Fuchsia-stage2.cmake === --- cmake/caches/Fuchsia-stage2.cmake +++ cmake/caches/Fuchsia-stage2.cmake @@ -17,6 +17,8 @@ set(LLVM_ENABLE_LLD ON CACHE BOOL "") set(CLANG_DEFAULT_LINKER lld CACHE STRING "") endif() +set(CLANG_DEFAULT_CXX_STDLIB libc++ CACHE STRING "") +set(CLANG_DEFAULT_RTLIB compiler-rt CACHE STRING "") # This is a "Does your linker support it?" option that only applies # to x86-64 ELF targets. All Fuchsia target linkers do support it. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r317959 - Revert "[ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang"
Author: tejohnson Date: Fri Nov 10 17:06:41 2017 New Revision: 317959 URL: http://llvm.org/viewvc/llvm-project?rev=317959&view=rev Log: Revert "[ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang" This reverts commit r317951 and r317952. The new test is aborting on some bots and I'll need to investigate later. Removed: cfe/trunk/test/CodeGen/thinlto-debug-pm.c Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=317959&r1=317958&r2=317959&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri Nov 10 17:06:41 2017 @@ -1073,7 +1073,6 @@ static void runThinLTOBackend(ModuleSumm initTargetOptions(Conf.Options, CGOpts, TOpts, LOpts, HeaderOpts); Conf.SampleProfile = std::move(SampleProfile); Conf.UseNewPM = CGOpts.ExperimentalNewPassManager; - Conf.DebugPassManager = CGOpts.DebugPassManager; switch (Action) { case Backend_EmitNothing: Conf.PreCodeGenModuleHook = [](size_t Task, const Module &Mod) { Removed: cfe/trunk/test/CodeGen/thinlto-debug-pm.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/thinlto-debug-pm.c?rev=317958&view=auto == --- cfe/trunk/test/CodeGen/thinlto-debug-pm.c (original) +++ cfe/trunk/test/CodeGen/thinlto-debug-pm.c (removed) @@ -1,10 +0,0 @@ -// Test to ensure -fdebug-pass-manager works when invoking the -// ThinLTO backend path with the new PM. -// REQUIRES: x86-registered-target -// RUN: %clang -O2 %s -flto=thin -c -o %t.o -// RUN: llvm-lto -thinlto -o %t %t.o -// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager -fexperimental-new-pass-manager 2>&1 | FileCheck %s -// CHECK: Running pass: - -void foo() { -} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39930: [CMake] Use libc++ and compiler-rt as default libraries in Fuchsia toolchain
mcgrathr added a comment. In principle this should be OK since we're unconditionally building the runtimes for `default`. However, this means that any dynamically-linked host builds will assume our toolchain-provided shared libraries are available on the runtime host in standard library places. I don't think we want that. Perhaps we could make `-static-libstdc++` default in our host targets. But that's not really enough, since compiler-rt has some too. Probably better to just disable building the shared libraries altogether for the host targets. Repository: rL LLVM https://reviews.llvm.org/D39930 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r317961 - [CUDA] Fix std::min on device side to return the min, not the max.
Author: jlebar Date: Fri Nov 10 17:25:44 2017 New Revision: 317961 URL: http://llvm.org/viewvc/llvm-project?rev=317961&view=rev Log: [CUDA] Fix std::min on device side to return the min, not the max. Summary: How embarrassing. This is tested in the test-suite -- fix to come there in a separate patch. Reviewers: tra Subscribers: sanjoy, cfe-commits Differential Revision: https://reviews.llvm.org/D39817 Modified: cfe/trunk/lib/Headers/cuda_wrappers/algorithm Modified: cfe/trunk/lib/Headers/cuda_wrappers/algorithm URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/cuda_wrappers/algorithm?rev=317961&r1=317960&r2=317961&view=diff == --- cfe/trunk/lib/Headers/cuda_wrappers/algorithm (original) +++ cfe/trunk/lib/Headers/cuda_wrappers/algorithm Fri Nov 10 17:25:44 2017 @@ -80,7 +80,7 @@ min(const __T &__a, const __T &__b, __Cm template inline __device__ const __T & min(const __T &__a, const __T &__b) { - return __a < __b ? __b : __a; + return __a < __b ? __a : __b; } #ifdef _LIBCPP_END_NAMESPACE_STD ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits