Re: [PATCH] D14872: PR25575: Make GCC 4.4+ comatible layout for packed bit-fileds of char type
hfinkel added a subscriber: hfinkel. hfinkel added a comment. Please upload this patch with full context, see: http://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface > Should we add warning about changes in layout for packed bit-fileds of char > type? GCC has it "note: offset of packed bit-field ‘b’ has changed in GCC > 4.4" will add if needed. Warning about this is a good idea. We did something similar when we (re-)introduced sync_fetch_and_nand, see: def warn_sync_fetch_and_nand_semantics_change : Warning< "the semantics of this intrinsic changed with GCC " "version 4.4 - the newer semantics are provided here">, InGroup>; http://reviews.llvm.org/D14872 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r253958 - Reduce the stack usage per recursive step when RecursiveASTVisitor cannot perform data recursion.
On Tue, Nov 24, 2015 at 1:16 PM, Alexey Samsonovwrote: > Looks like Clang::Index/index-many-call-ops.cpp still uses too much stack > in ASan mode: > > http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/10177/steps/check-clang%20asan/logs/stdio > > ASan increases the stack usage, so do you think there's more to fix here, > or we should just disable the test under ASan? > I think this should work even under ASan conditions; fixed in r254041. > On Mon, Nov 23, 2015 at 11:13 PM, Richard Smith via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> Author: rsmith >> Date: Tue Nov 24 01:13:06 2015 >> New Revision: 253958 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=253958=rev >> Log: >> Reduce the stack usage per recursive step when RecursiveASTVisitor cannot >> perform data recursion. >> >> Modified: >> cfe/trunk/include/clang/AST/RecursiveASTVisitor.h >> >> Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=253958=253957=253958=diff >> >> == >> --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original) >> +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Tue Nov 24 01:13:06 >> 2015 >> @@ -471,28 +471,10 @@ private: >>/// \brief Process clauses with list of variables. >>template bool VisitOMPClauseList(T *Node); >> >> - bool dataTraverse(Stmt *S); >>bool dataTraverseNode(Stmt *S, DataRecursionQueue *Queue); >> }; >> >> template >> -bool RecursiveASTVisitor::dataTraverse(Stmt *S) { >> - SmallVector Queue; >> - Queue.push_back(S); >> - >> - while (!Queue.empty()) { >> -Stmt *CurrS = Queue.pop_back_val(); >> - >> -size_t N = Queue.size(); >> -TRY_TO(dataTraverseNode(CurrS, )); >> -// Process new children in the order they were added. >> -std::reverse(Queue.begin() + N, Queue.end()); >> - } >> - >> - return true; >> -} >> - >> -template >> bool RecursiveASTVisitor::dataTraverseNode(Stmt *S, >> DataRecursionQueue >> *Queue) { >> #define DISPATCH_STMT(NAME, CLASS, VAR) >> \ >> @@ -561,10 +543,23 @@ bool RecursiveASTVisitor::Trave >>::TraverseStmt>::value) >> return dataTraverseNode(S, nullptr); >> >> - if (!Queue) >> -return dataTraverse(S); >> + if (Queue) { >> +Queue->push_back(S); >> +return true; >> + } >> + >> + SmallVector LocalQueue; >> + LocalQueue.push_back(S); >> + >> + while (!LocalQueue.empty()) { >> +Stmt *CurrS = LocalQueue.pop_back_val(); >> + >> +size_t N = LocalQueue.size(); >> +TRY_TO(dataTraverseNode(CurrS, )); >> +// Process new children in the order they were added. >> +std::reverse(LocalQueue.begin() + N, LocalQueue.end()); >> + } >> >> - Queue->push_back(S); >>return true; >> } >> >> >> >> ___ >> cfe-commits mailing list >> cfe-commits@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >> > > > > -- > Alexey Samsonov > vonos...@gmail.com > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r254030 - Remove undefined behavior from tests; specifically, ensure that the value type of the allocators match the value type of the containers
Author: marshall Date: Tue Nov 24 16:10:51 2015 New Revision: 254030 URL: http://llvm.org/viewvc/llvm-project?rev=254030=rev Log: Remove undefined behavior from tests; specifically, ensure that the value type of the allocators match the value type of the containers Modified: libcxx/trunk/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp Modified: libcxx/trunk/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp?rev=254030=254029=254030=diff == --- libcxx/trunk/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp (original) +++ libcxx/trunk/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp Tue Nov 24 16:10:51 2015 @@ -38,7 +38,7 @@ int main() assert(m.size() == 2); } { -typedef std::pairV; +typedef std::pair V; std::map m; assert(m.size() == 0); assert(m[1] == 0.0); Modified: libcxx/trunk/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp?rev=254030=254029=254030=diff == --- libcxx/trunk/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp (original) +++ libcxx/trunk/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp Tue Nov 24 16:10:51 2015 @@ -33,16 +33,17 @@ struct some_comp int main() { #if __has_feature(cxx_noexcept) +typedef std::pair V; { typedef std::map C; static_assert(std::is_nothrow_default_constructible::value, ""); } { -typedef std::map C; +typedef std::map C; static_assert(std::is_nothrow_default_constructible::value, ""); } { -typedef std::map C; +typedef std::map C; static_assert(!std::is_nothrow_default_constructible::value, ""); } { Modified: libcxx/trunk/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp?rev=254030=254029=254030=diff == --- libcxx/trunk/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp (original) +++ libcxx/trunk/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp Tue Nov 24 16:10:51 2015 @@ -31,16 +31,17 @@ struct some_comp int main() { #if __has_feature(cxx_noexcept) +typedef std::pair V; { typedef std::map C; static_assert(std::is_nothrow_destructible::value, ""); } { -typedef std::map C; +typedef std::map C; static_assert(std::is_nothrow_destructible::value, ""); } { -typedef std::map C; +typedef std::map C; static_assert(std::is_nothrow_destructible::value, ""); } { Modified:
Re: r253958 - Reduce the stack usage per recursive step when RecursiveASTVisitor cannot perform data recursion.
Unfortunately, that change breaks the Clang compilation, see r254041 review thread. On Tue, Nov 24, 2015 at 3:54 PM, Richard Smithwrote: > On Tue, Nov 24, 2015 at 1:16 PM, Alexey Samsonov > wrote: > >> Looks like Clang::Index/index-many-call-ops.cpp still uses too much stack >> in ASan mode: >> >> http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/10177/steps/check-clang%20asan/logs/stdio >> >> ASan increases the stack usage, so do you think there's more to fix here, >> or we should just disable the test under ASan? >> > > I think this should work even under ASan conditions; fixed in r254041. > > >> On Mon, Nov 23, 2015 at 11:13 PM, Richard Smith via cfe-commits < >> cfe-commits@lists.llvm.org> wrote: >> >>> Author: rsmith >>> Date: Tue Nov 24 01:13:06 2015 >>> New Revision: 253958 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=253958=rev >>> Log: >>> Reduce the stack usage per recursive step when RecursiveASTVisitor >>> cannot perform data recursion. >>> >>> Modified: >>> cfe/trunk/include/clang/AST/RecursiveASTVisitor.h >>> >>> Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h >>> URL: >>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=253958=253957=253958=diff >>> >>> == >>> --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original) >>> +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Tue Nov 24 >>> 01:13:06 2015 >>> @@ -471,28 +471,10 @@ private: >>>/// \brief Process clauses with list of variables. >>>template bool VisitOMPClauseList(T *Node); >>> >>> - bool dataTraverse(Stmt *S); >>>bool dataTraverseNode(Stmt *S, DataRecursionQueue *Queue); >>> }; >>> >>> template >>> -bool RecursiveASTVisitor::dataTraverse(Stmt *S) { >>> - SmallVector Queue; >>> - Queue.push_back(S); >>> - >>> - while (!Queue.empty()) { >>> -Stmt *CurrS = Queue.pop_back_val(); >>> - >>> -size_t N = Queue.size(); >>> -TRY_TO(dataTraverseNode(CurrS, )); >>> -// Process new children in the order they were added. >>> -std::reverse(Queue.begin() + N, Queue.end()); >>> - } >>> - >>> - return true; >>> -} >>> - >>> -template >>> bool RecursiveASTVisitor::dataTraverseNode(Stmt *S, >>> DataRecursionQueue >>> *Queue) { >>> #define DISPATCH_STMT(NAME, CLASS, VAR) >>> \ >>> @@ -561,10 +543,23 @@ bool RecursiveASTVisitor::Trave >>> >>> ::TraverseStmt>::value) >>> return dataTraverseNode(S, nullptr); >>> >>> - if (!Queue) >>> -return dataTraverse(S); >>> + if (Queue) { >>> +Queue->push_back(S); >>> +return true; >>> + } >>> + >>> + SmallVector LocalQueue; >>> + LocalQueue.push_back(S); >>> + >>> + while (!LocalQueue.empty()) { >>> +Stmt *CurrS = LocalQueue.pop_back_val(); >>> + >>> +size_t N = LocalQueue.size(); >>> +TRY_TO(dataTraverseNode(CurrS, )); >>> +// Process new children in the order they were added. >>> +std::reverse(LocalQueue.begin() + N, LocalQueue.end()); >>> + } >>> >>> - Queue->push_back(S); >>>return true; >>> } >>> >>> >>> >>> ___ >>> cfe-commits mailing list >>> cfe-commits@lists.llvm.org >>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >>> >> >> >> >> -- >> Alexey Samsonov >> vonos...@gmail.com >> > > -- Alexey Samsonov vonos...@gmail.com ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r254050 - Silence a -Wmissing-braces warning in the tests; mbstate_t is defined differently on different C libraries.
Could this initialization just be written as "mbstate_t mb = {}" & avoid the warning entirely (I'm not entirely sure what the warning was, but I imagine that'd avoid it) On Tue, Nov 24, 2015 at 5:06 PM, Marshall Clow via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: marshall > Date: Tue Nov 24 19:06:36 2015 > New Revision: 254050 > > URL: http://llvm.org/viewvc/llvm-project?rev=254050=rev > Log: > Silence a -Wmissing-braces warning in the tests; mbstate_t is defined > differently on different C libraries. > > Modified: > libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp > > Modified: libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp?rev=254050=254049=254050=diff > > == > --- libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp (original) > +++ libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp Tue Nov 24 > 19:06:36 2015 > @@ -31,7 +31,15 @@ > > int main() > { > +// mbstate_t comes from the underlying C library; it is defined (in C99) > as: > +//a complete object type other than an array type that can hold the > conversion > +//state information necessary to convert between sequences of > multibyte > +//characters and wide characters > +#pragma clang diagnostic push > +#pragma clang diagnostic ignored "-Wmissing-braces" > mbstate_t mb = {0}; > +#pragma clang diagnostic pop > + > size_t s = 0; > tm *tm = 0; > wint_t w = 0; > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r254053 - Fix typo that was being SFINAE'd away (and apparently GCC 4.7.2 rejects-valid on this).
Author: rsmith Date: Tue Nov 24 20:41:42 2015 New Revision: 254053 URL: http://llvm.org/viewvc/llvm-project?rev=254053=rev Log: Fix typo that was being SFINAE'd away (and apparently GCC 4.7.2 rejects-valid on this). Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=254053=254052=254053=diff == --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original) +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Tue Nov 24 20:41:42 2015 @@ -291,10 +291,10 @@ private: // class can take a queue, so if we're taking the second arm, make the first // arm call our function rather than the derived class version. #define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE) \ - (decltype(callableWithQueue(::Traverse##NAME))::value \ + (decltype(callableWithQueue(::Traverse##NAME))::value \ ? static_cast(::Traverse##NAME))::value, \ + callableWithQueue(::Traverse##NAME))::value, \ Derived &, RecursiveASTVisitor &>::type>(*this) \ .Traverse##NAME(static_cast(VAR), QUEUE) \ : getDerived().Traverse##NAME(static_cast(VAR))) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r254041 - Teach RAV to pass its DataRecursionQueue to derived classes if they ask for it,
Hah, looks like a rejects-valid, but it found a real bug, so *shrug*. =) Hopefully fixed in r254053. On Tue, Nov 24, 2015 at 5:14 PM, Alexey Samsonovwrote: > Hm, looks like we can't compile Clang itself after this change (with GCC): > > > http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/12237 > > On Tue, Nov 24, 2015 at 3:50 PM, Richard Smith via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> Author: rsmith >> Date: Tue Nov 24 17:50:47 2015 >> New Revision: 254041 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=254041=rev >> Log: >> Teach RAV to pass its DataRecursionQueue to derived classes if they ask >> for it, >> to allow them to explicitly opt into data recursion despite having >> overridden >> Traverse*Stmt or Traverse*Expr. Use this to reintroduce data recursion to >> the >> one place that lost it when DataRecursiveASTVisitor was removed. >> >> Modified: >> cfe/trunk/include/clang/AST/RecursiveASTVisitor.h >> cfe/trunk/tools/libclang/IndexBody.cpp >> >> Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=254041=254040=254041=diff >> >> == >> --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original) >> +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Tue Nov 24 17:50:47 >> 2015 >> @@ -14,6 +14,8 @@ >> #ifndef LLVM_CLANG_AST_RECURSIVEASTVISITOR_H >> #define LLVM_CLANG_AST_RECURSIVEASTVISITOR_H >> >> +#include >> + >> #include "clang/AST/Attr.h" >> #include "clang/AST/Decl.h" >> #include "clang/AST/DeclCXX.h" >> @@ -132,13 +134,13 @@ namespace clang { >> /// instantiations will be visited at the same time as the pattern >> /// from which they were produced. >> template class RecursiveASTVisitor { >> +public: >>/// A queue used for performing data recursion over statements. >>/// Parameters involving this type are used to implement data >>/// recursion over Stmts and Exprs within this class, and should >> - /// not be explicitly specified by derived classes. >> + /// typically not be explicitly specified by derived classes. >>typedef SmallVectorImpl DataRecursionQueue; >> >> -public: >>/// \brief Return a reference to the derived class. >>Derived () { return *static_cast(this); } >> >> @@ -274,24 +276,32 @@ public: >> // Methods on Stmts >> >> private: >> - template >> - struct is_same_member_pointer : std::false_type {}; >> - template >> - struct is_same_member_pointer : std::true_type {}; >> - >> - // Traverse the given statement. If the traverse function was not >> overridden, >> - // pass on the data recursion queue information. >> + // Determine if the specified derived-class member M can be passed a >> + // DataRecursionQueue* argument. >> + template >> + std::false_type callableWithQueue(...); >> + template >> + std::true_type callableWithQueue(M m, Derived *d = nullptr, P *p = >> nullptr, >> + DataRecursionQueue *q = nullptr, >> + decltype((d->*m)(p, q)) = false); >> + >> + // Traverse the given statement. If the most-derived traverse function >> takes a >> + // data recursion queue, pass it on; otherwise, discard it. Note that >> the >> + // first branch of this conditional must compile whether or not the >> derived >> + // class can take a queue, so if we're taking the second arm, make the >> first >> + // arm call our function rather than the derived class version. >> #define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE) >> \ >> - (is_same_member_pointer > \ >> - ::Traverse##NAME, >> \ >> - >> decltype(::Traverse##NAME), \ >> - ::Traverse##NAME>::value >>\ >> - ? this->Traverse##NAME(static_cast(VAR), QUEUE) >> \ >> + (decltype(callableWithQueue> *>(::Traverse##NAME))::value \ >> + ? static_cast> \ >> + decltype( >>\ >> + callableWithQueue> *>(::Traverse##NAME))::value, \ >> + Derived &, RecursiveASTVisitor &>::type>(*this) >>\ >> + .Traverse##NAME(static_cast(VAR), QUEUE) >>\ >> : getDerived().Traverse##NAME(static_cast(VAR))) >> >> - // Try to traverse the given statement, or enqueue it if we're >> performing data >> - // recursion in the middle of traversing another statement. Can only >> be called >> - // from within a DEF_TRAVERSE_STMT body or similar context. >> +// Try to traverse the given statement, or enqueue it if we're >> performing data >> +// recursion in the middle of traversing another statement. Can only be >> called >> +// from within a DEF_TRAVERSE_STMT body or similar context. >> #define TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S) >>\ >>do {
Re: r254053 - Fix typo that was being SFINAE'd away (and apparently GCC 4.7.2 rejects-valid on this).
Possible to test (unit test?) the bug that GCC accidentally found here? On Tue, Nov 24, 2015 at 6:41 PM, Richard Smith via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: rsmith > Date: Tue Nov 24 20:41:42 2015 > New Revision: 254053 > > URL: http://llvm.org/viewvc/llvm-project?rev=254053=rev > Log: > Fix typo that was being SFINAE'd away (and apparently GCC 4.7.2 > rejects-valid on this). > > Modified: > cfe/trunk/include/clang/AST/RecursiveASTVisitor.h > > Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=254053=254052=254053=diff > > == > --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original) > +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Tue Nov 24 20:41:42 > 2015 > @@ -291,10 +291,10 @@ private: >// class can take a queue, so if we're taking the second arm, make the > first >// arm call our function rather than the derived class version. > #define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE) > \ > - (decltype(callableWithQueue(::Traverse##NAME))::value > \ > + (decltype(callableWithQueue(::Traverse##NAME))::value > \ > ? static_cast \ > decltype( > \ > - callableWithQueue *>(::Traverse##NAME))::value, \ > + > callableWithQueue(::Traverse##NAME))::value, \ > Derived &, RecursiveASTVisitor &>::type>(*this) > \ > .Traverse##NAME(static_cast(VAR), QUEUE) > \ > : getDerived().Traverse##NAME(static_cast(VAR))) > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D13336: [MSVC] 'property' with an empty array in array subscript expression.
rjmccall added a comment. This looks fantastic, thanks for doing all that. Approved with the one minor change. Comment at: lib/Sema/SemaPseudoObject.cpp:175 @@ -145,1 +174,3 @@ +PSE->getType(), PSE->getValueKind(), PSE->getObjectKind(), +PSE->getRBracketLoc()); } One extremely minor tweak: could you organize this like the rest of the pseudo-object expressions, checking for it above and calling a method to rebuild it? http://reviews.llvm.org/D13336 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D14864: [X86] Support for C calling convention only for MCU target.
rjmccall added a comment. LGTM. http://reviews.llvm.org/D14864 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface
kfunk accepted this revision. kfunk added a comment. Looks good to me now. I'd also appreciate another +1 from somone else, though. http://reviews.llvm.org/D10833 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D10802: [mips] Interrupt attribute support.
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. LGTM, once one minor nit is fixed. Thank you for working on this! Comment at: include/clang/Basic/DiagnosticSemaKinds.td:257 @@ +256,3 @@ + "MIPS 'interrupt' attribute only applies to functions that have " + "%select{no parameters|a \'void\' return type}0">, + InGroup; Spurious \' around 'void' http://reviews.llvm.org/D10802 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r253958 - Reduce the stack usage per recursive step when RecursiveASTVisitor cannot perform data recursion.
Looks like Clang::Index/index-many-call-ops.cpp still uses too much stack in ASan mode: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/10177/steps/check-clang%20asan/logs/stdio ASan increases the stack usage, so do you think there's more to fix here, or we should just disable the test under ASan? On Mon, Nov 23, 2015 at 11:13 PM, Richard Smith via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: rsmith > Date: Tue Nov 24 01:13:06 2015 > New Revision: 253958 > > URL: http://llvm.org/viewvc/llvm-project?rev=253958=rev > Log: > Reduce the stack usage per recursive step when RecursiveASTVisitor cannot > perform data recursion. > > Modified: > cfe/trunk/include/clang/AST/RecursiveASTVisitor.h > > Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=253958=253957=253958=diff > > == > --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original) > +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Tue Nov 24 01:13:06 > 2015 > @@ -471,28 +471,10 @@ private: >/// \brief Process clauses with list of variables. >template bool VisitOMPClauseList(T *Node); > > - bool dataTraverse(Stmt *S); >bool dataTraverseNode(Stmt *S, DataRecursionQueue *Queue); > }; > > template > -bool RecursiveASTVisitor::dataTraverse(Stmt *S) { > - SmallVectorQueue; > - Queue.push_back(S); > - > - while (!Queue.empty()) { > -Stmt *CurrS = Queue.pop_back_val(); > - > -size_t N = Queue.size(); > -TRY_TO(dataTraverseNode(CurrS, )); > -// Process new children in the order they were added. > -std::reverse(Queue.begin() + N, Queue.end()); > - } > - > - return true; > -} > - > -template > bool RecursiveASTVisitor::dataTraverseNode(Stmt *S, > DataRecursionQueue > *Queue) { > #define DISPATCH_STMT(NAME, CLASS, VAR) > \ > @@ -561,10 +543,23 @@ bool RecursiveASTVisitor::Trave >::TraverseStmt>::value) > return dataTraverseNode(S, nullptr); > > - if (!Queue) > -return dataTraverse(S); > + if (Queue) { > +Queue->push_back(S); > +return true; > + } > + > + SmallVector LocalQueue; > + LocalQueue.push_back(S); > + > + while (!LocalQueue.empty()) { > +Stmt *CurrS = LocalQueue.pop_back_val(); > + > +size_t N = LocalQueue.size(); > +TRY_TO(dataTraverseNode(CurrS, )); > +// Process new children in the order they were added. > +std::reverse(LocalQueue.begin() + N, LocalQueue.end()); > + } > > - Queue->push_back(S); >return true; > } > > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > -- Alexey Samsonov vonos...@gmail.com ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D14506: Porting shouldVisitImplicitCode to DataRecursiveASTVisitor.
bcraig abandoned this revision. bcraig added a comment. Largely supplanted by r253958 http://reviews.llvm.org/D14506 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D14964: [clang-tidy] Fix problem with parallel configure build
Eugene.Zelenko created this revision. Eugene.Zelenko added reviewers: alexfh, probinson. Eugene.Zelenko added a subscriber: cfe-commits. Eugene.Zelenko set the repository for this revision to rL LLVM. This fix should solve problem with parallel configure build introduced in D12700 as suggested by Paul. Was OK on RHEL 6 with -j 4. Repository: rL LLVM http://reviews.llvm.org/D14964 Files: clang-tidy/tool/Makefile Index: clang-tidy/tool/Makefile === --- clang-tidy/tool/Makefile +++ clang-tidy/tool/Makefile @@ -39,10 +39,10 @@ $(Echo) Making install directory: $@ $(Verb) $(MKDIR) $@ -$(DESTFILES): $(SRCFILES) +$(DESTFILES): $(SRCFILES) $(PROJ_sharedir) $(PROJ_sharedir)/%.py: $(PROJ_SRC_DIR)/%.py $(Echo) Installing script file: $(notdir $<) $(Verb) $(ScriptInstall) $< $(PROJ_sharedir) -install-local:: $(PROJ_sharedir) $(DESTFILES) +install-local:: $(DESTFILES) Index: clang-tidy/tool/Makefile === --- clang-tidy/tool/Makefile +++ clang-tidy/tool/Makefile @@ -39,10 +39,10 @@ $(Echo) Making install directory: $@ $(Verb) $(MKDIR) $@ -$(DESTFILES): $(SRCFILES) +$(DESTFILES): $(SRCFILES) $(PROJ_sharedir) $(PROJ_sharedir)/%.py: $(PROJ_SRC_DIR)/%.py $(Echo) Installing script file: $(notdir $<) $(Verb) $(ScriptInstall) $< $(PROJ_sharedir) -install-local:: $(PROJ_sharedir) $(DESTFILES) +install-local:: $(DESTFILES) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r254041 - Teach RAV to pass its DataRecursionQueue to derived classes if they ask for it,
Unfortunately, the bot still seems to be unhappy: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/12246/steps/build%20fresh%20clang/logs/stdio On Tue, Nov 24, 2015 at 6:45 PM, Richard Smithwrote: > Hah, looks like a rejects-valid, but it found a real bug, so *shrug*. =) > Hopefully fixed in r254053. > > > On Tue, Nov 24, 2015 at 5:14 PM, Alexey Samsonov > wrote: > >> Hm, looks like we can't compile Clang itself after this change (with GCC): >> >> >> http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/12237 >> >> On Tue, Nov 24, 2015 at 3:50 PM, Richard Smith via cfe-commits < >> cfe-commits@lists.llvm.org> wrote: >> >>> Author: rsmith >>> Date: Tue Nov 24 17:50:47 2015 >>> New Revision: 254041 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=254041=rev >>> Log: >>> Teach RAV to pass its DataRecursionQueue to derived classes if they ask >>> for it, >>> to allow them to explicitly opt into data recursion despite having >>> overridden >>> Traverse*Stmt or Traverse*Expr. Use this to reintroduce data recursion >>> to the >>> one place that lost it when DataRecursiveASTVisitor was removed. >>> >>> Modified: >>> cfe/trunk/include/clang/AST/RecursiveASTVisitor.h >>> cfe/trunk/tools/libclang/IndexBody.cpp >>> >>> Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h >>> URL: >>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=254041=254040=254041=diff >>> >>> == >>> --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original) >>> +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Tue Nov 24 >>> 17:50:47 2015 >>> @@ -14,6 +14,8 @@ >>> #ifndef LLVM_CLANG_AST_RECURSIVEASTVISITOR_H >>> #define LLVM_CLANG_AST_RECURSIVEASTVISITOR_H >>> >>> +#include >>> + >>> #include "clang/AST/Attr.h" >>> #include "clang/AST/Decl.h" >>> #include "clang/AST/DeclCXX.h" >>> @@ -132,13 +134,13 @@ namespace clang { >>> /// instantiations will be visited at the same time as the pattern >>> /// from which they were produced. >>> template class RecursiveASTVisitor { >>> +public: >>>/// A queue used for performing data recursion over statements. >>>/// Parameters involving this type are used to implement data >>>/// recursion over Stmts and Exprs within this class, and should >>> - /// not be explicitly specified by derived classes. >>> + /// typically not be explicitly specified by derived classes. >>>typedef SmallVectorImpl DataRecursionQueue; >>> >>> -public: >>>/// \brief Return a reference to the derived class. >>>Derived () { return *static_cast(this); } >>> >>> @@ -274,24 +276,32 @@ public: >>> // Methods on Stmts >>> >>> private: >>> - template >>> - struct is_same_member_pointer : std::false_type {}; >>> - template >>> - struct is_same_member_pointer : std::true_type {}; >>> - >>> - // Traverse the given statement. If the traverse function was not >>> overridden, >>> - // pass on the data recursion queue information. >>> + // Determine if the specified derived-class member M can be passed a >>> + // DataRecursionQueue* argument. >>> + template >>> + std::false_type callableWithQueue(...); >>> + template >>> + std::true_type callableWithQueue(M m, Derived *d = nullptr, P *p = >>> nullptr, >>> + DataRecursionQueue *q = nullptr, >>> + decltype((d->*m)(p, q)) = false); >>> + >>> + // Traverse the given statement. If the most-derived traverse >>> function takes a >>> + // data recursion queue, pass it on; otherwise, discard it. Note that >>> the >>> + // first branch of this conditional must compile whether or not the >>> derived >>> + // class can take a queue, so if we're taking the second arm, make >>> the first >>> + // arm call our function rather than the derived class version. >>> #define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE) >>> \ >>> - (is_same_member_pointer >> \ >>> - ::Traverse##NAME, >>> \ >>> - >>> decltype(::Traverse##NAME), \ >>> - ::Traverse##NAME>::value >>>\ >>> - ? this->Traverse##NAME(static_cast(VAR), QUEUE) >>> \ >>> + (decltype(callableWithQueue>> *>(::Traverse##NAME))::value \ >>> + ? static_cast>> \ >>> + decltype( >>>\ >>> + callableWithQueue>> *>(::Traverse##NAME))::value, \ >>> + Derived &, RecursiveASTVisitor &>::type>(*this) >>>\ >>> + .Traverse##NAME(static_cast(VAR), QUEUE) >>>\ >>> : getDerived().Traverse##NAME(static_cast(VAR))) >>> >>> - // Try to traverse the given statement, or enqueue it if we're >>> performing data >>> - // recursion in the middle of traversing another statement. Can
Re: [PATCH] D12700: [clang-tidy] install helper scripts in CMake build
probinson added a comment. The problem is that making the install-local target will try to create the PROJ_sharedir directory in parallel with trying to copy DESTFILES to that directory. You need to set up the dependencies such that the directory is guaranteed to be created first. If you move the PROJ_sharedir dependency from the install-local target to the DESTFILES target that should solve it: $(DESTFILES): $(SRCFILES) $(PROJ_sharedir) ... install-local:: $(DESTFILES) Repository: rL LLVM http://reviews.llvm.org/D12700 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Lit Test C++11 compatibility patch #5
Hi Everyone, I am continuing with updating Lit tests to be C++11 compatible. Here is the fifth patch. This patch contains 20 tests. These are mostly diagnostics changes due to new C++11 features and changes in the standard. Here are the explanations for each test in the order that they appear in the patch. CXX/class/class.nest/p1.cpp Sizeof has been extended to apply to non-static data members without an object [n2253]. Restrict the following to C++98/03. error: invalid use of non-static data member 'x' Parser/cxx-casting.cpp Restrict Digraph errors to C++98/03. C++98 error: found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'? Parser/cxx-reference.cpp rvalue references is now support Restrict the following to C++98/03. C++98 Warning rvalue references are a C++11 extension Parser/cxx-template-argument.cpp Consecutive right angle brackets is no longer a syntax error in C++11 Restrict the following to C++98/03 C++98: error: a space is required between consecutive right angle brackets (use '> >') Parser/cxx-typeof.cpp Using __typeof to derive the type of a non-static data member was an Error in C++98/03. It is now accepted in in C++11. Note 1: I could not find GCC documentation on this change, but given C++11 has decltype now works on non-static data members, this appears logical. Note 2: This test uses GNU extension "typeof". Therefore the Runs line are expanded with -std=gnu++98 and "-std=gnu++11" instead of the usual "-std=c++98" and "-std=c++11" Parser/objc-init.m Added C++11 error and note diagnostics on narrowing conversion. Error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'int' in initializer list Note: insert an explicit cast to silence this issue *Please Note: Since this is an Objective-C test, the Run line has not been changed. Parser/objcxx-lambda-expressions-neg.mm []{}; is now an valid Lambda expression. Restrict "warning: expected expression" to C++98/03. SemaCXX/decl-expr-ambiguity.cpp Change in ambiguity diagnostics due to introduction of initializer list. C++11 has 1 extra Note following the pre-existing warning warning: empty parentheses interpreted as a function declaration [-Wvexing-parse] note: replace parentheses with an initializer to declare a variable *Note: The Run lines are left as-is because this test verifies for default diagnostic for "typeof" Diagnostics will change if I explicitly specify any dialect. Default (no -std= flag): error: extension used [-Werror,-Wlanguage-extension-token] C++ (-std=c++ flag): error: expected '(' for function-style cast or type construction GNU++ (-std=gnu++ flag): No diagnostic. SemaCXX/overload-call.cpp This change has 3 separate issues. First two are overload resolutions. Last one is C++98/03 specific diagnostic. 1. When the actual arg is a string literal and 2 candidate functions exist. One with formal argument "char *", the other with "bool" In C++98/03, Clang picks "char *" and issues a deprecated writable wring diagnostics. In C++11 , Clang uses picks the "bool" candidate and issues a return type miss match diagnostics. Default converstion from "const char *" to "bool" came from C++11 standard 4.12\1 [conv.bool] Reference: http://stackoverflow.com/questions/26413951/overloaded-bool-string-ambiguity The difference in diagnostics are as follows: C++98 (argument type mismatch): conversion from string literal to 'char *' is deprecated C++11 (return type mismatch): cannot initialize a variable of type 'int *' with an rvalue of type 'double *' 2. Similar to point 1. This time the 2 overloaded functions have formal args "char *" and "void *". In this case Clang picks "char *" but issues a slightly different error: C++98 warning: conversion from string literal to 'char *' is deprecated C++11 warning: ISO C++11 does not allow conversion from string literal to 'char *' 3. Restrict the following diagnostics to C++98/03 Warning: rvalue references are a C++11 extension Warning: deleted function definitions are a C++11 extension SemaCXX/pragma-init_seg.cpp In C++11 Clang issues an additional note follow pre-existing error. Add the following Note to C++11. Error: initializer for thread-local variable must be a constant expression Note: use 'thread_local' to allow this SemaCXX/typo-correction-delayed.cpp C++11 allows initializer list to be pass as actual arguments. Restrict the following to C++98 error: expected expression SemaCXX/unknown-type-name.cpp Restrict the following to C++98 Warning: deleted function definitions are a C++11 extension SemaCXX/writable-strings-deprecated.cpp Writable strings generates different
Re: [PATCH] D12031: Const std::move() argument ClangTidy check
dvadym added a comment. Thanks alexfh! I've addressed your comments and uploaded new patch. PTAL Comment at: clang-tidy/misc/MoveConstantArgumentCheck.cpp:56 @@ +55,3 @@ +<< IsConstArg << IsVariable << IsTriviallyCopyable +<< FixItHint::CreateRemoval(Lexer::makeFileCharRange( + CharSourceRange::getCharRange(CallMove->getLocStart(), alexfh wrote: > After some thinking, there may be cases where the range of the whole > expression can be translated to a file char range, but a sub-range of it > can't. So you need to check the validity of the results of both > `makeFileCharRange` calls in this expression before creating a fixit hint > with the resulting ranges. > > Also, it seems reasonable to issue a warning in any case, and fix-it hints > only when we are rather certain that we can apply them safely (which the > validity of all `makeFileCharRange` results should tell us about). I've changed: now BeforeArgumentsRange and AfterArgumentsRange are calculated if they are valid then Removal is created. But probably it's better to write a test when some of these ranges are valid, could you please advice when it can be? http://reviews.llvm.org/D12031 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12031: Const std::move() argument ClangTidy check
dvadym updated this revision to Diff 41061. dvadym marked 8 inline comments as done. dvadym added a comment. In this patch alexfh comments addressed http://reviews.llvm.org/D12031 Files: clang-tidy/misc/CMakeLists.txt clang-tidy/misc/MiscTidyModule.cpp clang-tidy/misc/MoveConstantArgumentCheck.cpp clang-tidy/misc/MoveConstantArgumentCheck.h test/clang-tidy/move-const-arg.cpp Index: test/clang-tidy/move-const-arg.cpp === --- test/clang-tidy/move-const-arg.cpp +++ test/clang-tidy/move-const-arg.cpp @@ -0,0 +1,73 @@ +// RUN: %check_clang_tidy %s misc-move-const-arg %t -- -- -std=c++11 + +namespace std { +template struct remove_reference; + +template struct remove_reference { typedef _Tp type; }; + +template struct remove_reference<_Tp &> { typedef _Tp type; }; + +template struct remove_reference<_Tp &&> { typedef _Tp type; }; + +template +constexpr typename std::remove_reference<_Tp>::type &(_Tp &&__t); + +} // namespace std + +class A { +public: + A() {} + A(const A ) {} + A(A &) {} +}; + +int f1() { + return std::move(42); + // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the expression of trivially-copyable type has no effect; remove std::move() [misc-move-const-arg] + // CHECK-FIXES: return 42; +} + +int f2(int x2) { + return std::move(x2); + // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the variable of trivially-copyable type + // CHECK-FIXES: return x2; +} + +int *f3(int *x3) { + return std::move(x3); + // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the variable of trivially-copyable type + // CHECK-FIXES: return x3; +} + +A f4(A x4) { return std::move(x4); } + +A f5(const A x5) { + return std::move(x5); + // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the const variable + // CHECK-FIXES: return x5; +} + +template T f6(const T x6) { return std::move(x6); } + +void f7() { int a = f6(10); } + +#define M1(x) x +void f8() { + const A a; + M1(A b = std::move(a);) + // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: std::move of the const variable + // CHECK-FIXES: M1(A b = a;) +} + +#define M2(x) std::move(x) +int f9() { return M2(1); } + +template T f10(const int x10) { + return std::move(x10); + // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the const variable + // CHECK-FIXES: return x10; +} +void f11() { + f10(1); + f10(1); +} Index: clang-tidy/misc/MoveConstantArgumentCheck.h === --- clang-tidy/misc/MoveConstantArgumentCheck.h +++ clang-tidy/misc/MoveConstantArgumentCheck.h @@ -0,0 +1,31 @@ +//===--- MoveConstandArgumentCheck.h - clang-tidy -===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MOVECONTANTARGUMENTCHECK_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MOVECONTANTARGUMENTCHECK_H + +#include "../ClangTidy.h" + +namespace clang { +namespace tidy { +namespace misc { + +class MoveConstantArgumentCheck : public ClangTidyCheck { +public: + MoveConstantArgumentCheck(StringRef Name, ClangTidyContext *Context) + : ClangTidyCheck(Name, Context) {} + void registerMatchers(ast_matchers::MatchFinder *Finder) override; + void check(const ast_matchers::MatchFinder::MatchResult ) override; +}; + +} // namespace misc +} // namespace tidy +} // namespace clang + +#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MOVECONTANTARGUMENTCHECK_H Index: clang-tidy/misc/MoveConstantArgumentCheck.cpp === --- clang-tidy/misc/MoveConstantArgumentCheck.cpp +++ clang-tidy/misc/MoveConstantArgumentCheck.cpp @@ -0,0 +1,72 @@ +//===--- MoveConstandArgumentCheck.cpp - clang-tidy ---===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "MoveConstantArgumentCheck.h" + +#include + +namespace clang { +namespace tidy { +namespace misc { + +using namespace ast_matchers; + +void MoveConstantArgumentCheck::registerMatchers(MatchFinder *Finder) { + if (!getLangOpts().CPlusPlus) +return; + Finder->addMatcher(callExpr(unless(isInTemplateInstantiation()), + callee(functionDecl(hasName("::std::move" + .bind("call-move"), + this); +} + +void MoveConstantArgumentCheck::check(const MatchFinder::MatchResult ) { + const auto *CallMove = Result.Nodes.getNodeAs("call-move"); + if (CallMove->getNumArgs() != 1) +return; + const Expr
Re: [PATCH] D14935: Fix rewrite of reserved library name in case of -nodefaultlibs
This revision was automatically updated to reflect the committed changes. Closed by commit rL253990: Fix rewrite of reserved library name in case of -nodefaultlibs (authored by niravd). Changed prior to commit: http://reviews.llvm.org/D14935?vs=41040=41052#toc Repository: rL LLVM http://reviews.llvm.org/D14935 Files: cfe/trunk/lib/Driver/Driver.cpp cfe/trunk/test/Driver/nodefaultlib.c Index: cfe/trunk/test/Driver/nodefaultlib.c === --- cfe/trunk/test/Driver/nodefaultlib.c +++ cfe/trunk/test/Driver/nodefaultlib.c @@ -1,8 +1,10 @@ -// RUN: %clang -target i686-pc-linux-gnu -### -nodefaultlibs %s 2> %t -// RUN: FileCheck < %t %s -// -// CHECK-NOT: start-group -// CHECK-NOT: "-lgcc" -// CHECK-NOT: "-lc" -// CHECK: crtbegin -// CHECK: crtend +// RUN: %clang -target i686-pc-linux-gnu -### -nodefaultlibs %s 2>&1 | FileCheck -check-prefix=TEST1 %s +// TEST1-NOT: start-group +// TEST1-NOT: "-lgcc" +// TEST1-NOT: "-lc" +// TEST1: crtbegin +// TEST1: crtend + +// RUN: %clang -target i686-pc-linux-gnu -stdlib=libc++ -nodefaultlibs -lstdc++ -### %s 2>&1 | FileCheck -check-prefix=TEST2 %s +// TEST2-NOT: "-lc++" +// TEST2: "-lstdc++" Index: cfe/trunk/lib/Driver/Driver.cpp === --- cfe/trunk/lib/Driver/Driver.cpp +++ cfe/trunk/lib/Driver/Driver.cpp @@ -209,6 +209,7 @@ DerivedArgList *DAL = new DerivedArgList(Args); bool HasNostdlib = Args.hasArg(options::OPT_nostdlib); + bool HasNodefaultlib = Args.hasArg(options::OPT_nodefaultlibs); for (Arg *A : Args) { // Unfortunately, we have to parse some forwarding options (-Xassembler, // -Xlinker, -Xpreprocessor) because we either integrate their functionality @@ -252,7 +253,7 @@ StringRef Value = A->getValue(); // Rewrite unless -nostdlib is present. - if (!HasNostdlib && Value == "stdc++") { + if (!HasNostdlib && !HasNodefaultlib && Value == "stdc++") { DAL->AddFlagArg(A, Opts->getOption(options::OPT_Z_reserved_lib_stdcxx)); continue; } Index: cfe/trunk/test/Driver/nodefaultlib.c === --- cfe/trunk/test/Driver/nodefaultlib.c +++ cfe/trunk/test/Driver/nodefaultlib.c @@ -1,8 +1,10 @@ -// RUN: %clang -target i686-pc-linux-gnu -### -nodefaultlibs %s 2> %t -// RUN: FileCheck < %t %s -// -// CHECK-NOT: start-group -// CHECK-NOT: "-lgcc" -// CHECK-NOT: "-lc" -// CHECK: crtbegin -// CHECK: crtend +// RUN: %clang -target i686-pc-linux-gnu -### -nodefaultlibs %s 2>&1 | FileCheck -check-prefix=TEST1 %s +// TEST1-NOT: start-group +// TEST1-NOT: "-lgcc" +// TEST1-NOT: "-lc" +// TEST1: crtbegin +// TEST1: crtend + +// RUN: %clang -target i686-pc-linux-gnu -stdlib=libc++ -nodefaultlibs -lstdc++ -### %s 2>&1 | FileCheck -check-prefix=TEST2 %s +// TEST2-NOT: "-lc++" +// TEST2: "-lstdc++" Index: cfe/trunk/lib/Driver/Driver.cpp === --- cfe/trunk/lib/Driver/Driver.cpp +++ cfe/trunk/lib/Driver/Driver.cpp @@ -209,6 +209,7 @@ DerivedArgList *DAL = new DerivedArgList(Args); bool HasNostdlib = Args.hasArg(options::OPT_nostdlib); + bool HasNodefaultlib = Args.hasArg(options::OPT_nodefaultlibs); for (Arg *A : Args) { // Unfortunately, we have to parse some forwarding options (-Xassembler, // -Xlinker, -Xpreprocessor) because we either integrate their functionality @@ -252,7 +253,7 @@ StringRef Value = A->getValue(); // Rewrite unless -nostdlib is present. - if (!HasNostdlib && Value == "stdc++") { + if (!HasNostdlib && !HasNodefaultlib && Value == "stdc++") { DAL->AddFlagArg(A, Opts->getOption(options::OPT_Z_reserved_lib_stdcxx)); continue; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r253990 - Fix rewrite of reserved library name in case of -nodefaultlibs
Author: niravd Date: Tue Nov 24 10:07:21 2015 New Revision: 253990 URL: http://llvm.org/viewvc/llvm-project?rev=253990=rev Log: Fix rewrite of reserved library name in case of -nodefaultlibs The Driver only checked if nostdlib was set when deciding to add reserved_lib_stdcxx, but as nostdlib is always exactly nodefaultlibs and nostartfiles we should be checking one (clearly nodefaultlibs in the case) as well. This appears to be the only such instance of this in the codebase. Differential Revision: http://reviews.llvm.org/D14935 Modified: cfe/trunk/lib/Driver/Driver.cpp cfe/trunk/test/Driver/nodefaultlib.c Modified: cfe/trunk/lib/Driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=253990=253989=253990=diff == --- cfe/trunk/lib/Driver/Driver.cpp (original) +++ cfe/trunk/lib/Driver/Driver.cpp Tue Nov 24 10:07:21 2015 @@ -209,6 +209,7 @@ DerivedArgList *Driver::TranslateInputAr DerivedArgList *DAL = new DerivedArgList(Args); bool HasNostdlib = Args.hasArg(options::OPT_nostdlib); + bool HasNodefaultlib = Args.hasArg(options::OPT_nodefaultlibs); for (Arg *A : Args) { // Unfortunately, we have to parse some forwarding options (-Xassembler, // -Xlinker, -Xpreprocessor) because we either integrate their functionality @@ -252,7 +253,7 @@ DerivedArgList *Driver::TranslateInputAr StringRef Value = A->getValue(); // Rewrite unless -nostdlib is present. - if (!HasNostdlib && Value == "stdc++") { + if (!HasNostdlib && !HasNodefaultlib && Value == "stdc++") { DAL->AddFlagArg(A, Opts->getOption(options::OPT_Z_reserved_lib_stdcxx)); continue; } Modified: cfe/trunk/test/Driver/nodefaultlib.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/nodefaultlib.c?rev=253990=253989=253990=diff == --- cfe/trunk/test/Driver/nodefaultlib.c (original) +++ cfe/trunk/test/Driver/nodefaultlib.c Tue Nov 24 10:07:21 2015 @@ -1,8 +1,10 @@ -// RUN: %clang -target i686-pc-linux-gnu -### -nodefaultlibs %s 2> %t -// RUN: FileCheck < %t %s -// -// CHECK-NOT: start-group -// CHECK-NOT: "-lgcc" -// CHECK-NOT: "-lc" -// CHECK: crtbegin -// CHECK: crtend +// RUN: %clang -target i686-pc-linux-gnu -### -nodefaultlibs %s 2>&1 | FileCheck -check-prefix=TEST1 %s +// TEST1-NOT: start-group +// TEST1-NOT: "-lgcc" +// TEST1-NOT: "-lc" +// TEST1: crtbegin +// TEST1: crtend + +// RUN: %clang -target i686-pc-linux-gnu -stdlib=libc++ -nodefaultlibs -lstdc++ -### %s 2>&1 | FileCheck -check-prefix=TEST2 %s +// TEST2-NOT: "-lc++" +// TEST2: "-lstdc++" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r254007 - [analyzer] Pass value expression for inlined defensive checks when binding null to nonnull.
Author: dcoughlin Date: Tue Nov 24 13:15:11 2015 New Revision: 254007 URL: http://llvm.org/viewvc/llvm-project?rev=254007=rev Log: [analyzer] Pass value expression for inlined defensive checks when binding null to nonnull. The nullability checker was not suppressing false positives resulting from inlined defensive checks when null was bound to a nonnull variable because it was passing the entire bind statement rather than the value expression to trackNullOrUndefValue(). This commit changes that checker to synactically match on the bind statement to extract the value expression so it can be passed to trackNullOrUndefValue(). rdar://problem/23575439 Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp cfe/trunk/test/Analysis/nullability.mm Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp?rev=254007=254006=254007=diff == --- cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp Tue Nov 24 13:15:11 2015 @@ -862,6 +862,30 @@ void NullabilityChecker::checkPostStmt(c } } +/// For a given statement performing a bind, attempt to syntactically +/// match the expression resulting in the bound value. +static const Expr * matchValueExprForBind(const Stmt *S) { + // For `x = e` the value expression is the right-hand side. + if (auto *BinOp = dyn_cast(S)) { +if (BinOp->getOpcode() == BO_Assign) + return BinOp->getRHS(); + } + + // For `int x = e` the value expression is the initializer. + if (auto *DS = dyn_cast(S)) { +if (DS->isSingleDecl()) { + auto *VD = dyn_cast(DS->getSingleDecl()); + if (!VD) +return nullptr; + + if (const Expr *Init = VD->getInit()) +return Init; +} + } + + return nullptr; +} + /// Propagate the nullability information through binds and warn when nullable /// pointer or null symbol is assigned to a pointer with a nonnull type. void NullabilityChecker::checkBind(SVal L, SVal V, const Stmt *S, @@ -898,8 +922,13 @@ void NullabilityChecker::checkBind(SVal ExplodedNode *N = C.generateErrorNode(State, ); if (!N) return; + +const Stmt *ValueExpr = matchValueExprForBind(S); +if (!ValueExpr) + ValueExpr = S; + reportBugIfPreconditionHolds(ErrorKind::NilAssignedToNonnull, N, nullptr, C, - S); + ValueExpr); return; } // Intentionally missing case: '0' is bound to a reference. It is handled by Modified: cfe/trunk/test/Analysis/nullability.mm URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/nullability.mm?rev=254007=254006=254007=diff == --- cfe/trunk/test/Analysis/nullability.mm (original) +++ cfe/trunk/test/Analysis/nullability.mm Tue Nov 24 13:15:11 2015 @@ -238,6 +238,19 @@ Dummy *_Nonnull testDefensiveInlineCheck case 3: inlinedUnspecified(p); break; } if (getRandom()) -takesNonnull(p); +takesNonnull(p); // no-warning + + if (getRandom()) { +Dummy *_Nonnull varWithInitializer = p; // no-warning + + Dummy *_Nonnull var1WithInitializer = p, // no-warning + *_Nonnull var2WithInitializer = p; // no-warning + } + + if (getRandom()) { +Dummy *_Nonnull varWithoutInitializer; +varWithoutInitializer = p; // no-warning + } + return p; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r254041 - Teach RAV to pass its DataRecursionQueue to derived classes if they ask for it,
Author: rsmith Date: Tue Nov 24 17:50:47 2015 New Revision: 254041 URL: http://llvm.org/viewvc/llvm-project?rev=254041=rev Log: Teach RAV to pass its DataRecursionQueue to derived classes if they ask for it, to allow them to explicitly opt into data recursion despite having overridden Traverse*Stmt or Traverse*Expr. Use this to reintroduce data recursion to the one place that lost it when DataRecursiveASTVisitor was removed. Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h cfe/trunk/tools/libclang/IndexBody.cpp Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=254041=254040=254041=diff == --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original) +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Tue Nov 24 17:50:47 2015 @@ -14,6 +14,8 @@ #ifndef LLVM_CLANG_AST_RECURSIVEASTVISITOR_H #define LLVM_CLANG_AST_RECURSIVEASTVISITOR_H +#include + #include "clang/AST/Attr.h" #include "clang/AST/Decl.h" #include "clang/AST/DeclCXX.h" @@ -132,13 +134,13 @@ namespace clang { /// instantiations will be visited at the same time as the pattern /// from which they were produced. template class RecursiveASTVisitor { +public: /// A queue used for performing data recursion over statements. /// Parameters involving this type are used to implement data /// recursion over Stmts and Exprs within this class, and should - /// not be explicitly specified by derived classes. + /// typically not be explicitly specified by derived classes. typedef SmallVectorImpl DataRecursionQueue; -public: /// \brief Return a reference to the derived class. Derived () { return *static_cast(this); } @@ -274,24 +276,32 @@ public: // Methods on Stmts private: - template - struct is_same_member_pointer : std::false_type {}; - template - struct is_same_member_pointer: std::true_type {}; - - // Traverse the given statement. If the traverse function was not overridden, - // pass on the data recursion queue information. + // Determine if the specified derived-class member M can be passed a + // DataRecursionQueue* argument. + template + std::false_type callableWithQueue(...); + template + std::true_type callableWithQueue(M m, Derived *d = nullptr, P *p = nullptr, + DataRecursionQueue *q = nullptr, + decltype((d->*m)(p, q)) = false); + + // Traverse the given statement. If the most-derived traverse function takes a + // data recursion queue, pass it on; otherwise, discard it. Note that the + // first branch of this conditional must compile whether or not the derived + // class can take a queue, so if we're taking the second arm, make the first + // arm call our function rather than the derived class version. #define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE) \ - (is_same_member_pointer ::value \ - ? this->Traverse##NAME(static_cast(VAR), QUEUE) \ + (decltype(callableWithQueue(::Traverse##NAME))::value \ + ? static_cast(::Traverse##NAME))::value, \ + Derived &, RecursiveASTVisitor &>::type>(*this) \ + .Traverse##NAME(static_cast(VAR), QUEUE) \ : getDerived().Traverse##NAME(static_cast(VAR))) - // Try to traverse the given statement, or enqueue it if we're performing data - // recursion in the middle of traversing another statement. Can only be called - // from within a DEF_TRAVERSE_STMT body or similar context. +// Try to traverse the given statement, or enqueue it if we're performing data +// recursion in the middle of traversing another statement. Can only be called +// from within a DEF_TRAVERSE_STMT body or similar context. #define TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S) \ do { \ if (!TRAVERSE_STMT_BASE(Stmt, Stmt, S, Queue)) \ @@ -535,14 +545,6 @@ bool RecursiveASTVisitor::Trave if (!S) return true; - // If TraverseStmt was overridden (and called the base class version), don't - // do any data recursion; it would be observable. - if (!is_same_member_pointer ::value) -return dataTraverseNode(S, nullptr); - if (Queue) { Queue->push_back(S); return true; Modified:
Re: [PATCH] D13336: [MSVC] 'property' with an empty array in array subscript expression.
ABataev updated this revision to Diff 41018. ABataev added a comment. Update after review http://reviews.llvm.org/D13336 Files: include/clang/AST/ExprCXX.h include/clang/AST/RecursiveASTVisitor.h include/clang/Basic/StmtNodes.td include/clang/Serialization/ASTBitCodes.h lib/AST/Expr.cpp lib/AST/ExprClassification.cpp lib/AST/ExprConstant.cpp lib/AST/ItaniumMangle.cpp lib/AST/StmtPrinter.cpp lib/AST/StmtProfile.cpp lib/Sema/SemaExceptionSpec.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaPseudoObject.cpp lib/Sema/TreeTransform.h lib/Serialization/ASTReaderStmt.cpp lib/Serialization/ASTWriterStmt.cpp lib/StaticAnalyzer/Core/ExprEngine.cpp test/CodeGenCXX/ms-property.cpp test/SemaCXX/ms-property-error.cpp test/SemaCXX/ms-property.cpp tools/libclang/CXCursor.cpp Index: lib/Serialization/ASTWriterStmt.cpp === --- lib/Serialization/ASTWriterStmt.cpp +++ lib/Serialization/ASTWriterStmt.cpp @@ -1689,6 +1689,14 @@ Code = serialization::EXPR_CXX_PROPERTY_REF_EXPR; } +void ASTStmtWriter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) { + VisitExpr(E); + Writer.AddStmt(E->getBase()); + Writer.AddStmt(E->getIdx()); + Writer.AddSourceLocation(E->getRBracketLoc(), Record); + Code = serialization::EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR; +} + void ASTStmtWriter::VisitCXXUuidofExpr(CXXUuidofExpr *E) { VisitExpr(E); Writer.AddSourceRange(E->getSourceRange(), Record); Index: lib/Serialization/ASTReaderStmt.cpp === --- lib/Serialization/ASTReaderStmt.cpp +++ lib/Serialization/ASTReaderStmt.cpp @@ -1662,6 +1662,13 @@ E->TheDecl = ReadDeclAs(Record, Idx); } +void ASTStmtReader::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) { + VisitExpr(E); + E->setBase(Reader.ReadSubExpr()); + E->setIdx(Reader.ReadSubExpr()); + E->setRBracketLoc(ReadSourceLocation(Record, Idx)); +} + void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) { VisitExpr(E); E->setSourceRange(ReadSourceRange(Record, Idx)); @@ -3078,6 +3085,9 @@ case EXPR_CXX_PROPERTY_REF_EXPR: S = new (Context) MSPropertyRefExpr(Empty); break; +case EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR: + S = new (Context) MSPropertySubscriptExpr(Empty); + break; case EXPR_CXX_UUIDOF_TYPE: S = new (Context) CXXUuidofExpr(Empty, false); break; Index: lib/StaticAnalyzer/Core/ExprEngine.cpp === --- lib/StaticAnalyzer/Core/ExprEngine.cpp +++ lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -755,6 +755,7 @@ case Stmt::CXXUuidofExprClass: case Stmt::CXXFoldExprClass: case Stmt::MSPropertyRefExprClass: +case Stmt::MSPropertySubscriptExprClass: case Stmt::CXXUnresolvedConstructExprClass: case Stmt::DependentScopeDeclRefExprClass: case Stmt::ArrayTypeTraitExprClass: Index: lib/AST/Expr.cpp === --- lib/AST/Expr.cpp +++ lib/AST/Expr.cpp @@ -3004,6 +3004,7 @@ return true; case MSPropertyRefExprClass: + case MSPropertySubscriptExprClass: case CompoundAssignOperatorClass: case VAArgExprClass: case AtomicExprClass: Index: lib/AST/StmtProfile.cpp === --- lib/AST/StmtProfile.cpp +++ lib/AST/StmtProfile.cpp @@ -1126,6 +1126,11 @@ VisitDecl(S->getPropertyDecl()); } +void StmtProfiler::VisitMSPropertySubscriptExpr( +const MSPropertySubscriptExpr *S) { + VisitExpr(S); +} + void StmtProfiler::VisitCXXThisExpr(const CXXThisExpr *S) { VisitExpr(S); ID.AddBoolean(S->isImplicit()); Index: lib/AST/StmtPrinter.cpp === --- lib/AST/StmtPrinter.cpp +++ lib/AST/StmtPrinter.cpp @@ -1732,6 +1732,13 @@ OS << Node->getPropertyDecl()->getDeclName(); } +void StmtPrinter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *Node) { + PrintExpr(Node->getBase()); + OS << "["; + PrintExpr(Node->getIdx()); + OS << "]"; +} + void StmtPrinter::VisitUserDefinedLiteral(UserDefinedLiteral *Node) { switch (Node->getLiteralOperatorKind()) { case UserDefinedLiteral::LOK_Raw: Index: lib/AST/ItaniumMangle.cpp === --- lib/AST/ItaniumMangle.cpp +++ lib/AST/ItaniumMangle.cpp @@ -2811,6 +2811,7 @@ case Expr::ParenListExprClass: case Expr::LambdaExprClass: case Expr::MSPropertyRefExprClass: + case Expr::MSPropertySubscriptExprClass: case Expr::TypoExprClass: // This should no longer exist in the AST by now. case Expr::OMPArraySectionExprClass: llvm_unreachable("unexpected statement kind"); Index: lib/AST/ExprConstant.cpp === --- lib/AST/ExprConstant.cpp +++ lib/AST/ExprConstant.cpp @@ -8974,6 +8974,7 @@ case
Re: r253898 - Driver: fallback to the location of clang if no sysroot,
> > This breaks mingw support on openSUSE : My first question is why on SUSE is clang installed in /opt while mingw-w64 in /usr? x86_64-w64-mingw32-gcc is in $PATH, and this used to work fine before > this commit. It doesn't look for gcc on linux that is a windows host only thing. It didn't do that before this commit also. SUSE was just lucky because we hard coded /usr as the base path. I don't like the idea of hard coding for just a single distro so I think We could optionally do some search for "x86_64-w64-mingw32-gcc" on non windows hosts Just like we do for "gcc" on windows hosts. This should fix SUSE while maintaining the new more reasonable search pattern. If Yaron approves this idea I will commit it with a test case for SUSE so we don't break it again :) Yaron your thoughts? Kind Regards Martell On Tue, Nov 24, 2015 at 12:02 AM, Ismail Donmezwrote: > Hi, > > On Mon, Nov 23, 2015 at 8:59 PM, Martell Malone via cfe-commits > wrote: > > Author: martell > > Date: Mon Nov 23 12:59:48 2015 > > New Revision: 253898 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=253898=rev > > Log: > > Driver: fallback to the location of clang if no sysroot, > > > > hard coding /usr makes little sense for mingw-w64. > > If we have portable toolchains having /usr breaks that. > > If the clang we use is in /usr/bin or /usr/sbin etc this will > > still detect as though it was hard coded to /usr > > > > This makes the most sense going forward for mingw-w64 toolchains > > on both linux and mac > > This breaks mingw support on openSUSE : > > λ cat hello.c > #include > > int main() > { > return 0; > } > > λ clang -v -target x86_64-w64-mingw32 hello.c > clang version 3.8.0 (trunk 253903) > Target: x86_64-w64-windows-gnu > Thread model: posix > InstalledDir: /opt/clang/bin > "/opt/clang/bin/clang-3.8" -cc1 -triple x86_64-w64-windows-gnu > -emit-obj -mrelax-all -disable-free -main-file-name hello.c > -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno > -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 > -momit-leaf-frame-pointer -v -dwarf-column-info -resource-dir > /opt/clang/bin/../lib64/clang/3.8.0 -internal-isystem > /opt/clang/bin/../lib64/clang/3.8.0/include -internal-isystem include > -internal-isystem /opt/clang/x86_64-w64-mingw32/sys-root/mingw/include > -internal-isystem include-fixed -internal-isystem > /opt/clang/x86_64-w64-mingw32/include -internal-isystem > /opt/clang/include -fdebug-compilation-dir /home/ismail -ferror-limit > 19 -fmessage-length 127 -fno-use-cxa-atexit -fobjc-runtime=gcc > -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/hello-f129aa.o > -x c hello.c > clang -cc1 version 3.8.0 based upon LLVM 3.8.0svn default target > x86_64-suse-linux > ignoring nonexistent directory "include" > ignoring nonexistent directory > "/opt/clang/x86_64-w64-mingw32/sys-root/mingw/include" > ignoring nonexistent directory "include-fixed" > ignoring nonexistent directory "/opt/clang/x86_64-w64-mingw32/include" > #include "..." search starts here: > #include <...> search starts here: > /opt/clang/bin/../lib64/clang/3.8.0/include > /opt/clang/include > End of search list. > hello.c:1:10: fatal error: 'stdlib.h' file not found > #include > ^ > 1 error generated. > > x86_64-w64-mingw32-gcc is in $PATH, and this used to work fine before > this commit. > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r253898 - Driver: fallback to the location of clang if no sysroot,
On Tue, Nov 24, 2015 at 12:43 PM, Martell Malonewrote: >> This breaks mingw support on openSUSE : > > My first question is why on SUSE is clang installed in /opt while mingw-w64 > in /usr? Well this is a custom clang it can be anywhere. Official one is in /usr. >> x86_64-w64-mingw32-gcc is in $PATH, and this used to work fine before >> this commit. > > It doesn't look for gcc on linux that is a windows host only thing. > It didn't do that before this commit also. > SUSE was just lucky because we hard coded /usr as the base path. This is not a SUSE only thing, afaik Fedora has the same setup. > I don't like the idea of hard coding for just a single distro so I think > We could optionally do some search for "x86_64-w64-mingw32-gcc" on non > windows hosts > Just like we do for "gcc" on windows hosts. > This should fix SUSE while maintaining the new more reasonable search > pattern. Why not hardcode /usr for Linux hosts? Thanks, ismail ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r253859 - Fix calculation of shifted cursor/code positions. Specifically support
On 23 November 2015 at 22:31, Daniel Jasperwrote: > Fixed in r253929. Thanks! ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r253972 - Use libcxx's default rune table with the Musl C library.
Author: vkalintiris Date: Tue Nov 24 04:24:54 2015 New Revision: 253972 URL: http://llvm.org/viewvc/llvm-project?rev=253972=rev Log: Use libcxx's default rune table with the Musl C library. Summary: Also, there are no exported character type tables from Musl so we have to Fallback to the standard functions. This reduces the number of libcxx's test-suite failures down to ~130 for MIPS. Most of the remaining failures come from the atomics (due to the lack of 8-byte atomic-ops in MIPS32) and thread tests. Reviewers: mclow.lists, EricWF, dalias, jroelofs Subscribers: tberghammer, danalbert, srhines, cfe-commits Differential Revision: http://reviews.llvm.org/D14926 Modified: libcxx/trunk/include/__config libcxx/trunk/include/__locale libcxx/trunk/src/locale.cpp Modified: libcxx/trunk/include/__config URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=253972=253971=253972=diff == --- libcxx/trunk/include/__config (original) +++ libcxx/trunk/include/__config Tue Nov 24 04:24:54 2015 @@ -804,7 +804,7 @@ extern "C" void __sanitizer_annotate_con #define _LIBCPP_HAS_NO_STDOUT #endif -#if defined(__ANDROID__) || defined(__CloudABI__) +#if defined(__ANDROID__) || defined(__CloudABI__) || defined(_LIBCPP_HAS_MUSL_LIBC) #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE #endif Modified: libcxx/trunk/include/__locale URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__locale?rev=253972=253971=253972=diff == --- libcxx/trunk/include/__locale (original) +++ libcxx/trunk/include/__locale Tue Nov 24 04:24:54 2015 @@ -361,7 +361,7 @@ public: typedef __uint32_t mask; # elif defined(__FreeBSD__) typedef unsigned long mask; -# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC) +# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__) typedef unsigned short mask; # endif static const mask space = _CTYPE_S; @@ -408,11 +408,7 @@ public: # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT #else -#if defined(_LIBCPP_HAS_MUSL_LIBC) -typedef unsigned short mask; -#else typedef unsigned long mask; -#endif static const mask space = 1<<0; static const mask print = 1<<1; static const mask cntrl = 1<<2; @@ -634,7 +630,7 @@ public: #endif _LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;} static const mask* classic_table() _NOEXCEPT; -#if defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC) +#if defined(__GLIBC__) || defined(__EMSCRIPTEN__) static const int* __classic_upper_table() _NOEXCEPT; static const int* __classic_lower_table() _NOEXCEPT; #endif Modified: libcxx/trunk/src/locale.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/locale.cpp?rev=253972=253971=253972=diff == --- libcxx/trunk/src/locale.cpp (original) +++ libcxx/trunk/src/locale.cpp Tue Nov 24 04:24:54 2015 @@ -813,7 +813,7 @@ ctype::do_toupper(char_type c) #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c; #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \ - defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC) + defined(__NetBSD__) return isascii(c) ? ctype::__classic_upper_table()[c] : c; #else return (isascii(c) && iswlower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'a'+L'A' : c; @@ -827,7 +827,7 @@ ctype::do_toupper(char_type* lo #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low; #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \ - defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC) + defined(__NetBSD__) *low = isascii(*low) ? ctype::__classic_upper_table()[*low] : *low; #else @@ -842,7 +842,7 @@ ctype::do_tolower(char_type c) #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c; #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \ - defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC) + defined(__NetBSD__) return isascii(c) ? ctype::__classic_lower_table()[c] : c; #else return (isascii(c) && isupper_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'A'+'a' : c; @@ -856,7 +856,7 @@ ctype::do_tolower(char_type* lo #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low; #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \ - defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC) + defined(__NetBSD__) *low = isascii(*low) ? ctype::__classic_lower_table()[*low] : *low; #else @@ -925,7 +925,7 @@ ctype::do_toupper(char_type
Re: [PATCH] D14926: Use libcxx's default rune table with the Musl C library.
This revision was automatically updated to reflect the committed changes. Closed by commit rL253972: Use libcxx's default rune table with the Musl C library. (authored by vkalintiris). Changed prior to commit: http://reviews.llvm.org/D14926?vs=40926=41016#toc Repository: rL LLVM http://reviews.llvm.org/D14926 Files: libcxx/trunk/include/__config libcxx/trunk/include/__locale libcxx/trunk/src/locale.cpp Index: libcxx/trunk/src/locale.cpp === --- libcxx/trunk/src/locale.cpp +++ libcxx/trunk/src/locale.cpp @@ -813,7 +813,7 @@ #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c; #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \ - defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC) + defined(__NetBSD__) return isascii(c) ? ctype::__classic_upper_table()[c] : c; #else return (isascii(c) && iswlower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'a'+L'A' : c; @@ -827,7 +827,7 @@ #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low; #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \ - defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC) + defined(__NetBSD__) *low = isascii(*low) ? ctype::__classic_upper_table()[*low] : *low; #else @@ -842,7 +842,7 @@ #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c; #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \ - defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC) + defined(__NetBSD__) return isascii(c) ? ctype::__classic_lower_table()[c] : c; #else return (isascii(c) && isupper_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'A'+'a' : c; @@ -856,7 +856,7 @@ #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low; #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \ - defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC) + defined(__NetBSD__) *low = isascii(*low) ? ctype::__classic_lower_table()[*low] : *low; #else @@ -925,7 +925,7 @@ static_cast(_DefaultRuneLocale.__mapupper[static_cast(c)]) : c; #elif defined(__NetBSD__) return static_cast(__classic_upper_table()[static_cast(c)]); -#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC) +#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) return isascii(c) ? static_cast(__classic_upper_table()[static_cast(c)]) : c; #else @@ -942,7 +942,7 @@ static_cast(_DefaultRuneLocale.__mapupper[static_cast(*low)]) : *low; #elif defined(__NetBSD__) *low = static_cast(__classic_upper_table()[static_cast(*low)]); -#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC) +#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) *low = isascii(*low) ? static_cast(__classic_upper_table()[static_cast(*low)]) : *low; #else @@ -959,7 +959,7 @@ static_cast(_DefaultRuneLocale.__maplower[static_cast(c)]) : c; #elif defined(__NetBSD__) return static_cast(__classic_lower_table()[static_cast(c)]); -#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC) +#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) return isascii(c) ? static_cast(__classic_lower_table()[static_cast(c)]) : c; #else @@ -975,7 +975,7 @@ *low = isascii(*low) ? static_cast(_DefaultRuneLocale.__maplower[static_cast(*low)]) : *low; #elif defined(__NetBSD__) *low = static_cast(__classic_lower_table()[static_cast(*low)]); -#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC) +#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) *low = isascii(*low) ? static_cast(__classic_lower_table()[static_cast(*low)]) : *low; #else *low = (isascii(*low) && isupper_l(*low, _LIBCPP_GET_C_LOCALE)) ? *low-'A'+'a' : *low; @@ -1016,7 +1016,7 @@ return low; } -#if defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC) +#if defined(__EMSCRIPTEN__) extern "C" const unsigned short ** __ctype_b_loc(); extern "C" const int ** __ctype_tolower_loc(); extern "C" const int ** __ctype_toupper_loc(); @@ -1118,7 +1118,7 @@ return _ctype+1; // internal ctype mask table defined in msvcrt.dll // This is assumed to be safe, which is a nonsense assumption because we're // going to end up dereferencing it later... -#elif defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC) +#elif defined(__EMSCRIPTEN__) return *__ctype_b_loc(); #elif defined(_NEWLIB_VERSION) // Newlib has a 257-entry table in ctype_.c, where (char)0 starts at [1]. @@ -1161,7 +1161,7 @@ return _C_toupper_tab_ + 1; } -#elif defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC) +#elif defined(__EMSCRIPTEN__) const int*
Re: r253898 - Driver: fallback to the location of clang if no sysroot,
> > Why not hardcode /usr for Linux hosts? Portable toolchain packages exist but can't on linux if you do this. but in general I'm sure most would agree that detection is much better then hard coding. This is why Yaron approved the patch Well this is a custom clang it can be anywhere. Official one is in /usr. This means that your earlier statement of "This breaks mingw support on openSUSE" is incorrect. The official SUSE packages still work with this patch. More accurately it breaks your setup of having clang and mingw-w64 in 2 completely separate install locations. Which is not a typical use case even for gcc and one would be expected to pass a sysroot for this. For a more immediate solution for your specific setup I would create a bash script called x86_64-w64-mingw32-clang with this content like this #!/usr/bin/env bash /opt/bin/clang -target x86_64-windows-gnu -sysroot=/usr "$@" It seems as though SUSE''s binutils is built with sysroot so this should be acceptable https://build.opensuse.org/package/view_file/windows:mingw:win64/mingw64-cross-binutils/mingw64-binutils.spec?expand=1 Other then that we should wait for Yaron's thoughts on mingw-gcc detection on linux :) On Tue, Nov 24, 2015 at 2:53 AM, Ismail Donmezwrote: > On Tue, Nov 24, 2015 at 12:43 PM, Martell Malone > wrote: > >> This breaks mingw support on openSUSE : > > > > My first question is why on SUSE is clang installed in /opt while > mingw-w64 > > in /usr? > > Well this is a custom clang it can be anywhere. Official one is in /usr. > > >> x86_64-w64-mingw32-gcc is in $PATH, and this used to work fine before > >> this commit. > > > > It doesn't look for gcc on linux that is a windows host only thing. > > It didn't do that before this commit also. > > SUSE was just lucky because we hard coded /usr as the base path. > > This is not a SUSE only thing, afaik Fedora has the same setup. > > > I don't like the idea of hard coding for just a single distro so I think > > We could optionally do some search for "x86_64-w64-mingw32-gcc" on non > > windows hosts > > Just like we do for "gcc" on windows hosts. > > This should fix SUSE while maintaining the new more reasonable search > > pattern. > > Why not hardcode /usr for Linux hosts? > > Thanks, > ismail > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D14935: Fix nodefaultlibs/nostdlib check
niravd updated this revision to Diff 41040. niravd added a comment. Fix review issues http://reviews.llvm.org/D14935 Files: lib/Driver/Driver.cpp test/Driver/nodefaultlib.c Index: test/Driver/nodefaultlib.c === --- test/Driver/nodefaultlib.c +++ test/Driver/nodefaultlib.c @@ -1,8 +1,10 @@ -// RUN: %clang -target i686-pc-linux-gnu -### -nodefaultlibs %s 2> %t -// RUN: FileCheck < %t %s -// -// CHECK-NOT: start-group -// CHECK-NOT: "-lgcc" -// CHECK-NOT: "-lc" -// CHECK: crtbegin -// CHECK: crtend +// RUN: %clang -target i686-pc-linux-gnu -### -nodefaultlibs %s 2>&1 | FileCheck -check-prefix=TEST1 %s +// TEST1-NOT: start-group +// TEST1-NOT: "-lgcc" +// TEST1-NOT: "-lc" +// TEST1: crtbegin +// TEST1: crtend + +// RUN: %clang -target i686-pc-linux-gnu -stdlib=libc++ -nodefaultlibs -lstdc++ -### %s 2>&1 | FileCheck -check-prefix=TEST2 %s +// TEST2-NOT: "-lc++" +// TEST2: "-lstdc++" Index: lib/Driver/Driver.cpp === --- lib/Driver/Driver.cpp +++ lib/Driver/Driver.cpp @@ -209,6 +209,7 @@ DerivedArgList *DAL = new DerivedArgList(Args); bool HasNostdlib = Args.hasArg(options::OPT_nostdlib); + bool HasNodefaultlib = Args.hasArg(options::OPT_nodefaultlibs); for (Arg *A : Args) { // Unfortunately, we have to parse some forwarding options (-Xassembler, // -Xlinker, -Xpreprocessor) because we either integrate their functionality @@ -252,7 +253,7 @@ StringRef Value = A->getValue(); // Rewrite unless -nostdlib is present. - if (!HasNostdlib && Value == "stdc++") { + if (!HasNostdlib && !HasNodefaultlib && Value == "stdc++") { DAL->AddFlagArg(A, Opts->getOption(options::OPT_Z_reserved_lib_stdcxx)); continue; } Index: test/Driver/nodefaultlib.c === --- test/Driver/nodefaultlib.c +++ test/Driver/nodefaultlib.c @@ -1,8 +1,10 @@ -// RUN: %clang -target i686-pc-linux-gnu -### -nodefaultlibs %s 2> %t -// RUN: FileCheck < %t %s -// -// CHECK-NOT: start-group -// CHECK-NOT: "-lgcc" -// CHECK-NOT: "-lc" -// CHECK: crtbegin -// CHECK: crtend +// RUN: %clang -target i686-pc-linux-gnu -### -nodefaultlibs %s 2>&1 | FileCheck -check-prefix=TEST1 %s +// TEST1-NOT: start-group +// TEST1-NOT: "-lgcc" +// TEST1-NOT: "-lc" +// TEST1: crtbegin +// TEST1: crtend + +// RUN: %clang -target i686-pc-linux-gnu -stdlib=libc++ -nodefaultlibs -lstdc++ -### %s 2>&1 | FileCheck -check-prefix=TEST2 %s +// TEST2-NOT: "-lc++" +// TEST2: "-lstdc++" Index: lib/Driver/Driver.cpp === --- lib/Driver/Driver.cpp +++ lib/Driver/Driver.cpp @@ -209,6 +209,7 @@ DerivedArgList *DAL = new DerivedArgList(Args); bool HasNostdlib = Args.hasArg(options::OPT_nostdlib); + bool HasNodefaultlib = Args.hasArg(options::OPT_nodefaultlibs); for (Arg *A : Args) { // Unfortunately, we have to parse some forwarding options (-Xassembler, // -Xlinker, -Xpreprocessor) because we either integrate their functionality @@ -252,7 +253,7 @@ StringRef Value = A->getValue(); // Rewrite unless -nostdlib is present. - if (!HasNostdlib && Value == "stdc++") { + if (!HasNostdlib && !HasNodefaultlib && Value == "stdc++") { DAL->AddFlagArg(A, Opts->getOption(options::OPT_Z_reserved_lib_stdcxx)); continue; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D10802: [mips] Interrupt attribute support.
sdardis updated this revision to Diff 41041. sdardis added a comment. Updated text of return type/parameters warning to Aaron's suggestion. Dropped '\' escape characters from warning/error text. Removed mips16/nomips16 check. Tweak of comment in handleMipsInterruptAttr. http://reviews.llvm.org/D10802 Files: include/clang/Basic/Attr.td include/clang/Basic/AttrDocs.td include/clang/Basic/DiagnosticSemaKinds.td lib/CodeGen/TargetInfo.cpp lib/Sema/SemaDeclAttr.cpp test/CodeGen/mips-interrupt-attr.c test/Sema/mips-interrupt-attr.c Index: test/Sema/mips-interrupt-attr.c === --- /dev/null +++ test/Sema/mips-interrupt-attr.c @@ -0,0 +1,29 @@ +// RUN: %clang_cc1 %s -triple mips-img-elf -verify -fsyntax-only +struct a { int b; }; + +struct a test __attribute__((interrupt)); // expected-warning {{'interrupt' attribute only applies to functions and methods}} + +__attribute__((interrupt("EIC"))) void foo1() {} // expected-warning {{'interrupt' attribute argument not supported: 'EIC'}} + +__attribute__((interrupt("eic", 1))) void foo2() {} // expected-error {{'interrupt' attribute takes no more than 1 argument}} + +__attribute__((interrupt("eic"))) void foo3() {} +__attribute__((interrupt("vector=sw0"))) void foo4() {} +__attribute__((interrupt("vector=hw0"))) void foo5() {} +__attribute__((interrupt("vector=hw1"))) void foo6() {} +__attribute__((interrupt("vector=hw2"))) void foo7() {} +__attribute__((interrupt("vector=hw3"))) void foo8() {} +__attribute__((interrupt("vector=hw4"))) void foo9() {} +__attribute__((interrupt("vector=hw5"))) void fooa() {} +__attribute__((interrupt(""))) void food() {} + +__attribute__((interrupt)) int foob() {return 0;} // expected-warning {{MIPS 'interrupt' attribute only applies to functions that have a 'void' return type}} +__attribute__((interrupt())) void fooc(int a) {} // expected-warning {{MIPS 'interrupt' attribute only applies to functions that have no parameters}} +__attribute__((interrupt,mips16)) void fooe() {} // expected-error {{'interrupt' and 'mips16' attributes are not compatible}} \ + // expected-note {{conflicting attribute is here}} +__attribute__((mips16,interrupt)) void foof() {} // expected-error {{'mips16' and 'interrupt' attributes are not compatible}} \ + // expected-note {{conflicting attribute is here}} +__attribute__((interrupt)) __attribute__ ((mips16)) void foo10() {} // expected-error {{'interrupt' and 'mips16' attributes are not compatible}} \ +// expected-note {{conflicting attribute is here}} +__attribute__((mips16)) __attribute ((interrupt)) void foo11() {} // expected-error {{'mips16' and 'interrupt' attributes are not compatible}} \ + // expected-note {{conflicting attribute is here}} Index: test/CodeGen/mips-interrupt-attr.c === --- /dev/null +++ test/CodeGen/mips-interrupt-attr.c @@ -0,0 +1,64 @@ +// RUN: %clang_cc1 -triple mipsel-unknown-linux -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK + +void __attribute__ ((interrupt("vector=sw0"))) +isr_sw0 (void) +{ + // CHECK: define void @isr_sw0() [[SW0:#[0-9]+]] +} + +void __attribute__ ((interrupt("vector=sw1"))) +isr_sw1 (void) +{ + // CHECK: define void @isr_sw1() [[SW1:#[0-9]+]] +} + +void __attribute__ ((interrupt("vector=hw0"))) +isr_hw0 (void) +{ + // CHECK: define void @isr_hw0() [[HW0:#[0-9]+]] +} + +void __attribute__ ((interrupt("vector=hw1"))) +isr_hw1 (void) +{ + // CHECK: define void @isr_hw1() [[HW1:#[0-9]+]] +} + +void __attribute__ ((interrupt("vector=hw2"))) +isr_hw2 (void) +{ + // CHECK: define void @isr_hw2() [[HW2:#[0-9]+]] +} + +void __attribute__ ((interrupt("vector=hw3"))) +isr_hw3 (void) +{ + // CHECK: define void @isr_hw3() [[HW3:#[0-9]+]] +} + +void __attribute__ ((interrupt("vector=hw4"))) +isr_hw4 (void) +{ + // CHECK: define void @isr_hw4() [[HW4:#[0-9]+]] +} + +void __attribute__ ((interrupt("vector=hw5"))) +isr_hw5 (void) +{ + // CHECK: define void @isr_hw5() [[HW5:#[0-9]+]] +} + +void __attribute__ ((interrupt)) +isr_eic (void) +{ + // CHECK: define void @isr_eic() [[EIC:#[0-9]+]] +} +// CHECK: attributes [[SW0]] = { {{.*}} "interrupt"="sw0" {{.*}} } +// CHECK: attributes [[SW1]] = { {{.*}} "interrupt"="sw1" {{.*}} } +// CHECK: attributes [[HW0]] = { {{.*}} "interrupt"="hw0" {{.*}} } +// CHECK: attributes [[HW1]] = { {{.*}} "interrupt"="hw1" {{.*}} } +// CHECK: attributes [[HW2]] = { {{.*}} "interrupt"="hw2" {{.*}} } +// CHECK: attributes [[HW3]] = { {{.*}} "interrupt"="hw3" {{.*}} } +// CHECK: attributes [[HW4]] = { {{.*}} "interrupt"="hw4" {{.*}} } +// CHECK: attributes [[HW5]] = { {{.*}} "interrupt"="hw5" {{.*}} } +// CHECK: attributes [[EIC]] = { {{.*}} "interrupt"="eic" {{.*}}
Re: r253898 - Driver: fallback to the location of clang if no sysroot,
Searching for gcc on Linux is not a good idea, you'll find the system one not the mingw one. Searching for i686-w64-mingw32-gcc or x86_64-w64-mingw32-gcc should work better, that is searching for: getTriple().getArchName()) + "-w64-mingw32-gcc" Moreover, this should work on Windows as well, mingw-w64 distribution has [i686|x86_64]-w64-mingw32-gcc.exe at the same location as gcc.exe. For this you can unite the code for both Linux and Windows. To continue supporting mingw.org, if this search fails, search for mingw32-gcc. 2015-11-24 16:36 GMT+02:00 Martell Malone: > Why not hardcode /usr for Linux hosts? > > Portable toolchain packages exist but can't on linux if you do this. > but in general I'm sure most would agree that detection is much better > then hard coding. > This is why Yaron approved the patch > > Well this is a custom clang it can be anywhere. Official one is in /usr. > > This means that your earlier statement of "This breaks mingw support on > openSUSE" is incorrect. > The official SUSE packages still work with this patch. > > More accurately it breaks your setup of having clang and mingw-w64 in 2 > completely separate install locations. > Which is not a typical use case even for gcc and one would be expected to > pass a sysroot for this. > > For a more immediate solution for your specific setup I would create a > bash script called > x86_64-w64-mingw32-clang > with this content like this > #!/usr/bin/env bash > /opt/bin/clang -target x86_64-windows-gnu -sysroot=/usr "$@" > > It seems as though SUSE''s binutils is built with sysroot so this should > be acceptable > > https://build.opensuse.org/package/view_file/windows:mingw:win64/mingw64-cross-binutils/mingw64-binutils.spec?expand=1 > > Other then that we should wait for Yaron's thoughts on mingw-gcc detection > on linux :) > > > On Tue, Nov 24, 2015 at 2:53 AM, Ismail Donmez wrote: > On Tue, Nov 24, 2015 at 12:43 PM, Martell Malone > wrote: > >> This breaks mingw support on openSUSE : > > > > My first question is why on SUSE is clang installed in /opt while > mingw-w64 > > in /usr? > > Well this is a custom clang it can be anywhere. Official one is in /usr. > > >> x86_64-w64-mingw32-gcc is in $PATH, and this used to work fine before > >> this commit. > > > > It doesn't look for gcc on linux that is a windows host only thing. > > It didn't do that before this commit also. > > SUSE was just lucky because we hard coded /usr as the base path. > > This is not a SUSE only thing, afaik Fedora has the same setup. > > > I don't like the idea of hard coding for just a single distro so I think > > We could optionally do some search for "x86_64-w64-mingw32-gcc" on non > > windows hosts > > Just like we do for "gcc" on windows hosts. > > This should fix SUSE while maintaining the new more reasonable search > > pattern. > > Why not hardcode /usr for Linux hosts? > > Thanks, > ismail > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r253898 - Driver: fallback to the location of clang if no sysroot,
> > Searching for gcc on Linux is not a good idea, you'll find the system one > not the mingw one. Searching for i686-w64-mingw32-gcc or > x86_64-w64-mingw32-gcc should work better, that is searching for: > getTriple().getArchName()) + "-w64-mingw32-gcc" Moreover, this should work on Windows as well, mingw-w64 distribution has > [i686|x86_64]-w64-mingw32-gcc.exe at the same location as gcc.exe. For this > you can unite the code for both Linux and Windows. > Agreed this makes most sense. To continue supporting mingw.org, if this search fails, search for > mingw32-gcc. I'll make a patch for review, I won't be able todo it until the weekend because of work but I will get to it On Tue, Nov 24, 2015 at 7:03 AM, Yaron Kerenwrote: > Searching for gcc on Linux is not a good idea, you'll find the system one > not the mingw one. Searching for i686-w64-mingw32-gcc or > x86_64-w64-mingw32-gcc should work better, that is searching for: > > getTriple().getArchName()) + "-w64-mingw32-gcc" > > Moreover, this should work on Windows as well, mingw-w64 distribution has > [i686|x86_64]-w64-mingw32-gcc.exe at the same location as gcc.exe. For this > you can unite the code for both Linux and Windows. > > To continue supporting mingw.org, if this search fails, search for > mingw32-gcc. > > > > 2015-11-24 16:36 GMT+02:00 Martell Malone : > >> Why not hardcode /usr for Linux hosts? >> >> Portable toolchain packages exist but can't on linux if you do this. >> but in general I'm sure most would agree that detection is much better >> then hard coding. >> This is why Yaron approved the patch >> >> Well this is a custom clang it can be anywhere. Official one is in /usr. >> >> This means that your earlier statement of "This breaks mingw support on >> openSUSE" is incorrect. >> The official SUSE packages still work with this patch. >> >> More accurately it breaks your setup of having clang and mingw-w64 in 2 >> completely separate install locations. >> Which is not a typical use case even for gcc and one would be expected to >> pass a sysroot for this. >> >> For a more immediate solution for your specific setup I would create a >> bash script called >> x86_64-w64-mingw32-clang >> with this content like this >> #!/usr/bin/env bash >> /opt/bin/clang -target x86_64-windows-gnu -sysroot=/usr "$@" >> >> It seems as though SUSE''s binutils is built with sysroot so this should >> be acceptable >> >> https://build.opensuse.org/package/view_file/windows:mingw:win64/mingw64-cross-binutils/mingw64-binutils.spec?expand=1 >> >> Other then that we should wait for Yaron's thoughts on mingw-gcc >> detection on linux :) >> >> >> > On Tue, Nov 24, 2015 at 2:53 AM, Ismail Donmez wrote: > >> On Tue, Nov 24, 2015 at 12:43 PM, Martell Malone >> wrote: >> >> This breaks mingw support on openSUSE : >> > >> > My first question is why on SUSE is clang installed in /opt while >> mingw-w64 >> > in /usr? >> >> Well this is a custom clang it can be anywhere. Official one is in /usr. >> >> >> x86_64-w64-mingw32-gcc is in $PATH, and this used to work fine before >> >> this commit. >> > >> > It doesn't look for gcc on linux that is a windows host only thing. >> > It didn't do that before this commit also. >> > SUSE was just lucky because we hard coded /usr as the base path. >> >> This is not a SUSE only thing, afaik Fedora has the same setup. >> >> > I don't like the idea of hard coding for just a single distro so I think >> > We could optionally do some search for "x86_64-w64-mingw32-gcc" on non >> > windows hosts >> > Just like we do for "gcc" on windows hosts. >> > This should fix SUSE while maintaining the new more reasonable search >> > pattern. >> >> Why not hardcode /usr for Linux hosts? >> >> Thanks, >> ismail >> > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D14919: Fix IssueHash generation
xazax.hun added inline comments. Comment at: include/clang/StaticAnalyzer/Core/IssueHash.h:42 @@ -41,1 +41,3 @@ + llvm::StringRef BugType, const Decl *D, + const LangOptions& LangOpts); Please put & next to he variable name, here and some other places. http://reviews.llvm.org/D14919 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D14203: [analyzer] Improve pointer arithmetic checker.
xazax.hun added inline comments. Comment at: lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp:150 @@ +149,3 @@ +return getArrayRegion(Region, Polymorphic, AKind, C); + default: +break; xazax.hun wrote: > dcoughlin wrote: > > In general, I think it is better to avoid default in cases like these so > > that when an enum case is added the compiler issues a warning and thus > > forces the person adding the change to think about what the behavior of the > > new case should be. > I will enumerate the rest of the kinds here. I checked and there are more kinds than what I think is worth enumerating. Comment at: lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp:28 @@ -24,1 +27,3 @@ namespace { +enum class AllocKind { + SingleObject, In case, there is a pointer to the stack allocated variable, nothing will be stored in the GDM. The result of a new is a symbolic region, but there are other ways to get a symbolic region, e.g. a pointer as an argument to a top level function. In order to distinguish these cases I think I need to store something to the GDM. But I will think a bit more, whether there is a way to reduce the GDM usage. http://reviews.llvm.org/D14203 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D14203: [analyzer] Improve pointer arithmetic checker.
xazax.hun updated this revision to Diff 41022. xazax.hun marked 11 inline comments as done. xazax.hun added a comment. - Fixed some of the review comments. - Updated to latest trunk. http://reviews.llvm.org/D14203 Files: lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp test/Analysis/PR24184.cpp test/Analysis/fields.c test/Analysis/ptr-arith.c test/Analysis/ptr-arith.cpp test/Analysis/rdar-6442306-1.m Index: test/Analysis/rdar-6442306-1.m === --- test/Analysis/rdar-6442306-1.m +++ test/Analysis/rdar-6442306-1.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core %s -analyzer-store=region -verify +// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core -analyzer-disable-checker=alpha.core.PointerArithm %s -analyzer-store=region -verify // expected-no-diagnostics typedef int bar_return_t; Index: test/Analysis/ptr-arith.cpp === --- test/Analysis/ptr-arith.cpp +++ test/Analysis/ptr-arith.cpp @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -verify %s -// expected-no-diagnostics +// RUN: %clang_cc1 -Wno-unused-value -std=c++14 -analyze -analyzer-checker=core,debug.ExprInspection,alpha.core.PointerArithm -verify %s struct X { int *p; int zero; @@ -20,3 +19,82 @@ return 5/littleX.zero; // no-warning } + +class Base {}; +class Derived : public Base {}; + +void checkPolymorphicUse() { + Derived d[10]; + + Base *p = d; + ++p; // expected-warning{{Pointer arithmetic on a pointer to base class is dangerous}} +} + +void checkBitCasts() { + long l; + char *p = (char*) + p = p+2; +} + +void checkBasicarithmetic(int i) { + int t[10]; + int *p = t; + ++p; + int a = 5; + p = + ++p; // expected-warning{{Pointer arithmetic done on non-array variables means reliance on memory layout, which is dangerous}} + p = p + 2; // expected-warning{{}} + p = 2 + p; // expected-warning{{}} + p += 2; // expected-warning{{}} + a += p[2]; // expected-warning{{}} + p = i*0 + p; + p = p + i*0; + p += i*0; +} + +void checkArithOnSymbolic(int*p) { + ++p; + p = p + 2; + p = 2 + p; + p += 2; + (void)p[2]; +} + +struct S { + int t[10]; +}; + +void arrayInStruct() { + S s; + int * p = s.t; + ++p; + S *sp = new S; + p = sp->t; + ++p; + delete sp; +} + +void checkNew() { + int *p = new int; + p[1] = 1; // expected-warning{{}} +} + +void InitState(int* state) { +state[1] = 1; // expected-warning{{}} +} + +int* getArray(int size) { +if (size == 0) + return new int; +return new int[5]; +} + +void checkConditionalArray() { +int* maybeArray = getArray(0); +InitState(maybeArray); +} + +void checkMultiDimansionalArray() { + int a[5][5]; + *(*(a+1)+2) = 2; +} Index: test/Analysis/ptr-arith.c === --- test/Analysis/ptr-arith.c +++ test/Analysis/ptr-arith.c @@ -75,7 +75,7 @@ clang_analyzer_eval( != 0); // expected-warning{{TRUE}} clang_analyzer_eval( >= 0); // expected-warning{{TRUE}} clang_analyzer_eval( > 0); // expected-warning{{TRUE}} - clang_analyzer_eval(( - 0) != 0); // expected-warning{{TRUE}} expected-warning{{Pointer arithmetic done on non-array variables}} + clang_analyzer_eval(( - 0) != 0); // expected-warning{{TRUE}} // LHS is NULL, RHS is non-symbolic // The same code is used for labels and non-symbolic values. Index: test/Analysis/fields.c === --- test/Analysis/fields.c +++ test/Analysis/fields.c @@ -16,7 +16,7 @@ void f() { struct s a; - int *p = &(a.n) + 1; + int *p = &(a.n) + 1; // expected-warning{{Pointer arithmetic done}} } typedef struct { Index: test/Analysis/PR24184.cpp === --- test/Analysis/PR24184.cpp +++ test/Analysis/PR24184.cpp @@ -12,7 +12,7 @@ typedef int *vcreate_t(int *, DATA_TYPE, int, int); void fn1(unsigned, unsigned) { char b = 0; - for (; 1; a++, + a * 0) // expected-warning{{Pointer arithmetic done on non-array variables means reliance on memory layout, which is dangerous}} + for (; 1; a++, + a * 0) ; } @@ -55,7 +55,7 @@ void fn2_1(uint32_t *p1, unsigned char *p2, uint32_t p3) { unsigned i = 0; for (0; i < p3; i++) -fn1_1(p1 + i, p2 + i * 0);// expected-warning{{Pointer arithmetic done on non-array variables means reliance on memory layout, which is dangerous}} +fn1_1(p1 + i, p2 + i * 0); } struct A_1 { Index: lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp === --- lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp +++ lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp @@ -13,55 +13,329 @@ //===--===// #include "ClangSACheckers.h"
r253977 - [OPENMP] Fix crash on codegen for 'task' directive with no shared variables.
Author: abataev Date: Tue Nov 24 07:01:44 2015 New Revision: 253977 URL: http://llvm.org/viewvc/llvm-project?rev=253977=rev Log: [OPENMP] Fix crash on codegen for 'task' directive with no shared variables. If 'task' region does not have shared variables codegen could crash on calculation of size of list of shared variables. Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp cfe/trunk/test/OpenMP/task_private_codegen.cpp Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=253977=253976=253977=diff == --- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original) +++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Tue Nov 24 07:01:44 2015 @@ -2317,7 +2317,7 @@ void CGOpenMPRuntime::emitTaskCall( CGF.Builder.getInt32(/*C=*/0)) : CGF.Builder.getInt32(Final.getInt() ? FinalFlag : 0); TaskFlags = CGF.Builder.CreateOr(TaskFlags, CGF.Builder.getInt32(Flags)); - auto *SharedsSize = getTypeSize(CGF, SharedsTy); + auto *SharedsSize = CGM.getSize(C.getTypeSizeInChars(SharedsTy)); llvm::Value *AllocArgs[] = {emitUpdateLocation(CGF, Loc), getThreadID(CGF, Loc), TaskFlags, KmpTaskTWithPrivatesTySize, SharedsSize, Modified: cfe/trunk/test/OpenMP/task_private_codegen.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/task_private_codegen.cpp?rev=253977=253976=253977=diff == --- cfe/trunk/test/OpenMP/task_private_codegen.cpp (original) +++ cfe/trunk/test/OpenMP/task_private_codegen.cpp Tue Nov 24 07:01:44 2015 @@ -138,6 +138,8 @@ int main() { s_arr[0] = var; sivar = 8; } +#pragma omp task + g+=1; return tmain(); #endif } @@ -188,6 +190,7 @@ int main() { // Start task. // CHECK: call i32 @__kmpc_omp_task([[LOC]], i32 [[GTID]], i8* [[RES]]) +// CHECK: call i32 @__kmpc_omp_task([[LOC]], i32 [[GTID]], i8* // CHECK: = call i{{.+}} [[TMAIN_INT:@.+]]() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D14919: Fix IssueHash generation
o.gyorgy updated this revision to Diff 41024. o.gyorgy added a comment. Some small format changes. Based on the review. http://reviews.llvm.org/D14919 Files: include/clang/StaticAnalyzer/Core/IssueHash.h lib/Basic/SourceManager.cpp lib/StaticAnalyzer/Checkers/DebugCheckers.cpp lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp lib/StaticAnalyzer/Core/IssueHash.cpp lib/StaticAnalyzer/Core/PlistDiagnostics.cpp test/Analysis/bug_hash_test.cpp test/Analysis/diagnostics/report-issues-within-main-file.cpp Index: test/Analysis/diagnostics/report-issues-within-main-file.cpp === --- test/Analysis/diagnostics/report-issues-within-main-file.cpp +++ test/Analysis/diagnostics/report-issues-within-main-file.cpp @@ -949,7 +949,7 @@ // CHECK-NEXT: typeBad deallocator // CHECK-NEXT: check_nameunix.MismatchedDeallocator // CHECK-NEXT: -// CHECK-NEXT: issue_hash_content_of_line_in_contextf21ac032efaa3d1459a5ed31f0ad44f0 +// CHECK-NEXT: issue_hash_content_of_line_in_contextf689fbd54138491e228f0f89bb02bfb2 // CHECK-NEXT: issue_context_kindfunction // CHECK-NEXT: issue_contextmainPlusHeader // CHECK-NEXT: issue_hash_function_offset2 Index: test/Analysis/bug_hash_test.cpp === --- test/Analysis/bug_hash_test.cpp +++ test/Analysis/bug_hash_test.cpp @@ -288,17 +288,17 @@ // CHECK-NEXT: // CHECK-NEXT: depth0 // CHECK-NEXT: extended_message -// CHECK-NEXT: debug.DumpBugHash$int f()$28$namespaceAA{$debug +// CHECK-NEXT: debug.DumpBugHash$int f()$28$constexprintf(){return5;}$debug // CHECK-NEXT: message -// CHECK-NEXT: debug.DumpBugHash$int f()$28$namespaceAA{$debug +// CHECK-NEXT: debug.DumpBugHash$int f()$28$constexprintf(){return5;}$debug // CHECK-NEXT: // CHECK-NEXT: -// CHECK-NEXT: descriptiondebug.DumpBugHash$int f()$28$namespaceAA{$debug +// CHECK-NEXT: descriptiondebug.DumpBugHash$int f()$28$constexprintf(){return5;}$debug // CHECK-NEXT: categorydebug // CHECK-NEXT: typeDump hash components // CHECK-NEXT: check_namedebug.DumpBugHash // CHECK-NEXT: -// CHECK-NEXT: issue_hash_content_of_line_in_contextf8ee38da3de42e209c4afa886b5531ab +// CHECK-NEXT: issue_hash_content_of_line_in_contextf5471f52854dc14167fe96db50c4ba5f // CHECK-NEXT: issue_context_kindfunction // CHECK-NEXT: issue_contextf // CHECK-NEXT: issue_hash_function_offset0 Index: lib/StaticAnalyzer/Core/PlistDiagnostics.cpp === --- lib/StaticAnalyzer/Core/PlistDiagnostics.cpp +++ lib/StaticAnalyzer/Core/PlistDiagnostics.cpp @@ -399,7 +399,7 @@ *SM); const Decl *DeclWithIssue = D->getDeclWithIssue(); EmitString(o, GetIssueHash(*SM, L, D->getCheckName(), D->getBugType(), - DeclWithIssue)) + DeclWithIssue, LangOpts)) << '\n'; // Output information about the semantic context where Index: lib/StaticAnalyzer/Core/IssueHash.cpp === --- lib/StaticAnalyzer/Core/IssueHash.cpp +++ lib/StaticAnalyzer/Core/IssueHash.cpp @@ -127,14 +127,13 @@ } static std::string NormalizeLine(const SourceManager , FullSourceLoc , - const Decl *D) { + const LangOptions ) { static StringRef Whitespaces = " \t\n"; - const LangOptions = D->getASTContext().getLangOpts(); StringRef Str = GetNthLineOfFile(SM.getBuffer(L.getFileID(), L), L.getExpansionLineNumber()); unsigned col = Str.find_first_not_of(Whitespaces); - + col++; SourceLocation StartOfLine = SM.translateLineCol(SM.getFileID(L), L.getExpansionLineNumber(), col); llvm::MemoryBuffer *Buffer = @@ -145,7 +144,7 @@ const char *BufferPos = SM.getCharacterData(StartOfLine); Token Token; - Lexer Lexer(SM.getLocForStartOfFile(SM.getFileID(StartOfLine)), Opts, + Lexer Lexer(SM.getLocForStartOfFile(SM.getFileID(StartOfLine)), LangOpts, Buffer->getBufferStart(), BufferPos, Buffer->getBufferEnd()); size_t NextStart = 0; @@ -175,20 +174,23 @@ std::string clang::GetIssueString(const SourceManager , FullSourceLoc , StringRef CheckerName, StringRef BugType, - const Decl *D) { + const Decl *D, + const LangOptions ) { static StringRef Delimiter = "$"; return (llvm::Twine(CheckerName) + Delimiter + GetEnclosingDeclContextSignature(D) + Delimiter + llvm::utostr(IssueLoc.getExpansionColumnNumber()) + Delimiter + - NormalizeLine(SM, IssueLoc, D) + Delimiter + BugType) + NormalizeLine(SM, IssueLoc, LangOpts) + Delimiter + BugType)
Re: [PATCH] D14864: [X86] Support for C calling convention only for MCU target.
DavidKreitzer added a comment. Looks good, Alexey! I have no further comments. - Dave http://reviews.llvm.org/D14864 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D14935: Fix nodefaultlibs/nostdlib check
niravd created this revision. niravd added reviewers: dougk, jyknight. niravd added subscribers: cfe-commits, rsmith. Checks for nostdlib should also always check nodefaultlibs or nostartfiles as appropriate. Clang Driver misses a case http://reviews.llvm.org/D14935 Files: lib/Driver/Driver.cpp test/Driver/nodefaultlib_stdc.c Index: test/Driver/nodefaultlib_stdc.c === --- /dev/null +++ test/Driver/nodefaultlib_stdc.c @@ -0,0 +1,3 @@ +// RUN: %clang -stdlib=libc++ -nodefaultlibs -lstdc++ -### %s 2>&1 | FileCheck %s +// CHECK-NOT: "-lc++" +// CHECK: "-lstdc++" Index: lib/Driver/Driver.cpp === --- lib/Driver/Driver.cpp +++ lib/Driver/Driver.cpp @@ -209,6 +209,7 @@ DerivedArgList *DAL = new DerivedArgList(Args); bool HasNostdlib = Args.hasArg(options::OPT_nostdlib); + bool HasNodefaultlib = Args.hasArg(options::OPT_nodefaultlibs); for (Arg *A : Args) { // Unfortunately, we have to parse some forwarding options (-Xassembler, // -Xlinker, -Xpreprocessor) because we either integrate their functionality @@ -252,7 +253,7 @@ StringRef Value = A->getValue(); // Rewrite unless -nostdlib is present. - if (!HasNostdlib && Value == "stdc++") { + if (!HasNostdlib && !HasNodefaultlib && Value == "stdc++") { DAL->AddFlagArg(A, Opts->getOption(options::OPT_Z_reserved_lib_stdcxx)); continue; } Index: test/Driver/nodefaultlib_stdc.c === --- /dev/null +++ test/Driver/nodefaultlib_stdc.c @@ -0,0 +1,3 @@ +// RUN: %clang -stdlib=libc++ -nodefaultlibs -lstdc++ -### %s 2>&1 | FileCheck %s +// CHECK-NOT: "-lc++" +// CHECK: "-lstdc++" Index: lib/Driver/Driver.cpp === --- lib/Driver/Driver.cpp +++ lib/Driver/Driver.cpp @@ -209,6 +209,7 @@ DerivedArgList *DAL = new DerivedArgList(Args); bool HasNostdlib = Args.hasArg(options::OPT_nostdlib); + bool HasNodefaultlib = Args.hasArg(options::OPT_nodefaultlibs); for (Arg *A : Args) { // Unfortunately, we have to parse some forwarding options (-Xassembler, // -Xlinker, -Xpreprocessor) because we either integrate their functionality @@ -252,7 +253,7 @@ StringRef Value = A->getValue(); // Rewrite unless -nostdlib is present. - if (!HasNostdlib && Value == "stdc++") { + if (!HasNostdlib && !HasNodefaultlib && Value == "stdc++") { DAL->AddFlagArg(A, Opts->getOption(options::OPT_Z_reserved_lib_stdcxx)); continue; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D14954: [x86] Exclusion of incorrect include headers paths for MCU target
andreybokhanko created this revision. andreybokhanko added reviewers: ddunbar, rnk, mkuper. andreybokhanko added a subscriber: cfe-commits. This patch excludes incorrect include headers paths for MCU target. http://reviews.llvm.org/D14954 Files: lib/Frontend/InitHeaderSearch.cpp test/Driver/elfiamcu-header-search.c Index: lib/Frontend/InitHeaderSearch.cpp === --- lib/Frontend/InitHeaderSearch.cpp +++ lib/Frontend/InitHeaderSearch.cpp @@ -216,6 +216,7 @@ case llvm::Triple::Bitrig: case llvm::Triple::NaCl: case llvm::Triple::PS4: +case llvm::Triple::ELFIAMCU: break; case llvm::Triple::Win32: if (triple.getEnvironment() != llvm::Triple::Cygnus) @@ -318,6 +319,7 @@ case llvm::Triple::CloudABI: case llvm::Triple::RTEMS: case llvm::Triple::NaCl: + case llvm::Triple::ELFIAMCU: break; case llvm::Triple::PS4: { // gets prepended later in AddPath(). Index: test/Driver/elfiamcu-header-search.c === --- test/Driver/elfiamcu-header-search.c +++ test/Driver/elfiamcu-header-search.c @@ -0,0 +1,6 @@ +// REQUIRES: x86-registered-target + +// RUN: %clang -target i386-pc-elfiamcu -c -v %s 2>&1 | FileCheck %s +// CHECK-NOT: /usr/include +// CHECK-NOT: /usr/local/include + Index: lib/Frontend/InitHeaderSearch.cpp === --- lib/Frontend/InitHeaderSearch.cpp +++ lib/Frontend/InitHeaderSearch.cpp @@ -216,6 +216,7 @@ case llvm::Triple::Bitrig: case llvm::Triple::NaCl: case llvm::Triple::PS4: +case llvm::Triple::ELFIAMCU: break; case llvm::Triple::Win32: if (triple.getEnvironment() != llvm::Triple::Cygnus) @@ -318,6 +319,7 @@ case llvm::Triple::CloudABI: case llvm::Triple::RTEMS: case llvm::Triple::NaCl: + case llvm::Triple::ELFIAMCU: break; case llvm::Triple::PS4: { // gets prepended later in AddPath(). Index: test/Driver/elfiamcu-header-search.c === --- test/Driver/elfiamcu-header-search.c +++ test/Driver/elfiamcu-header-search.c @@ -0,0 +1,6 @@ +// REQUIRES: x86-registered-target + +// RUN: %clang -target i386-pc-elfiamcu -c -v %s 2>&1 | FileCheck %s +// CHECK-NOT: /usr/include +// CHECK-NOT: /usr/local/include + ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r253886 - Disable frame pointer elimination when using -pg
Hi, David Blaikie via cfe-commits wrote: > On Mon, Nov 23, 2015 at 9:30 AM, Xinliang David Li via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > > > Author: davidxl > > Date: Mon Nov 23 11:30:31 2015 > > New Revision: 253886 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=253886=rev > > Log: > > Disable frame pointer elimination when using -pg > > > > (Re-apply patch after bug fixing) > > > > It's helpful to describe what the bug fixing was (& test changes to ensure > it's covered (if it fails only on some subset of buildbots usually a test > case can be added so it would fail on any buildbot/locally, which is a good > idea to help proactively avoid regressions in the future)) when > recommitting a patch. the patch that David initally committed contained a test case that was x86 specific. Thus it would fail on the AArch64 buildbot, for example. The bug fix in the re-commited patch was to fix the test case to run only when clang was configured with the x86 target. > > > > This diff makes sure that the driver does not pass > > -fomit-frame-pointer or -momit-leaf-frame-pointer to > > the frontend when -pg is used. Currently, clang gives > > an error if -fomit-frame-pointer is used in combination > > with -pg, but -momit-leaf-frame-pointer was forgotten. > > Also, disable frame pointer elimination in the frontend > > when -pg is set. > > > > Patch by Stefan Kempf. > > > > Added: > > cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c > > Modified: > > cfe/trunk/lib/Driver/Tools.cpp > > cfe/trunk/lib/Frontend/CompilerInvocation.cpp > > > > Modified: cfe/trunk/lib/Driver/Tools.cpp > > URL: > > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=253886=253885=253886=diff > > > > == > > --- cfe/trunk/lib/Driver/Tools.cpp (original) > > +++ cfe/trunk/lib/Driver/Tools.cpp Mon Nov 23 11:30:31 2015 > > @@ -2794,6 +2794,8 @@ static bool shouldUseFramePointer(const > >if (Arg *A = Args.getLastArg(options::OPT_fno_omit_frame_pointer, > > options::OPT_fomit_frame_pointer)) > > return A->getOption().matches(options::OPT_fno_omit_frame_pointer); > > + if (Args.hasArg(options::OPT_pg)) > > +return true; > > > >return shouldUseFramePointerForTarget(Args, Triple); > > } > > @@ -2803,6 +2805,8 @@ static bool shouldUseLeafFramePointer(co > >if (Arg *A = Args.getLastArg(options::OPT_mno_omit_leaf_frame_pointer, > > options::OPT_momit_leaf_frame_pointer)) > > return > > A->getOption().matches(options::OPT_mno_omit_leaf_frame_pointer); > > + if (Args.hasArg(options::OPT_pg)) > > +return true; > > > >if (Triple.isPS4CPU()) > > return false; > > > > Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp > > URL: > > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=253886=253885=253886=diff > > > > == > > --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) > > +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Nov 23 11:30:31 2015 > > @@ -453,7 +453,8 @@ static bool ParseCodeGenArgs(CodeGenOpti > >Opts.CXXCtorDtorAliases = Args.hasArg(OPT_mconstructor_aliases); > >Opts.CodeModel = getCodeModel(Args, Diags); > >Opts.DebugPass = Args.getLastArgValue(OPT_mdebug_pass); > > - Opts.DisableFPElim = Args.hasArg(OPT_mdisable_fp_elim); > > + Opts.DisableFPElim = > > + (Args.hasArg(OPT_mdisable_fp_elim) || Args.hasArg(OPT_pg)); > >Opts.DisableFree = Args.hasArg(OPT_disable_free); > >Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls); > >Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi); > > > > Added: cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c > > URL: > > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c?rev=253886=auto > > > > == > > --- cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c (added) > > +++ cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c Mon Nov 23 11:30:31 > > 2015 > > @@ -0,0 +1,14 @@ > > +// REQUIRES: x86-registered-target > > +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O3 -pg -S -o - %s | \ > > +// RUN: FileCheck %s > > +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O3 > > -momit-leaf-frame-pointer -pg -S -o - %s | \ > > +// RUN: FileCheck %s > > + > > +// Test that the frame pointer is kept when compiling with > > +// profiling. > > + > > +//CHECK: pushq %rbp > > +int main(void) > > +{ > > + return 0; > > +} > > > > > > ___ > > cfe-commits mailing list > > cfe-commits@lists.llvm.org > > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org >