[PATCH] D42019: [Driver] Set default sysroot for Fuchsia if none is specified
mcgrathr added a comment. Is this still live? Should it be different after all the multiarch stuff? Repository: rC Clang https://reviews.llvm.org/D42019 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r337091 - [clang-tidy] Force exceptions to be enabled in test
Author: d0k Date: Sat Jul 14 03:48:06 2018 New Revision: 337091 URL: http://llvm.org/viewvc/llvm-project?rev=337091&view=rev Log: [clang-tidy] Force exceptions to be enabled in test For targets that have them off by default. Modified: clang-tools-extra/trunk/test/clang-tidy/bugprone-exception-escape.cpp Modified: clang-tools-extra/trunk/test/clang-tidy/bugprone-exception-escape.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/bugprone-exception-escape.cpp?rev=337091&r1=337090&r2=337091&view=diff == --- clang-tools-extra/trunk/test/clang-tidy/bugprone-exception-escape.cpp (original) +++ clang-tools-extra/trunk/test/clang-tidy/bugprone-exception-escape.cpp Sat Jul 14 03:48:06 2018 @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy %s bugprone-exception-escape %t -- -extra-arg=-std=c++11 -config="{CheckOptions: [{key: bugprone-exception-escape.IgnoredExceptions, value: 'ignored1,ignored2'}, {key: bugprone-exception-escape.FunctionsThatShouldNotThrow, value: 'enabled1,enabled2,enabled3'}]}" -- +// RUN: %check_clang_tidy %s bugprone-exception-escape %t -- -extra-arg=-std=c++11 -extra-arg=-fexceptions -config="{CheckOptions: [{key: bugprone-exception-escape.IgnoredExceptions, value: 'ignored1,ignored2'}, {key: bugprone-exception-escape.FunctionsThatShouldNotThrow, value: 'enabled1,enabled2,enabled3'}]}" -- struct throwing_destructor { ~throwing_destructor() { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D45444: [clang-tidy] implement new check for const-correctness
JonasToth added a comment. Time :/ Am 14.07.2018 um 16:34 schrieb Roman Lebedev via Phabricator: > lebedev.ri added a comment. > > Ping, i guess :) > Anything needed to get this going? > > Repository: > > rCTE Clang Tools Extra > > https://reviews.llvm.org/D45444 Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D45444 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D45444: [clang-tidy] implement new check for const-correctness
lebedev.ri added a comment. Ping, i guess :) Anything needed to get this going? Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D45444 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D37057: [clang] Require address space to be specified when creating functions (3/3)
dylanmckay abandoned this revision. dylanmckay added a comment. Superseded by https://reviews.llvm.org/D47541 Repository: rC Clang https://reviews.llvm.org/D37057 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48981: Add caching when looking up coroutine_traits
modocache accepted this revision. modocache added a comment. This revision is now accepted and ready to land. Yup, LGTM! I'll land this now. Repository: rC Clang https://reviews.llvm.org/D48981 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r337103 - Add caching when looking up coroutine_traits
Author: modocache Date: Sat Jul 14 11:21:44 2018 New Revision: 337103 URL: http://llvm.org/viewvc/llvm-project?rev=337103&view=rev Log: Add caching when looking up coroutine_traits Summary: Currently clang looks up the coroutine_traits ClassTemplateDecl everytime it looks up the promise type. This is unnecessary as coroutine_traits doesn't change between promise type lookups. This diff caches the coroutine_traits lookup. Patch by Tanoy Sinha! Test Plan: I added log statements in the new lookupCoroutineTraits function to ensure that LookupQualifiedName was only called once even when multiple coroutines existed in the source file. Reviewers: modocache, GorNishanov Reviewed By: modocache Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48981 Modified: cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/Sema/Sema.cpp cfe/trunk/lib/Sema/SemaCoroutine.cpp Modified: cfe/trunk/include/clang/Sema/Sema.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=337103&r1=337102&r2=337103&view=diff == --- cfe/trunk/include/clang/Sema/Sema.h (original) +++ cfe/trunk/include/clang/Sema/Sema.h Sat Jul 14 11:21:44 2018 @@ -824,6 +824,10 @@ public: /// \. ClassTemplateDecl *StdInitializerList; + /// The C++ "std::coroutine_traits" template, which is defined in + /// \ + ClassTemplateDecl *StdCoroutineTraitsCache; + /// The C++ "type_info" declaration, which is defined in \. RecordDecl *CXXTypeInfoDecl; @@ -8536,6 +8540,8 @@ public: bool buildCoroutineParameterMoves(SourceLocation Loc); VarDecl *buildCoroutinePromise(SourceLocation Loc); void CheckCompletedCoroutineBody(FunctionDecl *FD, Stmt *&Body); + ClassTemplateDecl *lookupCoroutineTraits(SourceLocation KwLoc, + SourceLocation FuncLoc); //======// // OpenCL extensions. Modified: cfe/trunk/lib/Sema/Sema.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=337103&r1=337102&r2=337103&view=diff == --- cfe/trunk/lib/Sema/Sema.cpp (original) +++ cfe/trunk/lib/Sema/Sema.cpp Sat Jul 14 11:21:44 2018 @@ -131,9 +131,9 @@ Sema::Sema(Preprocessor &pp, ASTContext IsBuildingRecoveryCallExpr(false), Cleanup{}, LateTemplateParser(nullptr), LateTemplateParserCleanup(nullptr), OpaqueParser(nullptr), IdResolver(pp), StdExperimentalNamespaceCache(nullptr), StdInitializerList(nullptr), - CXXTypeInfoDecl(nullptr), MSVCGuidDecl(nullptr), NSNumberDecl(nullptr), - NSValueDecl(nullptr), NSStringDecl(nullptr), - StringWithUTF8StringMethod(nullptr), + StdCoroutineTraitsCache(nullptr), CXXTypeInfoDecl(nullptr), + MSVCGuidDecl(nullptr), NSNumberDecl(nullptr), NSValueDecl(nullptr), + NSStringDecl(nullptr), StringWithUTF8StringMethod(nullptr), ValueWithBytesObjCTypeMethod(nullptr), NSArrayDecl(nullptr), ArrayWithObjectsMethod(nullptr), NSDictionaryDecl(nullptr), DictionaryWithObjectsMethod(nullptr), GlobalNewDeleteDeclared(false), Modified: cfe/trunk/lib/Sema/SemaCoroutine.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCoroutine.cpp?rev=337103&r1=337102&r2=337103&view=diff == --- cfe/trunk/lib/Sema/SemaCoroutine.cpp (original) +++ cfe/trunk/lib/Sema/SemaCoroutine.cpp Sat Jul 14 11:21:44 2018 @@ -60,20 +60,8 @@ static QualType lookupPromiseType(Sema & return QualType(); } - LookupResult Result(S, &S.PP.getIdentifierTable().get("coroutine_traits"), - FuncLoc, Sema::LookupOrdinaryName); - if (!S.LookupQualifiedName(Result, StdExp)) { -S.Diag(KwLoc, diag::err_implied_coroutine_type_not_found) -<< "std::experimental::coroutine_traits"; -return QualType(); - } - - ClassTemplateDecl *CoroTraits = Result.getAsSingle(); + ClassTemplateDecl *CoroTraits = S.lookupCoroutineTraits(KwLoc, FuncLoc); if (!CoroTraits) { -Result.suppressDiagnostics(); -// We found something weird. Complain about the first thing we found. -NamedDecl *Found = *Result.begin(); -S.Diag(Found->getLocation(), diag::err_malformed_std_coroutine_traits); return QualType(); } @@ -1538,3 +1526,27 @@ StmtResult Sema::BuildCoroutineBodyStmt( return StmtError(); return Res; } + +ClassTemplateDecl *Sema::lookupCoroutineTraits(SourceLocation KwLoc, + SourceLocation FuncLoc) { + if (!StdCoroutineTraitsCache) { +if (auto StdExp = lookupStdExperimentalNamespace()) { + LookupResult Result(*this, + &PP.getIdentifierTable().get("coroutine_traits"), + FuncLoc, LookupOrdinaryName); + if (!LookupQualif
[PATCH] D48981: Add caching when looking up coroutine_traits
This revision was automatically updated to reflect the committed changes. Closed by commit rL337103: Add caching when looking up coroutine_traits (authored by modocache, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D48981 Files: cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/Sema/Sema.cpp cfe/trunk/lib/Sema/SemaCoroutine.cpp Index: cfe/trunk/lib/Sema/Sema.cpp === --- cfe/trunk/lib/Sema/Sema.cpp +++ cfe/trunk/lib/Sema/Sema.cpp @@ -131,9 +131,9 @@ IsBuildingRecoveryCallExpr(false), Cleanup{}, LateTemplateParser(nullptr), LateTemplateParserCleanup(nullptr), OpaqueParser(nullptr), IdResolver(pp), StdExperimentalNamespaceCache(nullptr), StdInitializerList(nullptr), - CXXTypeInfoDecl(nullptr), MSVCGuidDecl(nullptr), NSNumberDecl(nullptr), - NSValueDecl(nullptr), NSStringDecl(nullptr), - StringWithUTF8StringMethod(nullptr), + StdCoroutineTraitsCache(nullptr), CXXTypeInfoDecl(nullptr), + MSVCGuidDecl(nullptr), NSNumberDecl(nullptr), NSValueDecl(nullptr), + NSStringDecl(nullptr), StringWithUTF8StringMethod(nullptr), ValueWithBytesObjCTypeMethod(nullptr), NSArrayDecl(nullptr), ArrayWithObjectsMethod(nullptr), NSDictionaryDecl(nullptr), DictionaryWithObjectsMethod(nullptr), GlobalNewDeleteDeclared(false), Index: cfe/trunk/lib/Sema/SemaCoroutine.cpp === --- cfe/trunk/lib/Sema/SemaCoroutine.cpp +++ cfe/trunk/lib/Sema/SemaCoroutine.cpp @@ -60,20 +60,8 @@ return QualType(); } - LookupResult Result(S, &S.PP.getIdentifierTable().get("coroutine_traits"), - FuncLoc, Sema::LookupOrdinaryName); - if (!S.LookupQualifiedName(Result, StdExp)) { -S.Diag(KwLoc, diag::err_implied_coroutine_type_not_found) -<< "std::experimental::coroutine_traits"; -return QualType(); - } - - ClassTemplateDecl *CoroTraits = Result.getAsSingle(); + ClassTemplateDecl *CoroTraits = S.lookupCoroutineTraits(KwLoc, FuncLoc); if (!CoroTraits) { -Result.suppressDiagnostics(); -// We found something weird. Complain about the first thing we found. -NamedDecl *Found = *Result.begin(); -S.Diag(Found->getLocation(), diag::err_malformed_std_coroutine_traits); return QualType(); } @@ -1538,3 +1526,27 @@ return StmtError(); return Res; } + +ClassTemplateDecl *Sema::lookupCoroutineTraits(SourceLocation KwLoc, + SourceLocation FuncLoc) { + if (!StdCoroutineTraitsCache) { +if (auto StdExp = lookupStdExperimentalNamespace()) { + LookupResult Result(*this, + &PP.getIdentifierTable().get("coroutine_traits"), + FuncLoc, LookupOrdinaryName); + if (!LookupQualifiedName(Result, StdExp)) { +Diag(KwLoc, diag::err_implied_coroutine_type_not_found) +<< "std::experimental::coroutine_traits"; +return nullptr; + } + if (!(StdCoroutineTraitsCache = +Result.getAsSingle())) { +Result.suppressDiagnostics(); +NamedDecl *Found = *Result.begin(); +Diag(Found->getLocation(), diag::err_malformed_std_coroutine_traits); +return nullptr; + } +} + } + return StdCoroutineTraitsCache; +} Index: cfe/trunk/include/clang/Sema/Sema.h === --- cfe/trunk/include/clang/Sema/Sema.h +++ cfe/trunk/include/clang/Sema/Sema.h @@ -824,6 +824,10 @@ /// \. ClassTemplateDecl *StdInitializerList; + /// The C++ "std::coroutine_traits" template, which is defined in + /// \ + ClassTemplateDecl *StdCoroutineTraitsCache; + /// The C++ "type_info" declaration, which is defined in \. RecordDecl *CXXTypeInfoDecl; @@ -8536,6 +8540,8 @@ bool buildCoroutineParameterMoves(SourceLocation Loc); VarDecl *buildCoroutinePromise(SourceLocation Loc); void CheckCompletedCoroutineBody(FunctionDecl *FD, Stmt *&Body); + ClassTemplateDecl *lookupCoroutineTraits(SourceLocation KwLoc, + SourceLocation FuncLoc); //======// // OpenCL extensions. Index: cfe/trunk/lib/Sema/Sema.cpp === --- cfe/trunk/lib/Sema/Sema.cpp +++ cfe/trunk/lib/Sema/Sema.cpp @@ -131,9 +131,9 @@ IsBuildingRecoveryCallExpr(false), Cleanup{}, LateTemplateParser(nullptr), LateTemplateParserCleanup(nullptr), OpaqueParser(nullptr), IdResolver(pp), StdExperimentalNamespaceCache(nullptr), StdInitializerList(nullptr), - CXXTypeInfoDecl(nullptr), MSVCGuidDecl(nullptr), NSNumberDecl(nullptr), - NSValueDecl(nullptr), NSStringDecl(nullptr), - StringWithUTF8StringMethod(nullptr), + StdCoroutineTraitsCache(null
[PATCH] D45444: [clang-tidy] implement new check for const-correctness
0x8000- added a comment. In https://reviews.llvm.org/D45444#1162715, @JonasToth wrote: > Time :/ Is this available as a public Git branch somewhere, or is downloading the diff the preferred way to interact with this code? Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D45444 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48873: [AST] Use llvm::TrailingObjects in CXXTryStmt
bricci updated this revision to Diff 155563. bricci retitled this revision from "[AST] Use llvm::TrailingObjects in clang::CXXTryStmt" to "[AST] Use llvm::TrailingObjects in CXXTryStmt". bricci edited the summary of this revision. bricci added reviewers: arphaman, bkramer. bricci added a comment. 1. Remove unnecessary use of getTrailingObjects and use getStmts instead. 2. Move friend class ASTStmtReader; to the top with the other friend declaration. 3. Reword message. Repository: rC Clang https://reviews.llvm.org/D48873 Files: include/clang/AST/StmtCXX.h lib/AST/StmtCXX.cpp Index: lib/AST/StmtCXX.cpp === --- lib/AST/StmtCXX.cpp +++ lib/AST/StmtCXX.cpp @@ -40,7 +40,7 @@ CXXTryStmt::CXXTryStmt(SourceLocation tryLoc, Stmt *tryBlock, ArrayRef handlers) : Stmt(CXXTryStmtClass), TryLoc(tryLoc), NumHandlers(handlers.size()) { - Stmt **Stmts = getTrailingObjects(); + Stmt **Stmts = getStmts(); Stmts[0] = tryBlock; std::copy(handlers.begin(), handlers.end(), Stmts + 1); } Index: include/clang/AST/StmtCXX.h === --- include/clang/AST/StmtCXX.h +++ include/clang/AST/StmtCXX.h @@ -66,6 +66,7 @@ private llvm::TrailingObjects { friend TrailingObjects; + friend class ASTStmtReader; SourceLocation TryLoc; unsigned NumHandlers; @@ -90,34 +91,31 @@ SourceLocation getTryLoc() const { return TryLoc; } SourceLocation getEndLoc() const { -return getTrailingObjects()[NumHandlers]->getLocEnd(); +return getStmts()[NumHandlers]->getLocEnd(); } CompoundStmt *getTryBlock() { -return cast(getTrailingObjects()[0]); +return cast(getStmts()[0]); } const CompoundStmt *getTryBlock() const { -return cast(getTrailingObjects()[0]); +return cast(getStmts()[0]); } unsigned getNumHandlers() const { return NumHandlers; } CXXCatchStmt *getHandler(unsigned i) { -return cast(getTrailingObjects()[i + 1]); +return cast(getStmts()[i + 1]); } const CXXCatchStmt *getHandler(unsigned i) const { -return cast(getTrailingObjects()[i + 1]); +return cast(getStmts()[i + 1]); } static bool classof(const Stmt *T) { return T->getStmtClass() == CXXTryStmtClass; } child_range children() { -return child_range(getTrailingObjects(), - getTrailingObjects() + getNumHandlers() + 1); +return child_range(getStmts(), getStmts() + getNumHandlers() + 1); } - - friend class ASTStmtReader; }; /// CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for Index: lib/AST/StmtCXX.cpp === --- lib/AST/StmtCXX.cpp +++ lib/AST/StmtCXX.cpp @@ -40,7 +40,7 @@ CXXTryStmt::CXXTryStmt(SourceLocation tryLoc, Stmt *tryBlock, ArrayRef handlers) : Stmt(CXXTryStmtClass), TryLoc(tryLoc), NumHandlers(handlers.size()) { - Stmt **Stmts = getTrailingObjects(); + Stmt **Stmts = getStmts(); Stmts[0] = tryBlock; std::copy(handlers.begin(), handlers.end(), Stmts + 1); } Index: include/clang/AST/StmtCXX.h === --- include/clang/AST/StmtCXX.h +++ include/clang/AST/StmtCXX.h @@ -66,6 +66,7 @@ private llvm::TrailingObjects { friend TrailingObjects; + friend class ASTStmtReader; SourceLocation TryLoc; unsigned NumHandlers; @@ -90,34 +91,31 @@ SourceLocation getTryLoc() const { return TryLoc; } SourceLocation getEndLoc() const { -return getTrailingObjects()[NumHandlers]->getLocEnd(); +return getStmts()[NumHandlers]->getLocEnd(); } CompoundStmt *getTryBlock() { -return cast(getTrailingObjects()[0]); +return cast(getStmts()[0]); } const CompoundStmt *getTryBlock() const { -return cast(getTrailingObjects()[0]); +return cast(getStmts()[0]); } unsigned getNumHandlers() const { return NumHandlers; } CXXCatchStmt *getHandler(unsigned i) { -return cast(getTrailingObjects()[i + 1]); +return cast(getStmts()[i + 1]); } const CXXCatchStmt *getHandler(unsigned i) const { -return cast(getTrailingObjects()[i + 1]); +return cast(getStmts()[i + 1]); } static bool classof(const Stmt *T) { return T->getStmtClass() == CXXTryStmtClass; } child_range children() { -return child_range(getTrailingObjects(), - getTrailingObjects() + getNumHandlers() + 1); +return child_range(getStmts(), getStmts() + getNumHandlers() + 1); } - - friend class ASTStmtReader; }; /// CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48873: [AST] Use llvm::TrailingObjects in CXXTryStmt
bricci updated this revision to Diff 155564. bricci added a comment. wrong diff Repository: rC Clang https://reviews.llvm.org/D48873 Files: include/clang/AST/StmtCXX.h lib/AST/StmtCXX.cpp Index: lib/AST/StmtCXX.cpp === --- lib/AST/StmtCXX.cpp +++ lib/AST/StmtCXX.cpp @@ -25,26 +25,22 @@ CXXTryStmt *CXXTryStmt::Create(const ASTContext &C, SourceLocation tryLoc, Stmt *tryBlock, ArrayRef handlers) { - std::size_t Size = sizeof(CXXTryStmt); - Size += ((handlers.size() + 1) * sizeof(Stmt *)); - + const size_t Size = totalSizeToAlloc(handlers.size() + 1); void *Mem = C.Allocate(Size, alignof(CXXTryStmt)); return new (Mem) CXXTryStmt(tryLoc, tryBlock, handlers); } CXXTryStmt *CXXTryStmt::Create(const ASTContext &C, EmptyShell Empty, unsigned numHandlers) { - std::size_t Size = sizeof(CXXTryStmt); - Size += ((numHandlers + 1) * sizeof(Stmt *)); - + const size_t Size = totalSizeToAlloc(numHandlers + 1); void *Mem = C.Allocate(Size, alignof(CXXTryStmt)); return new (Mem) CXXTryStmt(Empty, numHandlers); } CXXTryStmt::CXXTryStmt(SourceLocation tryLoc, Stmt *tryBlock, ArrayRef handlers) : Stmt(CXXTryStmtClass), TryLoc(tryLoc), NumHandlers(handlers.size()) { - Stmt **Stmts = reinterpret_cast(this + 1); + Stmt **Stmts = getStmts(); Stmts[0] = tryBlock; std::copy(handlers.begin(), handlers.end(), Stmts + 1); } Index: include/clang/AST/StmtCXX.h === --- include/clang/AST/StmtCXX.h +++ include/clang/AST/StmtCXX.h @@ -62,21 +62,22 @@ /// CXXTryStmt - A C++ try block, including all handlers. /// -class CXXTryStmt : public Stmt { +class CXXTryStmt final : public Stmt, + private llvm::TrailingObjects { + + friend TrailingObjects; + friend class ASTStmtReader; + SourceLocation TryLoc; unsigned NumHandlers; + size_t numTrailingObjects(OverloadToken) const { return NumHandlers; } CXXTryStmt(SourceLocation tryLoc, Stmt *tryBlock, ArrayRef handlers); - CXXTryStmt(EmptyShell Empty, unsigned numHandlers) : Stmt(CXXTryStmtClass), NumHandlers(numHandlers) { } - Stmt const * const *getStmts() const { -return reinterpret_cast(this + 1); - } - Stmt **getStmts() { -return reinterpret_cast(this + 1); - } + Stmt * const *getStmts() const { return getTrailingObjects(); } + Stmt **getStmts() { return getTrailingObjects(); } public: static CXXTryStmt *Create(const ASTContext &C, SourceLocation tryLoc, @@ -115,8 +116,6 @@ child_range children() { return child_range(getStmts(), getStmts() + getNumHandlers() + 1); } - - friend class ASTStmtReader; }; /// CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for Index: lib/AST/StmtCXX.cpp === --- lib/AST/StmtCXX.cpp +++ lib/AST/StmtCXX.cpp @@ -25,26 +25,22 @@ CXXTryStmt *CXXTryStmt::Create(const ASTContext &C, SourceLocation tryLoc, Stmt *tryBlock, ArrayRef handlers) { - std::size_t Size = sizeof(CXXTryStmt); - Size += ((handlers.size() + 1) * sizeof(Stmt *)); - + const size_t Size = totalSizeToAlloc(handlers.size() + 1); void *Mem = C.Allocate(Size, alignof(CXXTryStmt)); return new (Mem) CXXTryStmt(tryLoc, tryBlock, handlers); } CXXTryStmt *CXXTryStmt::Create(const ASTContext &C, EmptyShell Empty, unsigned numHandlers) { - std::size_t Size = sizeof(CXXTryStmt); - Size += ((numHandlers + 1) * sizeof(Stmt *)); - + const size_t Size = totalSizeToAlloc(numHandlers + 1); void *Mem = C.Allocate(Size, alignof(CXXTryStmt)); return new (Mem) CXXTryStmt(Empty, numHandlers); } CXXTryStmt::CXXTryStmt(SourceLocation tryLoc, Stmt *tryBlock, ArrayRef handlers) : Stmt(CXXTryStmtClass), TryLoc(tryLoc), NumHandlers(handlers.size()) { - Stmt **Stmts = reinterpret_cast(this + 1); + Stmt **Stmts = getStmts(); Stmts[0] = tryBlock; std::copy(handlers.begin(), handlers.end(), Stmts + 1); } Index: include/clang/AST/StmtCXX.h === --- include/clang/AST/StmtCXX.h +++ include/clang/AST/StmtCXX.h @@ -62,21 +62,22 @@ /// CXXTryStmt - A C++ try block, including all handlers. /// -class CXXTryStmt : public Stmt { +class CXXTryStmt final : public Stmt, + private llvm::TrailingObjects { + + friend TrailingObjects; + friend class ASTStmtReader; + SourceLocation TryLoc; unsigned NumHandlers; + size_t numTrailingObjects(OverloadToken) const { return NumHandlers; } CXXTryStmt(SourceLocation tryLoc, Stmt *tryBlock, ArrayRef handlers); - CXXTryStmt(EmptyShell Empty, unsigned numHandlers) : Stmt(CXXTryStmtClass), NumHandlers(numHandlers) { } - Stmt const * const *getStm
[PATCH] D45805: [libcxx] Remove redundant specializations in type_traits.
MaskRay added a comment. Herald added a subscriber: ldionne. Ping :) Repository: rCXX libc++ https://reviews.llvm.org/D45805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r337117 - [CMake] Use libc++ and compiler-rt for sanitizers
Author: phosek Date: Sat Jul 14 20:11:43 2018 New Revision: 337117 URL: http://llvm.org/viewvc/llvm-project?rev=337117&view=rev Log: [CMake] Use libc++ and compiler-rt for sanitizers When building runtimes for Linux as part of Fuchsia toolchain, use libc++ and compiler-rt for sanitizers. Differential Revision: https://reviews.llvm.org/D49331 Modified: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake Modified: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/Fuchsia-stage2.cmake?rev=337117&r1=337116&r2=337117&view=diff == --- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake (original) +++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake Sat Jul 14 20:11:43 2018 @@ -57,6 +57,9 @@ elseif(UNIX) set(RUNTIMES_${target}-linux-gnu_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "") set(RUNTIMES_${target}-linux-gnu_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "") set(RUNTIMES_${target}-linux-gnu_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "") + set(RUNTIMES_${target}-linux-gnu_SANITIZER_CXX_ABI "libc++" CACHE STRING "") + set(RUNTIMES_${target}-linux-gnu_SANITIZER_CXX_ABI_INTREE ON CACHE BOOL "") + set(RUNTIMES_${target}-linux-gnu_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "") endif() endforeach() endif() @@ -100,7 +103,6 @@ if(FUCHSIA_SDK) set(RUNTIMES_${target}-fuchsia_LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "") set(RUNTIMES_${target}-fuchsia_LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") set(RUNTIMES_${target}-fuchsia_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "") -set(RUNTIMES_${target}-fuchsia_SANITIZER_USE_COMPILER_RT ON CACHE BOOL "") endforeach() set(LLVM_RUNTIME_SANITIZERS "Address" CACHE STRING "") ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49345: [CMake] Use correct variable as header install prefix
phosek created this revision. phosek added reviewers: EricWF, mclow.lists, beanz. Herald added subscribers: cfe-commits, ldionne, christof, mgorny. This variable is already set in CMakeLists.txt but it wasn't used which means that the headers get installed into a wrong location when the per target runtime directory option is being used. Repository: rCXX libc++ https://reviews.llvm.org/D49345 Files: libcxx/include/CMakeLists.txt Index: libcxx/include/CMakeLists.txt === --- libcxx/include/CMakeLists.txt +++ libcxx/include/CMakeLists.txt @@ -239,16 +239,16 @@ foreach(file ${files}) get_filename_component(dir ${file} DIRECTORY) install(FILES ${file} - DESTINATION ${LIBCXX_INSTALL_PATH}include/c++/v1/${dir} + DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir} COMPONENT cxx-headers PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) endforeach() if (LIBCXX_NEEDS_SITE_CONFIG) # Install the generated header as __config. install(FILES ${LIBCXX_BINARY_DIR}/__generated_config - DESTINATION ${LIBCXX_INSTALL_PATH}include/c++/v1 + DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ RENAME __config COMPONENT cxx-headers) Index: libcxx/include/CMakeLists.txt === --- libcxx/include/CMakeLists.txt +++ libcxx/include/CMakeLists.txt @@ -239,16 +239,16 @@ foreach(file ${files}) get_filename_component(dir ${file} DIRECTORY) install(FILES ${file} - DESTINATION ${LIBCXX_INSTALL_PATH}include/c++/v1/${dir} + DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir} COMPONENT cxx-headers PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) endforeach() if (LIBCXX_NEEDS_SITE_CONFIG) # Install the generated header as __config. install(FILES ${LIBCXX_BINARY_DIR}/__generated_config - DESTINATION ${LIBCXX_INSTALL_PATH}include/c++/v1 + DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ RENAME __config COMPONENT cxx-headers) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48287: [HIP] Support -fcuda-flush-denormals-to-zero for amdgcn
yaxunl updated this revision to Diff 155580. yaxunl added a comment. Replace LangOpts.CUDADeviceFlushDenormalsToZero with CodeGenOpts.FlushDenorm. https://reviews.llvm.org/D48287 Files: include/clang/Basic/LangOptions.def lib/CodeGen/CGCall.cpp lib/CodeGen/CodeGenModule.cpp lib/Frontend/CompilerInvocation.cpp test/CodeGenCUDA/flush-denormals.cu Index: test/CodeGenCUDA/flush-denormals.cu === --- test/CodeGenCUDA/flush-denormals.cu +++ test/CodeGenCUDA/flush-denormals.cu @@ -5,18 +5,33 @@ // RUN: -triple nvptx-nvidia-cuda -emit-llvm -o - %s | \ // RUN: FileCheck %s -check-prefix CHECK -check-prefix FTZ +// RUN: %clang_cc1 -fcuda-is-device -x hip \ +// RUN: -triple amdgcn-amd-amdhsa -target-cpu gfx900 -emit-llvm -o - %s | \ +// RUN: FileCheck %s -check-prefix CHECK -check-prefix AMDNOFTZ +// RUN: %clang_cc1 -fcuda-is-device -x hip -fcuda-flush-denormals-to-zero \ +// RUN: -triple amdgcn-amd-amdhsa -target-cpu gfx900 -emit-llvm -o - %s | \ +// RUN: FileCheck %s -check-prefix CHECK -check-prefix AMDFTZ + #include "Inputs/cuda.h" // Checks that device function calls get emitted with the "ntpvx-f32ftz" // attribute set to "true" when we compile CUDA device code with // -fcuda-flush-denormals-to-zero. Further, check that we reflect the presence // or absence of -fcuda-flush-denormals-to-zero in a module flag. +// AMDGCN targets always have +fp64-fp16-denormals. +// AMDGCN targets without fast FMAF (e.g. gfx803) always have +fp32-denormals. +// For AMDGCN target with fast FMAF (e.g. gfx900), it has +fp32-denormals +// by default and -fp32-denormals when there is option +// -fcuda-flush-denormals-to-zero. + // CHECK-LABEL: define void @foo() #0 extern "C" __device__ void foo() {} // FTZ: attributes #0 = {{.*}} "nvptx-f32ftz"="true" // NOFTZ-NOT: attributes #0 = {{.*}} "nvptx-f32ftz" +// AMDNOFTZ: attributes #0 = {{.*}}+fp32-denormals{{.*}}+fp64-fp16-denormals +// AMDFTZ: attributes #0 = {{.*}}+fp64-fp16-denormals{{.*}}-fp32-denormals // FTZ:!llvm.module.flags = !{{{.*}}[[MODFLAG:![0-9]+]]} // FTZ:[[MODFLAG]] = !{i32 4, !"nvvm-reflect-ftz", i32 1} Index: lib/Frontend/CompilerInvocation.cpp === --- lib/Frontend/CompilerInvocation.cpp +++ lib/Frontend/CompilerInvocation.cpp @@ -690,7 +690,9 @@ Args.hasArg(OPT_cl_unsafe_math_optimizations) || Args.hasArg(OPT_cl_fast_relaxed_math)); Opts.Reassociate = Args.hasArg(OPT_mreassociate); - Opts.FlushDenorm = Args.hasArg(OPT_cl_denorms_are_zero); + Opts.FlushDenorm = Args.hasArg(OPT_cl_denorms_are_zero) || + (Args.hasArg(OPT_fcuda_is_device) && + Args.hasArg(OPT_fcuda_flush_denormals_to_zero)); Opts.CorrectlyRoundedDivSqrt = Args.hasArg(OPT_cl_fp32_correctly_rounded_divide_sqrt); Opts.UniformWGSize = @@ -2186,9 +2188,6 @@ if (Args.hasArg(OPT_fno_cuda_host_device_constexpr)) Opts.CUDAHostDeviceConstexpr = 0; - if (Opts.CUDAIsDevice && Args.hasArg(OPT_fcuda_flush_denormals_to_zero)) -Opts.CUDADeviceFlushDenormalsToZero = 1; - if (Opts.CUDAIsDevice && Args.hasArg(OPT_fcuda_approx_transcendentals)) Opts.CUDADeviceApproxTranscendentals = 1; Index: lib/CodeGen/CodeGenModule.cpp === --- lib/CodeGen/CodeGenModule.cpp +++ lib/CodeGen/CodeGenModule.cpp @@ -526,7 +526,7 @@ // floating point values to 0. (This corresponds to its "__CUDA_FTZ" // property.) getModule().addModuleFlag(llvm::Module::Override, "nvvm-reflect-ftz", - LangOpts.CUDADeviceFlushDenormalsToZero ? 1 : 0); + CodeGenOpts.FlushDenorm ? 1 : 0); } // Emit OpenCL specific module metadata: OpenCL/SPIR version. Index: lib/CodeGen/CGCall.cpp === --- lib/CodeGen/CGCall.cpp +++ lib/CodeGen/CGCall.cpp @@ -1798,7 +1798,7 @@ FuncAttrs.addAttribute(llvm::Attribute::NoUnwind); // Respect -fcuda-flush-denormals-to-zero. -if (getLangOpts().CUDADeviceFlushDenormalsToZero) +if (CodeGenOpts.FlushDenorm) FuncAttrs.addAttribute("nvptx-f32ftz", "true"); } } Index: include/clang/Basic/LangOptions.def === --- include/clang/Basic/LangOptions.def +++ include/clang/Basic/LangOptions.def @@ -209,7 +209,6 @@ LANGOPT(CUDAIsDevice , 1, 0, "compiling for CUDA device") LANGOPT(CUDAAllowVariadicFunctions, 1, 0, "allowing variadic functions in CUDA device code") LANGOPT(CUDAHostDeviceConstexpr, 1, 1, "treating unattributed constexpr functions as __host__ __device__") -LANGOPT(CUDADeviceFlushDenormalsToZero, 1, 0, "flushing denormals to zero") LANGOPT(CUDADeviceApproxTranscendentals, 1, 0, "using approximate transcendental functions") LANGOP
[PATCH] D49345: [CMake] Use correct variable as header install prefix
smeenai accepted this revision. smeenai added a comment. This revision is now accepted and ready to land. Seems like an obvious enough fix, so I'm jumping in to LGTM. Repository: rCXX libc++ https://reviews.llvm.org/D49345 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49345: [CMake] Use correct variable as header install prefix
phosek added a comment. Thank you! Repository: rCXX libc++ https://reviews.llvm.org/D49345 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49345: [CMake] Use correct variable as header install prefix
This revision was automatically updated to reflect the committed changes. Closed by commit rL337118: [CMake] Use correct variable as header install prefix (authored by phosek, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D49345?vs=155577&id=155582#toc Repository: rL LLVM https://reviews.llvm.org/D49345 Files: libcxx/trunk/include/CMakeLists.txt Index: libcxx/trunk/include/CMakeLists.txt === --- libcxx/trunk/include/CMakeLists.txt +++ libcxx/trunk/include/CMakeLists.txt @@ -239,16 +239,16 @@ foreach(file ${files}) get_filename_component(dir ${file} DIRECTORY) install(FILES ${file} - DESTINATION ${LIBCXX_INSTALL_PATH}include/c++/v1/${dir} + DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir} COMPONENT cxx-headers PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) endforeach() if (LIBCXX_NEEDS_SITE_CONFIG) # Install the generated header as __config. install(FILES ${LIBCXX_BINARY_DIR}/__generated_config - DESTINATION ${LIBCXX_INSTALL_PATH}include/c++/v1 + DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ RENAME __config COMPONENT cxx-headers) Index: libcxx/trunk/include/CMakeLists.txt === --- libcxx/trunk/include/CMakeLists.txt +++ libcxx/trunk/include/CMakeLists.txt @@ -239,16 +239,16 @@ foreach(file ${files}) get_filename_component(dir ${file} DIRECTORY) install(FILES ${file} - DESTINATION ${LIBCXX_INSTALL_PATH}include/c++/v1/${dir} + DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir} COMPONENT cxx-headers PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) endforeach() if (LIBCXX_NEEDS_SITE_CONFIG) # Install the generated header as __config. install(FILES ${LIBCXX_BINARY_DIR}/__generated_config - DESTINATION ${LIBCXX_INSTALL_PATH}include/c++/v1 + DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ RENAME __config COMPONENT cxx-headers) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337118 - [CMake] Use correct variable as header install prefix
Author: phosek Date: Sat Jul 14 21:09:35 2018 New Revision: 337118 URL: http://llvm.org/viewvc/llvm-project?rev=337118&view=rev Log: [CMake] Use correct variable as header install prefix This variable is already set in CMakeLists.txt but it wasn't used which means that the headers get installed into a wrong location when the per target runtime directory option is being used. Differential Revision: https://reviews.llvm.org/D49345 Modified: libcxx/trunk/include/CMakeLists.txt Modified: libcxx/trunk/include/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/CMakeLists.txt?rev=337118&r1=337117&r2=337118&view=diff == --- libcxx/trunk/include/CMakeLists.txt (original) +++ libcxx/trunk/include/CMakeLists.txt Sat Jul 14 21:09:35 2018 @@ -239,7 +239,7 @@ if (LIBCXX_INSTALL_HEADERS) foreach(file ${files}) get_filename_component(dir ${file} DIRECTORY) install(FILES ${file} - DESTINATION ${LIBCXX_INSTALL_PATH}include/c++/v1/${dir} + DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir} COMPONENT cxx-headers PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) @@ -248,7 +248,7 @@ if (LIBCXX_INSTALL_HEADERS) if (LIBCXX_NEEDS_SITE_CONFIG) # Install the generated header as __config. install(FILES ${LIBCXX_BINARY_DIR}/__generated_config - DESTINATION ${LIBCXX_INSTALL_PATH}include/c++/v1 + DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ RENAME __config COMPONENT cxx-headers) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49235: [ASTImporter] Import described template (if any) of function.
a_sidorin added a comment. Hello Balasz, This looks mostly good but I have a question inline. Comment at: lib/AST/ASTImporter.cpp:2715 +if (auto *ToFT = dyn_cast(Importer.Import(FromFT))) + ToFunction->setDescribedFunctionTemplate(ToFT); +else The function template should be already set after `getDescribedFunctionTemplate()` is imported in `VisitFunctionTemplateDecl()`. Are there still cases not covered by this? Repository: rC Clang https://reviews.llvm.org/D49235 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49245: [ASTImporter] Import implicit methods of existing class.
a_sidorin accepted this revision. a_sidorin added a comment. This revision is now accepted and ready to land. LGTM. Just some stylish nits. To resolve this issue, I used `Sema::DeclareImplicit...` methods. But I like this approach much more because it doesn't allows to forget different kinds of implicit methods and doesn't require passing Sema into ASTImporter. Comment at: lib/AST/ASTImporter.cpp:2203 + if (D->isCompleteDefinition() && !Importer.isMinimalImport()) +// FoundDef may not have every implicit method that D has. +ImportImplicitMethods(DCXX, FoundCXX); ... because implicit methods are created only if they are used. Comment at: unittests/AST/ASTImporterTest.cpp:2302 + const MatcherType &MethodMatcher, const char *Code = DefaultCode) { +test(MethodMatcher, Code, 1u); + } /*ExpectedCount=*/. Same below. Comment at: unittests/AST/ASTImporterTest.cpp:2305 + + template + void testNoImportOf( clang-format places a space before the template parameter list. Repository: rC Clang https://reviews.llvm.org/D49245 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49293: [ASTImporter] Add support for import of CXXInheritedCtorInitExpr.
a_sidorin added a comment. Adding new nodes is always welcome. Comment at: lib/AST/ASTImporter.cpp:6741 + + auto *Ctor = dyn_cast(Importer.Import( + E->getConstructor())); cast_or_null? Repository: rC Clang https://reviews.llvm.org/D49293 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49300: [ASTImporter] Fix poisonous structural equivalence cache
a_sidorin added a comment. Hi Gabor, Could you provide some tests for the issue? Repository: rC Clang https://reviews.llvm.org/D49300 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49296: [ASTImporter] Fix import of unnamed structs
a_sidorin added a comment. Hi Gabor, The change is OK but I have some questions regarding tests. Comment at: unittests/AST/ASTImporterTest.cpp:2495 + FirstDeclMatcher().match(ToTU, fieldDecl(hasName("entry1"))); + auto getRecordDecl = [](FieldDecl *FD) { +auto *ET = cast(FD->getType().getTypePtr()); There is already a similar lambda definitions for `getRecordDecl()` in ObjectsWithUnnamedStructType test. Can we make it a function, like it is done for StructuralEquivalenceContext? Comment at: unittests/AST/StructuralEquivalenceTest.cpp:581 + ASSERT_NE(R0, R1); + EXPECT_TRUE(testStructuralMatch(R0, R0)); + EXPECT_TRUE(testStructuralMatch(R1, R1)); Do we really want to test the equivalence of decl to itself, not to its imported version? Repository: rC Clang https://reviews.llvm.org/D49296 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits