r267338 - Improve diagnostic checking for va_start to also warn on other instances of undefined behavior, such as a parameter declared with the register keyword in C, or a parameter of a type that und
Author: aaronballman Date: Sun Apr 24 08:30:21 2016 New Revision: 267338 URL: http://llvm.org/viewvc/llvm-project?rev=267338&view=rev Log: Improve diagnostic checking for va_start to also warn on other instances of undefined behavior, such as a parameter declared with the register keyword in C, or a parameter of a type that undergoes default argument promotion. This helps cover some more of the CERT secure coding rule EXP58-CPP. Pass an object of the correct type to va_start (https://www.securecoding.cert.org/confluence/display/cplusplus/EXP58-CPP.+Pass+an+object+of+the+correct+type+to+va_start). Added: cfe/trunk/test/SemaCXX/varargs.cpp Removed: cfe/trunk/test/Sema/varargs.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/Sema/SemaChecking.cpp cfe/trunk/test/Sema/varargs-x86-64.c cfe/trunk/test/Sema/varargs.c Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=267338&r1=267337&r2=267338&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Sun Apr 24 08:30:21 2016 @@ -7435,8 +7435,10 @@ def err_ms_va_start_used_in_sysv_functio def warn_second_arg_of_va_start_not_last_named_param : Warning< "second argument to 'va_start' is not the last named parameter">, InGroup; -def warn_va_start_of_reference_type_is_undefined : Warning< - "'va_start' has undefined behavior with reference types">, InGroup; +def warn_va_start_type_is_undefined : Warning< + "passing %select{an object that undergoes default argument promotion|" + "an object of reference type|a parameter declared with the 'register' " + "keyword}0 to 'va_start' has undefined behavior">, InGroup; def err_first_argument_to_va_arg_not_of_type_va_list : Error< "first argument to 'va_arg' is of type %0 and not 'va_list'">; def err_second_parameter_to_va_arg_incomplete: Error< Modified: cfe/trunk/lib/Sema/SemaChecking.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=267338&r1=267337&r2=267338&view=diff == --- cfe/trunk/lib/Sema/SemaChecking.cpp (original) +++ cfe/trunk/lib/Sema/SemaChecking.cpp Sun Apr 24 08:30:21 2016 @@ -2702,6 +2702,7 @@ bool Sema::SemaBuiltinVAStartImpl(CallEx // block. QualType Type; SourceLocation ParamLoc; + bool IsCRegister = false; if (const DeclRefExpr *DR = dyn_cast(Arg)) { if (const ParmVarDecl *PV = dyn_cast(DR->getDecl())) { @@ -2718,15 +2719,21 @@ bool Sema::SemaBuiltinVAStartImpl(CallEx Type = PV->getType(); ParamLoc = PV->getLocation(); + IsCRegister = + PV->getStorageClass() == SC_Register && !getLangOpts().CPlusPlus; } } if (!SecondArgIsLastNamedArgument) Diag(TheCall->getArg(1)->getLocStart(), diag::warn_second_arg_of_va_start_not_last_named_param); - else if (Type->isReferenceType()) { -Diag(Arg->getLocStart(), - diag::warn_va_start_of_reference_type_is_undefined); + else if (IsCRegister || Type->isReferenceType() || + Type->isPromotableIntegerType() || + Type->isSpecificBuiltinType(BuiltinType::Float)) { +unsigned Reason = 0; +if (Type->isReferenceType()) Reason = 1; +else if (IsCRegister) Reason = 2; +Diag(Arg->getLocStart(), diag::warn_va_start_type_is_undefined) << Reason; Diag(ParamLoc, diag::note_parameter_type) << Type; } Modified: cfe/trunk/test/Sema/varargs-x86-64.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/varargs-x86-64.c?rev=267338&r1=267337&r2=267338&view=diff == --- cfe/trunk/test/Sema/varargs-x86-64.c (original) +++ cfe/trunk/test/Sema/varargs-x86-64.c Sun Apr 24 08:30:21 2016 @@ -26,11 +26,11 @@ void __attribute__((ms_abi)) g2(int a, i __builtin_ms_va_start(ap, b); } -void __attribute__((ms_abi)) g3(float a, ...) { +void __attribute__((ms_abi)) g3(float a, ...) { // expected-note 2{{parameter of type 'float' is declared here}} __builtin_ms_va_list ap; - __builtin_ms_va_start(ap, a); - __builtin_ms_va_start(ap, (a)); + __builtin_ms_va_start(ap, a); // expected-warning {{passing an object that undergoes default argument promotion to 'va_start' has undefined behavior}} + __builtin_ms_va_start(ap, (a)); // expected-warning {{passing an object that undergoes default argument promotion to 'va_start' has undefined behavior}} } void __attribute__((ms_abi)) g5() { Modified: cfe/trunk/test/Sema/varargs.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/varargs.c?rev=267338&r1=267337&r2=267338&view=diff == --- cfe/tr
Re: [PATCH] D19244: Extend checking of va_start builtin
aaron.ballman closed this revision. aaron.ballman added a comment. Thanks! I've commit in r267338. http://reviews.llvm.org/D19244 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19458: Add address space 258 to Clang documentation
mkuper accepted this revision. mkuper added a comment. This revision is now accepted and ready to land. LGTM with a small nit - can you change the heading from "Memory references off the GS segment" to something more general? http://reviews.llvm.org/D19458 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19204: clang-format: [JS] generator and async functions.
djasper accepted this revision. djasper added a comment. This revision is now accepted and ready to land. Looks good. http://reviews.llvm.org/D19204 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D18919: [Clang-tidy] Add check "modernize use using"
hokein added inline comments. Comment at: clang-tidy/modernize/ModernizeTidyModule.cpp:49 @@ -47,1 +48,3 @@ CheckFactories.registerCheck("modernize-use-override"); +CheckFactories.registerCheck( +"modernize-use-using"); You can put it in one-line, which will not exceed 80 characters. Comment at: clang-tidy/modernize/UseUsingCheck.cpp:23 @@ +22,3 @@ + Finder->addMatcher(typedefDecl().bind("typedef"), this); +} +///Function which replace all substrings "search" with "replace" in string "s" Add a blank line. Comment at: clang-tidy/modernize/UseUsingCheck.cpp:24 @@ +23,3 @@ +} +///Function which replace all substrings "search" with "replace" in string "s" +static void replaceAll(std::string &s, const std::string &search, const std::string replace){ A blank between `///` and `F`, please use clang-format to make sure your code align with LLVM style. Comment at: clang-tidy/modernize/UseUsingCheck.cpp:25 @@ +24,3 @@ +///Function which replace all substrings "search" with "replace" in string "s" +static void replaceAll(std::string &s, const std::string &search, const std::string replace){ + size_t pos = 0; `replace` parameter can be `const std::string&`. Comment at: clang-tidy/modernize/UseUsingCheck.cpp:26 @@ +25,3 @@ +static void replaceAll(std::string &s, const std::string &search, const std::string replace){ + size_t pos = 0; +while ((pos = s.find(search, pos)) != std::string::npos) { code indentation. Comment at: clang-tidy/modernize/UseUsingCheck.cpp:38 @@ +37,3 @@ + {" class ", ""}, {"(class ", "("}, {"struct ", ""}, {"union ", ""}, {"(void)", "()"}}; + for (auto p : Subs) { +std::string search = p.first; `const auto &p` Comment at: clang-tidy/modernize/UseUsingCheck.cpp:41 @@ +40,3 @@ +std::string replace = p.second; +replaceAll(subject, search, replace); + } You can use `replaceAll(subject, p.first, p.second)`. Comment at: clang-tidy/modernize/UseUsingCheck.cpp:46 @@ +45,3 @@ + +void UseUsingCheck::check(const MatchFinder::MatchResult &Result) { + const auto *MatchedDecl = Result.Nodes.getNodeAs("typedef"); You need to filter out the non-c++11 code here. Comment at: clang-tidy/modernize/UseUsingCheck.h:19 @@ +18,3 @@ + +/// Finds typedefs and replaces it with using +/// Please use a complete sentence. Comment at: test/clang-tidy/modernize-use-using.cpp:2 @@ +1,3 @@ +// RUN: %check_clang_tidy %s modernize-use-using %t + + Remove the extra blank line. Comment at: test/clang-tidy/modernize-use-using.cpp:9 @@ +8,3 @@ +typedef long LL; +// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use using instead of typedef [modernize-use-using] +// CHECK-FIXES: using LL = long; No need to check the whole message except the first one. So here you can use `warning: use using instead of typedef`. Repository: rL LLVM http://reviews.llvm.org/D18919 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19183: [clang-tidy] Add modernize-make-shared check
hokein added a comment. The patch looks almost good, some nits. Comment at: clang-tidy/modernize/MakeSmartPtrCheck.cpp:1 @@ +1,2 @@ + +//===--- MakeSmartPtrCheck.cpp - clang-tidy===// Extra blank line. Comment at: clang-tidy/modernize/MakeSmartPtrCheck.cpp:27 @@ +26,3 @@ +: + + ClangTidyCheck(Name, Context), Remove two extra blanks. Comment at: test/clang-tidy/modernize-make-shared.cpp:81 @@ +80,3 @@ + + std::shared_ptr R(new int()); + Why can't this case convert to `std::shared_ptr R = std::make_shared(new int())`? Repository: rL LLVM http://reviews.llvm.org/D19183 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r267365 - unwind: remove unnecessary header
Author: compnerd Date: Sun Apr 24 16:01:04 2016 New Revision: 267365 URL: http://llvm.org/viewvc/llvm-project?rev=267365&view=rev Log: unwind: remove unnecessary header Availablity.h is not used within config.h. The locations which use the availability infrastructure already include the necessary header(s). NFC. Modified: libunwind/trunk/src/config.h Modified: libunwind/trunk/src/config.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/config.h?rev=267365&r1=267364&r2=267365&view=diff == --- libunwind/trunk/src/config.h (original) +++ libunwind/trunk/src/config.h Sun Apr 24 16:01:04 2016 @@ -30,8 +30,6 @@ // Platform specific configuration defines. #ifdef __APPLE__ - #include - #define _LIBUNWIND_BUILD_SJLJ_APIS defined(__arm__) #if defined(FOR_DYLD) @@ -44,7 +42,6 @@ #define _LIBUNWIND_SUPPORT_DWARF_INDEX0 #endif #else - #define _LIBUNWIND_BUILD_SJLJ_APIS 0 #if defined(__ARM_DWARF_EH__) || !defined(__arm__) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r267364 - unwind: unify _LIBUNWIND_ABORT
Author: compnerd Date: Sun Apr 24 16:00:59 2016 New Revision: 267364 URL: http://llvm.org/viewvc/llvm-project?rev=267364&view=rev Log: unwind: unify _LIBUNWIND_ABORT Rather than use the `__assert_rtn` on libSystem based targets and a local `assert_rtn` function on others, expand the function definition into a macro which will perform the writing to stderr and then abort. This unifies the definition and behaviour across targets. Ensure that we flush stderr prior to aborting. Modified: libunwind/trunk/src/config.h Modified: libunwind/trunk/src/config.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/config.h?rev=267364&r1=267363&r2=267364&view=diff == --- libunwind/trunk/src/config.h (original) +++ libunwind/trunk/src/config.h Sun Apr 24 16:00:59 2016 @@ -16,6 +16,7 @@ #include #include +#include // Define static_assert() unless already defined by compiler. #ifndef __has_feature @@ -30,17 +31,8 @@ // Platform specific configuration defines. #ifdef __APPLE__ #include - #ifdef __cplusplus -extern "C" { - #endif -void __assert_rtn(const char *, const char *, int, const char *) - __attribute__((noreturn)); - #ifdef __cplusplus -} - #endif #define _LIBUNWIND_BUILD_SJLJ_APIS defined(__arm__) - #define _LIBUNWIND_ABORT(msg) __assert_rtn(__func__, __FILE__, __LINE__, msg) #if defined(FOR_DYLD) #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 1 @@ -52,17 +44,8 @@ #define _LIBUNWIND_SUPPORT_DWARF_INDEX0 #endif #else - #include - - static inline void assert_rtn(const char* func, const char* file, int line, const char* msg) __attribute__ ((noreturn)); - static inline void assert_rtn(const char* func, const char* file, int line, const char* msg) { -fprintf(stderr, "libunwind: %s %s:%d - %s\n", func, file, line, msg); -assert(false); -abort(); - } #define _LIBUNWIND_BUILD_SJLJ_APIS 0 - #define _LIBUNWIND_ABORT(msg) assert_rtn(__func__, __FILE__, __LINE__, msg) #if defined(__ARM_DWARF_EH__) || !defined(__arm__) #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 0 @@ -94,6 +77,13 @@ #define _LIBUNWIND_BUILD_ZERO_COST_APIS 0 #endif +#define _LIBUNWIND_ABORT(msg) \ + do { \ +fprintf(stderr, "libunwind: %s %s:%d - %s\n", __func__, __FILE__, \ +__LINE__, msg); \ +fflush(stderr); \ +abort(); \ + } while (0) #define _LIBUNWIND_LOG(msg, ...) fprintf(stderr, "libuwind: " msg, __VA_ARGS__) // Macros that define away in non-Debug builds ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19183: [clang-tidy] Add modernize-make-shared check
Prazek added inline comments. Comment at: test/clang-tidy/modernize-make-shared.cpp:81 @@ +80,3 @@ + + std::shared_ptr R(new int()); + hokein wrote: > Why can't this case convert to `std::shared_ptr R = > std::make_shared(new int())`? You mean std::shared_ptr R = std::make_shared()? Repository: rL LLVM http://reviews.llvm.org/D19183 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19204: clang-format: [JS] generator and async functions.
This revision was automatically updated to reflect the committed changes. Closed by commit rL267368: clang-format: [JS] generator and async functions. (authored by mprobst). Changed prior to commit: http://reviews.llvm.org/D19204?vs=54195&id=54814#toc Repository: rL LLVM http://reviews.llvm.org/D19204 Files: cfe/trunk/lib/Format/ContinuationIndenter.cpp cfe/trunk/lib/Format/FormatToken.h cfe/trunk/lib/Format/TokenAnnotator.cpp cfe/trunk/lib/Format/UnwrappedLineParser.cpp cfe/trunk/unittests/Format/FormatTestJS.cpp Index: cfe/trunk/lib/Format/UnwrappedLineParser.cpp === --- cfe/trunk/lib/Format/UnwrappedLineParser.cpp +++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp @@ -668,7 +668,8 @@ // FIXME: This returns true for C/C++ keywords like 'struct'. return FormatTok->is(tok::identifier) && (FormatTok->Tok.getIdentifierInfo() == nullptr || - !FormatTok->isOneOf(Keywords.kw_in, Keywords.kw_of, + !FormatTok->isOneOf(Keywords.kw_in, Keywords.kw_of, Keywords.kw_async, + Keywords.kw_await, Keywords.kw_yield, Keywords.kw_finally, Keywords.kw_function, Keywords.kw_import, Keywords.kw_is, Keywords.kw_let, Keywords.kw_var, @@ -687,7 +688,7 @@ static bool isJSDeclOrStmt(const AdditionalKeywords &Keywords, const FormatToken *FormatTok) { return FormatTok->isOneOf( - tok::kw_return, + tok::kw_return, Keywords.kw_yield, // conditionals tok::kw_if, tok::kw_else, // loops @@ -698,7 +699,9 @@ tok::kw_throw, tok::kw_try, tok::kw_catch, Keywords.kw_finally, // declaration tok::kw_const, tok::kw_class, Keywords.kw_var, Keywords.kw_let, - Keywords.kw_function); + Keywords.kw_async, Keywords.kw_function, + // import/export + Keywords.kw_import, tok::kw_export); } // readTokenWithJavaScriptASI reads the next token and terminates the current @@ -1003,7 +1006,8 @@ // Parse function literal unless 'function' is the first token in a line // in which case this should be treated as a free-standing function. if (Style.Language == FormatStyle::LK_JavaScript && - FormatTok->is(Keywords.kw_function) && Line->Tokens.size() > 0) { + FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function) && + Line->Tokens.size() > 0) { tryToParseJSFunction(); break; } @@ -1189,8 +1193,16 @@ } void UnwrappedLineParser::tryToParseJSFunction() { + assert(FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function)); + if (FormatTok->is(Keywords.kw_async)) +nextToken(); + // Consume "function". nextToken(); + // Consume * (generator function). + if (FormatTok->is(tok::star)) +nextToken(); + // Consume function name. if (FormatTok->is(tok::identifier)) nextToken(); @@ -1235,7 +1247,7 @@ // replace this by using parseAssigmentExpression() inside. do { if (Style.Language == FormatStyle::LK_JavaScript) { - if (FormatTok->is(Keywords.kw_function)) { + if (FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function)) { tryToParseJSFunction(); continue; } @@ -1333,7 +1345,7 @@ break; case tok::identifier: if (Style.Language == FormatStyle::LK_JavaScript && - FormatTok->is(Keywords.kw_function)) + FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function)) tryToParseJSFunction(); else nextToken(); @@ -1904,8 +1916,11 @@ if (FormatTok->is(tok::kw_default)) nextToken(); - // Consume "function" and "default function", so that these get parsed as - // free-standing JS functions, i.e. do not require a trailing semicolon. + // Consume "async function", "function" and "default function", so that these + // get parsed as free-standing JS functions, i.e. do not require a trailing + // semicolon. + if (FormatTok->is(Keywords.kw_async)) +nextToken(); if (FormatTok->is(Keywords.kw_function)) { nextToken(); return; Index: cfe/trunk/lib/Format/TokenAnnotator.cpp === --- cfe/trunk/lib/Format/TokenAnnotator.cpp +++ cfe/trunk/lib/Format/TokenAnnotator.cpp @@ -2078,6 +2078,9 @@ } else if (Style.Language == FormatStyle::LK_JavaScript) { if (Left.is(TT_JsFatArrow)) return true; +if (Right.is(tok::star) && +Left.isOneOf(Keywords.kw_function, Keywords.kw_yield)) + return false; if (Left.isOneOf(Keywords.kw_let, Keywords.kw_var, Keywords.kw_in, Keywords.kw_of) && (!Left.Previous || !Left.Previous->is(tok::period))) Index: cfe/trunk/lib/Format/ContinuationIndenter.cpp === --- cfe/trunk/lib/Format/ContinuationIndenter.
r267368 - clang-format: [JS] generator and async functions.
Author: mprobst Date: Sun Apr 24 17:05:09 2016 New Revision: 267368 URL: http://llvm.org/viewvc/llvm-project?rev=267368&view=rev Log: clang-format: [JS] generator and async functions. For generators, see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_generators async functions are not quite in the spec yet, but stage 3 and already widely used: http://tc39.github.io/ecmascript-asyncawait/ Reviewers: djasper Subscribers: klimek Differential Revision: http://reviews.llvm.org/D19204 Modified: cfe/trunk/lib/Format/ContinuationIndenter.cpp cfe/trunk/lib/Format/FormatToken.h cfe/trunk/lib/Format/TokenAnnotator.cpp cfe/trunk/lib/Format/UnwrappedLineParser.cpp cfe/trunk/unittests/Format/FormatTestJS.cpp Modified: cfe/trunk/lib/Format/ContinuationIndenter.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/ContinuationIndenter.cpp?rev=267368&r1=267367&r2=267368&view=diff == --- cfe/trunk/lib/Format/ContinuationIndenter.cpp (original) +++ cfe/trunk/lib/Format/ContinuationIndenter.cpp Sun Apr 24 17:05:09 2016 @@ -479,7 +479,7 @@ unsigned ContinuationIndenter::addTokenO // is common and should be formatted like a free-standing function. if (Style.Language != FormatStyle::LK_JavaScript || Current.NestingLevel != 0 || !PreviousNonComment->is(tok::equal) || - !Current.is(Keywords.kw_function)) + !Current.isOneOf(Keywords.kw_async, Keywords.kw_function)) State.Stack.back().NestedBlockIndent = State.Column; if (NextNonComment->isMemberAccess()) { Modified: cfe/trunk/lib/Format/FormatToken.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/FormatToken.h?rev=267368&r1=267367&r2=267368&view=diff == --- cfe/trunk/lib/Format/FormatToken.h (original) +++ cfe/trunk/lib/Format/FormatToken.h Sun Apr 24 17:05:09 2016 @@ -535,13 +535,16 @@ struct AdditionalKeywords { kw_NS_ENUM = &IdentTable.get("NS_ENUM"); kw_NS_OPTIONS = &IdentTable.get("NS_OPTIONS"); +kw_async = &IdentTable.get("async"); +kw_await = &IdentTable.get("await"); kw_finally = &IdentTable.get("finally"); -kw_function = &IdentTable.get("function"); kw_from = &IdentTable.get("from"); +kw_function = &IdentTable.get("function"); kw_import = &IdentTable.get("import"); kw_is = &IdentTable.get("is"); kw_let = &IdentTable.get("let"); kw_var = &IdentTable.get("var"); +kw_yield = &IdentTable.get("yield"); kw_abstract = &IdentTable.get("abstract"); kw_assert = &IdentTable.get("assert"); @@ -582,13 +585,16 @@ struct AdditionalKeywords { IdentifierInfo *kw___except; // JavaScript keywords. + IdentifierInfo *kw_async; + IdentifierInfo *kw_await; IdentifierInfo *kw_finally; - IdentifierInfo *kw_function; IdentifierInfo *kw_from; + IdentifierInfo *kw_function; IdentifierInfo *kw_import; IdentifierInfo *kw_is; IdentifierInfo *kw_let; IdentifierInfo *kw_var; + IdentifierInfo *kw_yield; // Java keywords. IdentifierInfo *kw_abstract; Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=267368&r1=267367&r2=267368&view=diff == --- cfe/trunk/lib/Format/TokenAnnotator.cpp (original) +++ cfe/trunk/lib/Format/TokenAnnotator.cpp Sun Apr 24 17:05:09 2016 @@ -2078,6 +2078,9 @@ bool TokenAnnotator::spaceRequiredBefore } else if (Style.Language == FormatStyle::LK_JavaScript) { if (Left.is(TT_JsFatArrow)) return true; +if (Right.is(tok::star) && +Left.isOneOf(Keywords.kw_function, Keywords.kw_yield)) + return false; if (Left.isOneOf(Keywords.kw_let, Keywords.kw_var, Keywords.kw_in, Keywords.kw_of) && (!Left.Previous || !Left.Previous->is(tok::period))) Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=267368&r1=267367&r2=267368&view=diff == --- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original) +++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Sun Apr 24 17:05:09 2016 @@ -668,7 +668,8 @@ static bool mustBeJSIdent(const Addition // FIXME: This returns true for C/C++ keywords like 'struct'. return FormatTok->is(tok::identifier) && (FormatTok->Tok.getIdentifierInfo() == nullptr || - !FormatTok->isOneOf(Keywords.kw_in, Keywords.kw_of, + !FormatTok->isOneOf(Keywords.kw_in, Keywords.kw_of, Keywords.kw_async, + Keywords.kw_await, Keywords.kw_yield, Keywords.kw_finally, Keywords.kw_function, Keywords.kw_import,
r267369 - Debug info: Apply an empty debug location for global OpenMP destructors.
Author: adrian Date: Sun Apr 24 17:22:29 2016 New Revision: 267369 URL: http://llvm.org/viewvc/llvm-project?rev=267369&view=rev Log: Debug info: Apply an empty debug location for global OpenMP destructors. LLVM really wants a debug location on every inlinable call in a function with debug info, because it otherwise cannot set up inlining debug info. This change applies an artificial line 0 debug location (which is how DWARF marks automatically generated code that has no corresponding source code) to the .__kmpc_global_dtor_. functions to avoid the LLVM Verifier complaining. Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp cfe/trunk/test/OpenMP/threadprivate_codegen.cpp Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=267369&r1=267368&r2=267369&view=diff == --- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original) +++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Sun Apr 24 17:22:29 2016 @@ -1685,8 +1685,11 @@ llvm::Function *CGOpenMPRuntime::emitThr auto FTy = CGM.getTypes().GetFunctionType(FI); auto Fn = CGM.CreateGlobalInitOrDestructFunction( FTy, ".__kmpc_global_dtor_.", FI, Loc); + auto NL = ApplyDebugLocation::CreateEmpty(DtorCGF); DtorCGF.StartFunction(GlobalDecl(), CGM.getContext().VoidTy, Fn, FI, Args, SourceLocation()); + // Create a scope with an artificial location for the body of this function. + auto AL = ApplyDebugLocation::CreateArtificial(DtorCGF); auto ArgVal = DtorCGF.EmitLoadOfScalar( DtorCGF.GetAddrOfLocalVar(&Dst), /*Volatile=*/false, CGM.getContext().VoidPtrTy, Dst.getLocation()); Modified: cfe/trunk/test/OpenMP/threadprivate_codegen.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/threadprivate_codegen.cpp?rev=267369&r1=267368&r2=267369&view=diff == --- cfe/trunk/test/OpenMP/threadprivate_codegen.cpp (original) +++ cfe/trunk/test/OpenMP/threadprivate_codegen.cpp Sun Apr 24 17:22:29 2016 @@ -221,7 +221,7 @@ static S1 gs1(5); // CHECK-DEBUG: store i8* %0, i8** [[ARG_ADDR:%.*]], // CHECK-DEBUG: [[ARG:%.+]] = load i8*, i8** [[ARG_ADDR]] // CHECK-DEBUG: [[RES:%.*]] = bitcast i8* [[ARG]] to [[S1]]* -// CHECK-DEBUG-NEXT: call {{.*}} [[S1_CTOR:@.+]]([[S1]]* [[RES]], {{.*}} 5) +// CHECK-DEBUG-NEXT: call {{.*}} [[S1_CTOR:@.+]]([[S1]]* [[RES]], {{.*}} 5){{.*}}, !dbg // CHECK-DEBUG: [[ARG:%.+]] = load i8*, i8** [[ARG_ADDR]] // CHECK-DEBUG: ret i8* [[ARG]] // CHECK-DEBUG-NEXT: } @@ -230,7 +230,7 @@ static S1 gs1(5); // CHECK-DEBUG: store i8* %0, i8** [[ARG_ADDR:%.*]], // CHECK-DEBUG: [[ARG:%.+]] = load i8*, i8** [[ARG_ADDR]] // CHECK-DEBUG: [[RES:%.*]] = bitcast i8* [[ARG]] to [[S1]]* -// CHECK-DEBUG-NEXT: call {{.*}} [[S1_DTOR:@.+]]([[S1]]* [[RES]]) +// CHECK-DEBUG-NEXT: call {{.*}} [[S1_DTOR:@.+]]([[S1]]* [[RES]]){{.*}}, !dbg // CHECK-DEBUG-NEXT: ret void // CHECK-DEBUG-NEXT: } // CHECK-DEBUG: define {{.*}} [[S1_DTOR]]([[S1]]* {{.*}}) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r267380 - [Clang][AVX512][BuiltIn] Adding support to intrinsics of VPERMD and VPERMW instruction set
Author: mzuckerm Date: Mon Apr 25 00:32:35 2016 New Revision: 267380 URL: http://llvm.org/viewvc/llvm-project?rev=267380&view=rev Log: [Clang][AVX512][BuiltIn] Adding support to intrinsics of VPERMD and VPERMW instruction set Differential Revision: http://reviews.llvm.org/D19195 Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def cfe/trunk/lib/Headers/avx512bwintrin.h cfe/trunk/lib/Headers/avx512fintrin.h cfe/trunk/lib/Headers/avx512vbmiintrin.h cfe/trunk/lib/Headers/avx512vbmivlintrin.h cfe/trunk/lib/Headers/avx512vlbwintrin.h cfe/trunk/lib/Headers/avx512vlintrin.h cfe/trunk/test/CodeGen/avx512bw-builtins.c cfe/trunk/test/CodeGen/avx512f-builtins.c cfe/trunk/test/CodeGen/avx512vbmi-builtins.c cfe/trunk/test/CodeGen/avx512vbmivl-builtin.c cfe/trunk/test/CodeGen/avx512vl-builtins.c cfe/trunk/test/CodeGen/avx512vlbw-builtins.c Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=267380&r1=267379&r2=267380&view=diff == --- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original) +++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Mon Apr 25 00:32:35 2016 @@ -2151,6 +2151,24 @@ TARGET_BUILTIN(__builtin_ia32_vfmaddss3_ TARGET_BUILTIN(__builtin_ia32_vfmaddsd3_mask, "V2dV2dV2dV2dUcIi", "", "avx512f") TARGET_BUILTIN(__builtin_ia32_vfmaddsd3_maskz, "V2dV2dV2dV2dUcIi", "", "avx512f") TARGET_BUILTIN(__builtin_ia32_vfmaddsd3_mask3, "V2dV2dV2dV2dUcIi", "", "avx512f") +TARGET_BUILTIN(__builtin_ia32_permdf512_mask, "V8dV8dUcV8dUc","","avx512f") +TARGET_BUILTIN(__builtin_ia32_permdi512_mask, "V8LLiV8LLiUcV8LLiUc","","avx512f") +TARGET_BUILTIN(__builtin_ia32_permdf256_mask, "V4dV4dUcV4dUc","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_permdi256_mask, "V4LLiV4LLiUcV4LLiUc","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_permvarhi512_mask, "V32sV32sV32sV32sUi","","avx512bw") +TARGET_BUILTIN(__builtin_ia32_permvardf512_mask, "V8dV8dV8LLiV8dUc","","avx512f") +TARGET_BUILTIN(__builtin_ia32_permvardi512_mask, "V8LLiV8LLiV8LLiV8LLiUc","","avx512f") +TARGET_BUILTIN(__builtin_ia32_permvarsf512_mask, "V16fV16fV16iV16fUs","","avx512f") +TARGET_BUILTIN(__builtin_ia32_permvarsi512_mask, "V16iV16iV16iV16iUs","","avx512f") +TARGET_BUILTIN(__builtin_ia32_permvarqi512_mask, "V64cV64cV64cV64cULLi","","avx512vbmi") +TARGET_BUILTIN(__builtin_ia32_permvarqi128_mask, "V16cV16cV16cV16cUs","","avx512vbmi,avx512vl") +TARGET_BUILTIN(__builtin_ia32_permvarqi256_mask, "V32cV32cV32cV32cUi","","avx512vbmi,avx512vl") +TARGET_BUILTIN(__builtin_ia32_permvarhi128_mask, "V8sV8sV8sV8sUc","","avx512bw,avx512vl") +TARGET_BUILTIN(__builtin_ia32_permvarhi256_mask, "V16sV16sV16sV16sUs","","avx512bw,avx512vl") +TARGET_BUILTIN(__builtin_ia32_permvardf256_mask, "V4dV4dV4LLiV4dUc","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_permvardi256_mask, "V4LLiV4LLiV4LLiV4LLiUc","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_permvarsf256_mask, "V8fV8fV8iV8fUc","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_permvarsi256_mask, "V8iV8iV8iV8iUc","","avx512vl") #undef BUILTIN #undef TARGET_BUILTIN Modified: cfe/trunk/lib/Headers/avx512bwintrin.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512bwintrin.h?rev=267380&r1=267379&r2=267380&view=diff == --- cfe/trunk/lib/Headers/avx512bwintrin.h (original) +++ cfe/trunk/lib/Headers/avx512bwintrin.h Mon Apr 25 00:32:35 2016 @@ -2139,6 +2139,35 @@ _mm512_maskz_broadcastw_epi16 (__mmask32 __M); } +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_permutexvar_epi16 (__m512i __A, __m512i __B) +{ + return (__m512i) __builtin_ia32_permvarhi512_mask ((__v32hi) __B, + (__v32hi) __A, + (__v32hi) _mm512_undefined_epi32 (), + (__mmask32) -1); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_maskz_permutexvar_epi16 (__mmask32 __M, __m512i __A, +__m512i __B) +{ + return (__m512i) __builtin_ia32_permvarhi512_mask ((__v32hi) __B, + (__v32hi) __A, + (__v32hi) _mm512_setzero_hi(), + (__mmask32) __M); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_mask_permutexvar_epi16 (__m512i __W, __mmask32 __M, __m512i __A, + __m512i __B) +{ + return (__m512i) __builtin_ia32_permvarhi512_mask ((__v32hi) __B, + (__v32hi) __A, + (__v32hi) __W, + (__mmask32) __M); +} + #undef __DEFAULT_FN_ATTRS #endif Modified: cfe/trunk/lib/Headers/avx512fintrin.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=267380&r1=267379&r2=267380&view=diff == --- cfe/trunk/lib/Headers/avx512fintrin.h (original) +++ cfe/trunk/