Re: r245794 - Improve the performance of resolving a lookup result. We usually don't need to
On 22/08/15 23:37, Richard Smith via cfe-commits wrote: Author: rsmith Date: Sat Aug 22 16:37:34 2015 New Revision: 245794 URL: http://llvm.org/viewvc/llvm-project?rev=245794&view=rev Log: Improve the performance of resolving a lookup result. We usually don't need to pick the most recent declaration, and we can often tell which declaration is more recent without walking the redeclaration chain. Do so when possible. Modified: cfe/trunk/lib/Sema/SemaLookup.cpp Modified: cfe/trunk/lib/Sema/SemaLookup.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=245794&r1=245793&r2=245794&view=diff == --- cfe/trunk/lib/Sema/SemaLookup.cpp (original) +++ cfe/trunk/lib/Sema/SemaLookup.cpp Sat Aug 22 16:37:34 2015 @@ -356,7 +356,7 @@ static DeclContext *getContextForScopeMa /// \brief Determine whether \p D is a better lookup result than \p Existing, /// given that they declare the same entity. -static bool isPreferredLookupResult(Sema::LookupNameKind Kind, +static bool isPreferredLookupResult(Sema &S, Sema::LookupNameKind Kind, NamedDecl *D, NamedDecl *Existing) { // When looking up redeclarations of a using declaration, prefer a using // shadow declaration over any other declaration of the same entity. @@ -376,13 +376,46 @@ static bool isPreferredLookupResult(Sema return false; } - // If D is newer than Existing, prefer it. + // Pick the function with more default arguments. + // FIXME: In the presence of ambiguous default arguments, we should keep both, + //so we can diagnose the ambiguity if the default argument is needed. + //See C++ [over.match.best]p3. + if (auto *DFD = dyn_cast(DUnderlying)) { +auto *EFD = cast(EUnderlying); +unsigned DMin = DFD->getMinRequiredArguments(); +unsigned EMin = EFD->getMinRequiredArguments(); +// If D has more default arguments, it is preferred. +if (DMin != EMin) + return DMin < EMin; + } + + // Pick the template with more default template arguments. + if (auto *DTD = dyn_cast(DUnderlying)) { +auto *ETD = cast(EUnderlying); +unsigned DMin = DTD->getTemplateParameters()->getMinRequiredArguments(); +unsigned EMin = ETD->getTemplateParameters()->getMinRequiredArguments(); +// If D has more default arguments, it is preferred. +if (DMin != EMin) + return DMin < EMin; + } + + // For most kinds of declaration, it doesn't really matter which one we pick. + if (!isa(DUnderlying) && !isa(DUnderlying)) { +// If the existing declaration is hidden, prefer the new one. Otherwise, +// keep what we've got. +return !S.isVisible(Existing); + } + + // Pick the newer declaration; it might have a more precise type. for (Decl *Prev = DUnderlying->getPreviousDecl(); Prev; Prev = Prev->getPreviousDecl()) if (Prev == EUnderlying) return true; - return false; + + // If the existing declaration is hidden, prefer the new one. Otherwise, + // keep what we've got. + return !S.isVisible(Existing); It seems that this part is never executed. What am I missing something? --Vassil } /// Resolves the result kind of this lookup. @@ -462,7 +495,7 @@ void LookupResult::resolveKind() { if (ExistingI) { // This is not a unique lookup result. Pick one of the results and // discard the other. - if (isPreferredLookupResult(getLookupKind(), Decls[I], + if (isPreferredLookupResult(getSema(), getLookupKind(), Decls[I], Decls[*ExistingI])) Decls[*ExistingI] = Decls[I]; Decls[I] = Decls[--N]; ___ 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] D10963: Implement LWG#2063: "Contradictory requirements for string move assignment"
mclow.lists abandoned this revision. mclow.lists added a comment. This has been done via another means. http://reviews.llvm.org/D10963 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r259998 - [analyzer] DeallocChecker: Don't warn on release of readonly assign property in dealloc.
Author: dcoughlin Date: Sat Feb 6 11:17:32 2016 New Revision: 259998 URL: http://llvm.org/viewvc/llvm-project?rev=259998&view=rev Log: [analyzer] DeallocChecker: Don't warn on release of readonly assign property in dealloc. It is common for the ivars for read-only assign properties to always be stored retained, so don't warn for a release in dealloc for the ivar backing these properties. Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp cfe/trunk/test/Analysis/PR2978.m Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp?rev=259998&r1=259997&r2=259998&view=diff == --- cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp Sat Feb 6 11:17:32 2016 @@ -216,6 +216,12 @@ static void checkObjCDealloc(const Check << "' was retained by a synthesized property " "but was not released in 'dealloc'"; } else { +// It is common for the ivars for read-only assign properties to +// always be stored retained, so don't warn for a release in +// dealloc for the ivar backing these properties. +if (PD->isReadOnly()) + continue; + name = LOpts.getGC() == LangOptions::NonGC ? "extra ivar release (use-after-release)" : "extra ivar release (Hybrid MM, non-GC)"; Modified: cfe/trunk/test/Analysis/PR2978.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/PR2978.m?rev=259998&r1=259997&r2=259998&view=diff == --- cfe/trunk/test/Analysis/PR2978.m (original) +++ cfe/trunk/test/Analysis/PR2978.m Sat Feb 6 11:17:32 2016 @@ -39,7 +39,7 @@ @synthesize Z = _Z; // expected-warning{{The '_Z' instance variable in 'MyClass' was not retained by a synthesized property but was released in 'dealloc'}} @synthesize K = _K; @synthesize L = _L; // no-warning -@synthesize N = _N; // expected-warning{{The '_N' instance variable in 'MyClass' was not retained by a synthesized property but was released in 'dealloc'}} +@synthesize N = _N; // no-warning @synthesize M = _M; @synthesize V = _V; @synthesize W = _W; // expected-warning{{The '_W' instance variable in 'MyClass' was retained by a synthesized property but was not released in 'dealloc'}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D16946: Add link to llvm git documentation, and recommend always building libcxx on OSX
hintonda created this revision. hintonda added a reviewer: mclow.lists. hintonda added a subscriber: cfe-commits. http://reviews.llvm.org/D16946 Files: www/get_started.html Index: www/get_started.html === --- www/get_started.html +++ www/get_started.html @@ -31,7 +31,7 @@ On Unix-like Systems If you would like to check out and build Clang, the current procedure is as -follows: +follows (instructions for using git can be found http://llvm.org/docs/GettingStarted.html#git-mirror";>here): Get the required tools. @@ -76,7 +76,7 @@ cd ../.. - Checkout libcxx: (only required to build and run Compiler-RT tests on OS X, optional otherwise) + Checkout libcxx: (recommended for OS X, and required to build and run Compiler-RT tests on OS X, optional otherwise) cd llvm/projects svn co http://llvm.org/svn/llvm-project/libcxx/trunk Index: www/get_started.html === --- www/get_started.html +++ www/get_started.html @@ -31,7 +31,7 @@ On Unix-like Systems If you would like to check out and build Clang, the current procedure is as -follows: +follows (instructions for using git can be found http://llvm.org/docs/GettingStarted.html#git-mirror";>here): Get the required tools. @@ -76,7 +76,7 @@ cd ../.. - Checkout libcxx: (only required to build and run Compiler-RT tests on OS X, optional otherwise) + Checkout libcxx: (recommended for OS X, and required to build and run Compiler-RT tests on OS X, optional otherwise) cd llvm/projects svn co http://llvm.org/svn/llvm-project/libcxx/trunk ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r259994 - Adapt LLVM_CMAKE_PATH for recent cmake path changes
Author: kamil Date: Sat Feb 6 10:23:18 2016 New Revision: 259994 URL: http://llvm.org/viewvc/llvm-project?rev=259994&view=rev Log: Adapt LLVM_CMAKE_PATH for recent cmake path changes Current LLVM installs CMake files under lib/cmake/llvm. Modified: libunwind/trunk/CMakeLists.txt Modified: libunwind/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=259994&r1=259993&r2=259994&view=diff == --- libunwind/trunk/CMakeLists.txt (original) +++ libunwind/trunk/CMakeLists.txt Sat Feb 6 10:23:18 2016 @@ -41,7 +41,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include") set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree") set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree") -set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/share/llvm/cmake") +set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") set(LLVM_LIT_PATH "${LLVM_PATH}/utils/lit/lit.py") else () message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. " @@ -221,4 +221,3 @@ append_if(LIBUNWIND_COMPILE_FLAGS LIBUNW include_directories(include) add_subdirectory(src) - ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r260001 - Introduce NetBSD support
Author: kamil Date: Sat Feb 6 12:19:29 2016 New Revision: 260001 URL: http://llvm.org/viewvc/llvm-project?rev=260001&view=rev Log: Introduce NetBSD support Current FreeBSD and NetBSD code is compatible. Modified: libunwind/trunk/src/AddressSpace.hpp Modified: libunwind/trunk/src/AddressSpace.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/AddressSpace.hpp?rev=260001&r1=26&r2=260001&view=diff == --- libunwind/trunk/src/AddressSpace.hpp (original) +++ libunwind/trunk/src/AddressSpace.hpp Sat Feb 6 12:19:29 2016 @@ -35,7 +35,7 @@ namespace libunwind { #include "Registers.hpp" #if _LIBUNWIND_ARM_EHABI -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) typedef void *_Unwind_Ptr; @@ -61,7 +61,8 @@ extern EHTEntry __exidx_end; #endif // !defined(_LIBUNWIND_IS_BAREMETAL) #endif // _LIBUNWIND_ARM_EHABI -#if defined(__CloudABI__) || defined(__FreeBSD__) || defined(__linux__) +#if defined(__CloudABI__) || defined(__FreeBSD__) || defined(__linux__) || \ +defined(__NetBSD__) #if _LIBUNWIND_SUPPORT_DWARF_UNWIND && _LIBUNWIND_SUPPORT_DWARF_INDEX #include // Macro for machine-independent access to the ELF program headers. This ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r260002 - Add a missing call to MDNode::deleteTemporary().
Author: adrian Date: Sat Feb 6 12:39:34 2016 New Revision: 260002 URL: http://llvm.org/viewvc/llvm-project?rev=260002&view=rev Log: Add a missing call to MDNode::deleteTemporary(). Follow-up to r259975. Kudos to the ASAN bots! Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=260002&r1=260001&r2=260002&view=diff == --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Sat Feb 6 12:39:34 2016 @@ -2056,19 +2056,20 @@ llvm::DIType *CGDebugInfo::CreateEnumTyp // It is possible for enums to be created as part of their own // declcontext. We need to cache a placeholder to avoid the type being // created twice before hitting the cache. -llvm::DIScope *EDContext = DBuilder.createReplaceableCompositeType( +llvm::DIScope *TmpContext = DBuilder.createReplaceableCompositeType( llvm::dwarf::DW_TAG_enumeration_type, "", TheCU, DefUnit, 0); unsigned Line = getLineNumber(ED->getLocation()); StringRef EDName = ED->getName(); llvm::DIType *RetTy = DBuilder.createReplaceableCompositeType( -llvm::dwarf::DW_TAG_enumeration_type, EDName, EDContext, DefUnit, Line, +llvm::dwarf::DW_TAG_enumeration_type, EDName, TmpContext, DefUnit, Line, 0, Size, Align, llvm::DINode::FlagFwdDecl, FullName); // Cache the enum type so it is available when building the declcontext // and replace the declcontect with the real thing. TypeCache[Ty].reset(RetTy); -EDContext->replaceAllUsesWith(getDeclContextDescriptor(ED)); +TmpContext->replaceAllUsesWith(getDeclContextDescriptor(ED)); +llvm::MDNode::deleteTemporary(TmpContext); ReplaceMap.emplace_back( std::piecewise_construct, std::make_tuple(Ty), ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D16947: [PGO] assignment operator does not get profile data
davidxl created this revision. davidxl added a reviewer: vsk. davidxl added subscribers: llvm-commits, cfe-commits. For compiler generated assignment operator that is not trivial (calling base class operator=()), Clang FE assign region counters to the function body but does not emit profile counter increment for the function entry. This leads to many problems: 1) the operator body does not have profile data generated leading to warning in profile-use 2) the size of the function body may be large and lack of profile data may lead to wrong inlining decisions 3) when FE assign region counters to the function, it also emit coverage mapping data for the function -- but it has no coverage data which is confusing (currently the llvm-cov tool will report malformed format (as the name of the operator is not put into the right name section). http://reviews.llvm.org/D16947 Files: lib/CodeGen/CGClass.cpp test/Profile/def-assignop.cpp Index: test/Profile/def-assignop.cpp === --- test/Profile/def-assignop.cpp +++ test/Profile/def-assignop.cpp @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -x c++ %s -triple x86_64-unknown-linux-gnu -main-file-name def-assignop.cpp -o - -emit-llvm -fprofile-instrument=clang | FileCheck --check-prefix=PGOGEN %s + + +struct B { + int B; + void *operator=(const struct B &b2) { +if (b2.B == 0) { + B = b2.B + 1; +} else + B = b2.B; +return this; + } +}; + +struct A : public B { + A &operator=(const A &) = default; +// PGOGEN: define {{.*}}@_ZN1AaSERKS_( +// PGOGEN: %pgocount = load {{.*}} @__profc__ZN1AaSERKS_ +// PGOGEN: {{.*}}add{{.*}}%pgocount, 1 +// PGOGEN: store{{.*}}@__profc__ZN1AaSERKS_ + int I; + int J; + int getI() { return I; } +}; + +A aa; +int g; +int main() { + A aa2; + aa2 = aa; + + g = aa2.getI(); + return 0; +} Index: lib/CodeGen/CGClass.cpp === --- lib/CodeGen/CGClass.cpp +++ lib/CodeGen/CGClass.cpp @@ -1608,6 +1608,7 @@ LexicalScope Scope(*this, RootCS->getSourceRange()); + incrementProfileCounter(RootCS); AssignmentMemcpyizer AM(*this, AssignOp, Args); for (auto *I : RootCS->body()) AM.emitAssignment(I); Index: test/Profile/def-assignop.cpp === --- test/Profile/def-assignop.cpp +++ test/Profile/def-assignop.cpp @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -x c++ %s -triple x86_64-unknown-linux-gnu -main-file-name def-assignop.cpp -o - -emit-llvm -fprofile-instrument=clang | FileCheck --check-prefix=PGOGEN %s + + +struct B { + int B; + void *operator=(const struct B &b2) { +if (b2.B == 0) { + B = b2.B + 1; +} else + B = b2.B; +return this; + } +}; + +struct A : public B { + A &operator=(const A &) = default; +// PGOGEN: define {{.*}}@_ZN1AaSERKS_( +// PGOGEN: %pgocount = load {{.*}} @__profc__ZN1AaSERKS_ +// PGOGEN: {{.*}}add{{.*}}%pgocount, 1 +// PGOGEN: store{{.*}}@__profc__ZN1AaSERKS_ + int I; + int J; + int getI() { return I; } +}; + +A aa; +int g; +int main() { + A aa2; + aa2 = aa; + + g = aa2.getI(); + return 0; +} Index: lib/CodeGen/CGClass.cpp === --- lib/CodeGen/CGClass.cpp +++ lib/CodeGen/CGClass.cpp @@ -1608,6 +1608,7 @@ LexicalScope Scope(*this, RootCS->getSourceRange()); + incrementProfileCounter(RootCS); AssignmentMemcpyizer AM(*this, AssignOp, Args); for (auto *I : RootCS->body()) AM.emitAssignment(I); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r260002 - Add a missing call to MDNode::deleteTemporary().
> On 2016-Feb-06, at 10:39, Adrian Prantl via cfe-commits > wrote: > > Author: adrian > Date: Sat Feb 6 12:39:34 2016 > New Revision: 260002 > > URL: http://llvm.org/viewvc/llvm-project?rev=260002&view=rev > Log: > Add a missing call to MDNode::deleteTemporary(). > Follow-up to r259975. Kudos to the ASAN bots! > > > > Modified: >cfe/trunk/lib/CodeGen/CGDebugInfo.cpp > > Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=260002&r1=260001&r2=260002&view=diff > == > --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) > +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Sat Feb 6 12:39:34 2016 > @@ -2056,19 +2056,20 @@ llvm::DIType *CGDebugInfo::CreateEnumTyp > // It is possible for enums to be created as part of their own > // declcontext. We need to cache a placeholder to avoid the type being > // created twice before hitting the cache. > -llvm::DIScope *EDContext = DBuilder.createReplaceableCompositeType( > +llvm::DIScope *TmpContext = DBuilder.createReplaceableCompositeType( If you change this to: ``` llvm::TempDIScope TmpContext(DBuilder.create...()) ``` then the lifetime of `TmpContext` will get managed for you (it's a `std::unique_ptr`). Really, `DIBuilder` should return this instead of a `DIScope*`, so that it's clear what the lifetime is. > llvm::dwarf::DW_TAG_enumeration_type, "", TheCU, DefUnit, 0); > > unsigned Line = getLineNumber(ED->getLocation()); > StringRef EDName = ED->getName(); > llvm::DIType *RetTy = DBuilder.createReplaceableCompositeType( > -llvm::dwarf::DW_TAG_enumeration_type, EDName, EDContext, DefUnit, > Line, > +llvm::dwarf::DW_TAG_enumeration_type, EDName, TmpContext, DefUnit, > Line, > 0, Size, Align, llvm::DINode::FlagFwdDecl, FullName); > > // Cache the enum type so it is available when building the declcontext > // and replace the declcontect with the real thing. > TypeCache[Ty].reset(RetTy); > -EDContext->replaceAllUsesWith(getDeclContextDescriptor(ED)); > +TmpContext->replaceAllUsesWith(getDeclContextDescriptor(ED)); > +llvm::MDNode::deleteTemporary(TmpContext); > > ReplaceMap.emplace_back( > std::piecewise_construct, std::make_tuple(Ty), > > > ___ > 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] D16738: Fix invalid casts in .
EricWF added a comment. I prefer using the `(void*)` casts when possible. In particular when doing the pointer comparisons. Could you change those back to `void*` casts then use the `__as_base` function for the rest? Repository: rL LLVM http://reviews.llvm.org/D16738 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D16792: unordered_map: Use __hash_table::__emplace_unique(), NFC
EricWF added a comment. This is very subtly broken. The requirements in the standard for emplace are [unord.req] Table 102 > a_eq.emplace(args) > Requires: : value_type shall be EmplaceConstructible into X from args. Unfortunately __hash_table doesn't know that unordered_map has this "special" value_type, so it can't actually extract and construct the correct value_type from it. I'm going to change this over the weekend. Once I've done some prep work this patch should be ready to go. http://reviews.llvm.org/D16792 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D16949: Fix for: Bug 5941 - improve diagnostic for * vs & confusion
ryee88 created this revision. ryee88 added reviewers: doug.gregor, jyasskin, nicholas, rsmith. ryee88 added a subscriber: cfe-commits. This is bug 5941: https://llvm.org/bugs/show_bug.cgi?id=5941 I copied the extra suggestions from the complete type case to the incomplete type case. http://reviews.llvm.org/D16949 Files: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaOverload.cpp Index: lib/Sema/SemaOverload.cpp === --- lib/Sema/SemaOverload.cpp +++ lib/Sema/SemaOverload.cpp @@ -9104,10 +9104,13 @@ if (const PointerType *PTy = TempFromTy->getAs()) TempFromTy = PTy->getPointeeType(); if (TempFromTy->isIncompleteType()) { +// Emit the generic diagnostic and, optionally, add the hints to it. S.Diag(Fn->getLocation(), diag::note_ovl_candidate_bad_conv_incomplete) << (unsigned) FnKind << FnDesc << (FromExpr ? FromExpr->getSourceRange() : SourceRange()) - << FromTy << ToTy << (unsigned) isObjectArgument << I+1; + << FromTy << ToTy << (unsigned) isObjectArgument << I+1 + << (unsigned) (Cand->Fix.Kind); + MaybeEmitInheritedConstructorNote(S, Fn); return; } Index: include/clang/Basic/DiagnosticSemaKinds.td === --- include/clang/Basic/DiagnosticSemaKinds.td +++ include/clang/Basic/DiagnosticSemaKinds.td @@ -3189,7 +3189,12 @@ "function (the implicit move assignment operator)|" "constructor (inherited)}0%1 " "not viable: cannot convert argument of incomplete type " -"%diff{$ to $|to parameter type}2,3">; +"%diff{$ to $|to parameter type}2,3 for " +"%select{%ordinal5 argument|object argument}4" +"%select{|; dereference the argument with *|" +"; take the address of the argument with &|" +"; remove *|" +"; remove &}6">; def note_ovl_candidate_bad_list_argument : Note<"candidate " "%select{function|function|constructor|" "function |function |constructor |" Index: lib/Sema/SemaOverload.cpp === --- lib/Sema/SemaOverload.cpp +++ lib/Sema/SemaOverload.cpp @@ -9104,10 +9104,13 @@ if (const PointerType *PTy = TempFromTy->getAs()) TempFromTy = PTy->getPointeeType(); if (TempFromTy->isIncompleteType()) { +// Emit the generic diagnostic and, optionally, add the hints to it. S.Diag(Fn->getLocation(), diag::note_ovl_candidate_bad_conv_incomplete) << (unsigned) FnKind << FnDesc << (FromExpr ? FromExpr->getSourceRange() : SourceRange()) - << FromTy << ToTy << (unsigned) isObjectArgument << I+1; + << FromTy << ToTy << (unsigned) isObjectArgument << I+1 + << (unsigned) (Cand->Fix.Kind); + MaybeEmitInheritedConstructorNote(S, Fn); return; } Index: include/clang/Basic/DiagnosticSemaKinds.td === --- include/clang/Basic/DiagnosticSemaKinds.td +++ include/clang/Basic/DiagnosticSemaKinds.td @@ -3189,7 +3189,12 @@ "function (the implicit move assignment operator)|" "constructor (inherited)}0%1 " "not viable: cannot convert argument of incomplete type " -"%diff{$ to $|to parameter type}2,3">; +"%diff{$ to $|to parameter type}2,3 for " +"%select{%ordinal5 argument|object argument}4" +"%select{|; dereference the argument with *|" +"; take the address of the argument with &|" +"; remove *|" +"; remove &}6">; def note_ovl_candidate_bad_list_argument : Note<"candidate " "%select{function|function|constructor|" "function |function |constructor |" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r260011 - Index: provide adjustment thunk information for C++ manglings
Author: compnerd Date: Sat Feb 6 16:36:34 2016 New Revision: 260011 URL: http://llvm.org/viewvc/llvm-project?rev=260011&view=rev Log: Index: provide adjustment thunk information for C++ manglings Add support for exposing the adjustment thunk for virtual methods as appropriate. Modified: cfe/trunk/test/Index/print-cxx-manglings.cpp cfe/trunk/tools/libclang/CIndex.cpp Modified: cfe/trunk/test/Index/print-cxx-manglings.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/print-cxx-manglings.cpp?rev=260011&r1=260010&r2=260011&view=diff == --- cfe/trunk/test/Index/print-cxx-manglings.cpp (original) +++ cfe/trunk/test/Index/print-cxx-manglings.cpp Sat Feb 6 16:36:34 2016 @@ -64,3 +64,33 @@ struct v { // MSVC: CXXConstructor=v{{.*}}[mangled=??0v@@QAE@H@Z] [mangled=??_Fv@@QAEXXZ] +struct w { + virtual int m(int); +}; + +// ITANIUM: CXXMethod=m{{.*}} (virtual) [mangled=_ZN1w1mEi] + +// MACHO: CXXMethod=m{{.*}} (virtual) [mangled=__ZN1w1mEi] + +// MSVC: CXXMethod=m{{.*}} (virtual) [mangled=?m@w@@UAEHH@Z] + +struct x { + virtual int m(int); +}; + +// ITANIUM: CXXMethod=m{{.*}} (virtual) [mangled=_ZN1x1mEi] + +// MACHO: CXXMethod=m{{.*}} (virtual) [mangled=__ZN1x1mEi] + +// MSVC: CXXMethod=m{{.*}} (virtual) [mangled=?m@x@@UAEHH@Z] + +struct y : w, x { + virtual int m(int); +}; + +// ITANIUM: CXXMethod=m{{.*}} (virtual) {{.*}} [mangled=_ZN1y1mEi] [mangled=_ZThn4_N1y1mEi] + +// MACHO: CXXMethod=m{{.*}} (virtual) {{.*}} [mangled=__ZN1y1mEi] [mangled=__ZThn4_N1y1mEi] + +// MSVC: CXXMethod=m{{.*}} (virtual) {{.*}} [mangled=?m@y@@UAEHH@Z] [mangled=?m@y@@W3AEHH@Z] + Modified: cfe/trunk/tools/libclang/CIndex.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=260011&r1=260010&r2=260011&view=diff == --- cfe/trunk/tools/libclang/CIndex.cpp (original) +++ cfe/trunk/tools/libclang/CIndex.cpp Sat Feb 6 16:36:34 2016 @@ -24,6 +24,7 @@ #include "clang/AST/Attr.h" #include "clang/AST/Mangle.h" #include "clang/AST/StmtVisitor.h" +#include "clang/AST/VTableBuilder.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/DiagnosticCategories.h" #include "clang/Basic/DiagnosticIDs.h" @@ -4368,6 +4369,38 @@ CXString clang_Cursor_getMangling(CXCurs return cxstring::createDup(FinalBufOS.str()); } +static std::string getMangledName(std::unique_ptr &M, + std::unique_ptr &DL, + const NamedDecl *ND) { + std::string FrontendBuf; + llvm::raw_string_ostream FOS(FrontendBuf); + + M->mangleName(ND, FOS); + + std::string BackendBuf; + llvm::raw_string_ostream BOS(BackendBuf); + + llvm::Mangler::getNameWithPrefix(BOS, llvm::Twine(FOS.str()), *DL); + + return BOS.str(); +} + +static std::string getMangledThunk(std::unique_ptr &M, + std::unique_ptr &DL, + const CXXMethodDecl *MD, const ThunkInfo &T) { + std::string FrontendBuf; + llvm::raw_string_ostream FOS(FrontendBuf); + + M->mangleThunk(MD, T, FOS); + + std::string BackendBuf; + llvm::raw_string_ostream BOS(BackendBuf); + + llvm::Mangler::getNameWithPrefix(BOS, llvm::Twine(FOS.str()), *DL); + + return BOS.str(); +} + CXStringSet *clang_Cursor_getCXXManglings(CXCursor C) { if (clang_isInvalid(C.kind) || !clang_isDeclaration(C.kind)) return nullptr; @@ -4411,6 +,12 @@ CXStringSet *clang_Cursor_getCXXMangling if (DD->isVirtual()) Manglings.emplace_back(getMangledStructor(M, DL, DD, Dtor_Deleting)); } + } else if (const auto *MD = dyn_cast_or_null(ND)) { +Manglings.emplace_back(getMangledName(M, DL, ND)); +if (MD->isVirtual()) + if (const auto *TIV = Ctx.getVTableContext()->getThunkInfo(MD)) +for (const auto &T : *TIV) + Manglings.emplace_back(getMangledThunk(M, DL, MD, T)); } return cxstring::createSet(Manglings); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D16948: [libcxx] Filesystem TS Part 1 -- path
Light review below, looks like great work. I noticed the tests seem somewhat inconsistent about whether to glue `&` to the type or use two spaces (i.e., ` & `). Which one is preferred in this codebase? Or is it laissez-faire? The rest of my comments are inline. > On 2016-Feb-06, at 12:48, Eric Fiselier via cfe-commits > wrote: > > EricWF updated this revision to Diff 47095. > EricWF added a comment. > > Remove unintentional change in CMake. > > > http://reviews.llvm.org/D16948 > > Files: > CMakeLists.txt > include/experimental/__config > include/experimental/filesystem > include/iomanip > lib/filesystem/CMakeLists.txt > src/filesystem/path.cpp > test/CMakeLists.txt > test/libcxx/experimental/filesystem/class.path/path.req/is_pathable.pass.cpp > test/libcxx/test/config.py > > test/std/experimental/filesystem/class.directory_entry/directory_entry.cons.pass.cpp > > test/std/experimental/filesystem/class.directory_entry/directory_entry.mods.pass.cpp > > test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/comparisons.pass.cpp > > test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/path.pass.cpp > > test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/status.pass.cpp > test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp > test/std/experimental/filesystem/class.file_status/file_status.mods.pass.cpp > test/std/experimental/filesystem/class.file_status/file_status.obs.pass.cpp > > test/std/experimental/filesystem/class.filesystem_error/filesystem_error.members.pass.cpp > test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp > test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.assign/copy.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.assign/move.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp > test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp > test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.construct/copy.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.construct/default.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.construct/move.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.generic.obs/named_overloads.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.modifiers/make_preferred.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_extension.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_filename.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.modifiers/swap.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.native.obs/named_overloads.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp > > test/std/experimental/filesystem/class.path/path.member/path.query/tested_in_path_decompose.pass.cpp > test/std/experimental/filesystem/class.path/path.nonmember/append_op.pass.cpp > > test/std/experimental/filesystem/class.path/path.nonmember/comparison_ops_tested_elsewhere.pass.cpp > > test/std/experimental/filesystem/class.path/path.nonmember/hash_value_tested_elswhere.pass.cpp > > test/std/experimental/filesystem/class.path/path.nonmember/path.factory.pass.cpp > test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp > > test/std/experimental/filesystem/class.path/path.nonmember/path.io.unicode_bug.pass.cpp > test/std/experimental/filesystem/class.path/path.nonmember/swap.pass.cpp > test/std/experimental/filesystem/class.path/synop.pass.cpp > test/std/experimental/filesystem/fs.enum/check_bitmask_types.hpp > test/std/experimental/filesystem/fs.enum/enum.copy_options.pass.cpp > test/std/experimental/filesystem/fs.enum/enum.directory_options.pass.cpp > test/std/experimental/fi
Re: [PATCH] D16948: [libcxx] Filesystem TS Part 1 -- path
dexonsmith added a subscriber: dexonsmith. dexonsmith added a comment. Light review below, looks like great work. I noticed the tests seem somewhat inconsistent about whether to glue `&` to the type or use two spaces (i.e., ` & `). Which one is preferred in this codebase? Or is it laissez-faire? The rest of my comments are inline. http://reviews.llvm.org/D16948 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D16948: [libcxx] Filesystem TS Part 1 -- path
EricWF added a comment. In http://reviews.llvm.org/D16948#345722, @dexonsmith wrote: > Light review below, looks like great work. > > I noticed the tests seem somewhat inconsistent about whether to > glue `&` to the type or use two spaces (i.e., ` & `). Which one is > preferred in this codebase? Or is it laissez-faire? I prefer it glued to the type *i think* but there is no set style currently. I'll try and make it more consistent as I see them. > The rest of my comments are inline. Thanks! If I could bother you to put them on phab next time instead of email it really helps me track them. http://reviews.llvm.org/D16948 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D16948: [libcxx] Filesystem TS Part 1 -- path
> On 2016-Feb-06, at 15:40, Eric Fiselier wrote: > >> > +// The "hash_value" function is tested as part of [path.compare] >> > +// in class.path/path.members/path.compare.pass.cpp >> > +int main() {} >> >> Okay, I get the idea of the one above. I'm guessing this is just how >> we mark that something has been properly tested. >> >> However, it uses up bot time to have these extra tests to compile, link, >> and potentially shoot down to devices and pass output/exit status back. >> Is there any way of marking these things as "tested elsewhere" without >> adding load to the bots? >> > > Maybe? I'm not sure this review is a good place for that discussion. Probably not, just happened to notice it here. > FWIW I don't think these actually slow down the bots a noticeable amount. I'm planning to set up bots that do on-device testing using the SSHExecutor. From my initial testing it looks like there's a non-neglible overhead per-test, so I think it might be worth optimizing this. Sounds like you're not really attached, so if I confirm it's an issue I'll come up with some alternate proposal. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D16792: unordered_map: Use __hash_table::__emplace_unique(), NFC
> On 2016-Feb-06, at 13:28, Eric Fiselier wrote: > > EricWF added a comment. > > This is very subtly broken. The requirements in the standard for emplace are > > [unord.req] Table 102 > >> a_eq.emplace(args) > >> Requires: : value_type shall be EmplaceConstructible into X from args. > > > Unfortunately __hash_table doesn't know that unordered_map has this "special" > value_type, so it can't actually extract and construct the correct value_type > from it. I'm going to change > this over the weekend. Once I've done some prep work this patch should be > ready to go. Nice catch. Even though this "special" value type is what makes the malloc-optimization so difficult, I missed that behaviour change here. Let me know if you run out of time to help with the prep, and I can take over. Thanks for helping. > > > http://reviews.llvm.org/D16792 > > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r260012 - Cleanup node-type handling in the unordered containers
Author: ericwf Date: Sat Feb 6 18:36:33 2016 New Revision: 260012 URL: http://llvm.org/viewvc/llvm-project?rev=260012&view=rev Log: Cleanup node-type handling in the unordered containers This patch is the first in a series of patches that's meant to better support unordered_map. unordered_map has a special "value_type" that differs from pair. In order to meet the EmplaceConstructible and CopyInsertable requirements we need to teach __hash_table about this special value_type. This patch creates a "__hash_node_types" traits class that contains all of the typedefs needed by the unordered containers and it's iterators. These typedefs include ones for each node type and node pointer type, as well as special typedefs for "unordered_map"'s value type. As a result of this change all of the unordered containers now all support incomplete types. As a drive-by fix I changed the difference_type in __hash_table to always be ptrdiff_t. There is a corresponding change to size_type but it cannot take affect until an ABI break. This patch will be followed up shortly with fixes for various unordered_map fixes. Added: libcxx/trunk/test/libcxx/containers/unord/key_value_traits.pass.cpp libcxx/trunk/test/std/containers/unord/iterator_difference_type.pass.cpp libcxx/trunk/test/std/containers/unord/unord.map/incomplete_type.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multimap/incomplete.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multiset/incomplete.pass.cpp libcxx/trunk/test/std/containers/unord/unord.set/incomplete.pass.cpp Modified: libcxx/trunk/include/__config libcxx/trunk/include/__hash_table libcxx/trunk/include/unordered_map Modified: libcxx/trunk/include/__config URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=260012&r1=260011&r2=260012&view=diff == --- libcxx/trunk/include/__config (original) +++ libcxx/trunk/include/__config Sat Feb 6 18:36:33 2016 @@ -42,6 +42,7 @@ // Fix undefined behavior in how std::list stores it's linked nodes. #define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB #define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB +#define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE #endif #define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y Modified: libcxx/trunk/include/__hash_table URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__hash_table?rev=260012&r1=260011&r2=260012&view=diff == --- libcxx/trunk/include/__hash_table (original) +++ libcxx/trunk/include/__hash_table Sat Feb 6 18:36:33 2016 @@ -17,6 +17,7 @@ #include #include #include +#include #include <__undef_min_max> #include <__undef___deallocate> @@ -49,10 +50,10 @@ struct __hash_node typename __rebind_pointer<_VoidPtr, __hash_node<_Tp, _VoidPtr> >::type > { -typedef _Tp value_type; +typedef _Tp __node_value_type; size_t __hash_; -value_type __value_; +__node_value_type __value_; }; inline _LIBCPP_INLINE_VISIBILITY @@ -77,23 +78,126 @@ __next_hash_pow2(size_t __n) } template class __hash_table; + +template class _LIBCPP_TYPE_VIS_ONLY __hash_iterator; template class _LIBCPP_TYPE_VIS_ONLY __hash_const_iterator; +template class _LIBCPP_TYPE_VIS_ONLY __hash_local_iterator; +template class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator; template class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator; template class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator; +#if __cplusplus >= 201103L +template +union __hash_value_type; +#else +template +struct __hash_value_type; +#endif + +template +struct __key_value_types { + static_assert(!is_reference<_Tp>::value && !is_const<_Tp>::value, ""); + typedef _Tp key_type; + typedef _Tp __node_value_type; + typedef _Tp __container_value_type; + static const bool __is_map = false; +}; + +template +struct __key_value_types<__hash_value_type<_Key, _Tp> > { + typedef _Key key_type; + typedef _Tp mapped_type; + typedef __hash_value_type<_Key, _Tp> __node_value_type; + typedef pair__container_value_type; + typedef __container_value_type __map_value_type; + static const bool __is_map = true; +}; + +template , + bool = _KVTypes::__is_map> +struct __map_pointer_types {}; + +template +struct __map_pointer_types<_Tp, _AllocPtr, _KVTypes, true> { + typedef typename _KVTypes::__map_value_type _Mv; + typedef typename __rebind_pointer<_AllocPtr, _Mv>::type + __map_value_type_pointer; + typedef typename __rebind_pointer<_AllocPtr, const _Mv>::type + __const_map_value_type_pointer
[PATCH] D16951: [MS ABI] dllimport'd class cannot have constexpr ctors
majnemer created this revision. majnemer added reviewers: hans, rsmith, thakis, rnk. majnemer added a subscriber: cfe-commits. The installation of a class's vptr cannot be performed without code being executed. This implies that the constructor of a class cannot be constexpr. This fixes PR26506. http://reviews.llvm.org/D16951 Files: include/clang/Basic/DiagnosticSemaKinds.td lib/AST/DeclCXX.cpp lib/Sema/SemaDeclCXX.cpp test/CodeGenCXX/dllimport.cpp test/SemaCXX/dllimport.cpp Index: test/SemaCXX/dllimport.cpp === --- test/SemaCXX/dllimport.cpp +++ test/SemaCXX/dllimport.cpp @@ -1259,6 +1259,15 @@ template struct ExpliciallySpecializedClassTemplate {}; template <> struct __declspec(dllimport) ExpliciallySpecializedClassTemplate { void f() {} }; +struct __declspec(dllimport) PR26506_test1 { + virtual ~PR26506_test1() {} + constexpr PR26506_test1() = default; // expected-error{{defaulted definition of default constructor is not constexpr}} +}; + +struct __declspec(dllimport) PR26506_test2 { // expected-note{{due to 'PR26506_test2' being dllimported}} + virtual ~PR26506_test2() {} + constexpr PR26506_test2() {} // expected-error{{constructor cannot be marked constexpr}} +}; //===--===// // Classes with template base classes Index: test/CodeGenCXX/dllimport.cpp === --- test/CodeGenCXX/dllimport.cpp +++ test/CodeGenCXX/dllimport.cpp @@ -618,10 +618,10 @@ // GO1-DAG: @_ZTV1W = available_externally dllimport unnamed_addr constant [3 x i8*] [i8* null, i8* null, i8* bitcast (void (%struct.W*)* @_ZN1W3fooEv to i8*)] struct __declspec(dllimport) KeyFuncClass { - constexpr KeyFuncClass() {} + KeyFuncClass() {} virtual void foo(); }; -extern constexpr KeyFuncClass keyFuncClassVar = {}; +extern KeyFuncClass keyFuncClassVar = {}; // G32-DAG: @_ZTV12KeyFuncClass = external dllimport unnamed_addr constant [3 x i8*] struct __declspec(dllimport) X : public virtual W {}; Index: lib/Sema/SemaDeclCXX.cpp === --- lib/Sema/SemaDeclCXX.cpp +++ lib/Sema/SemaDeclCXX.cpp @@ -808,15 +808,25 @@ // constraints: // - the class shall not have any virtual base classes; const CXXRecordDecl *RD = MD->getParent(); +bool IsCtor = isa(NewFD); if (RD->getNumVBases()) { Diag(NewFD->getLocation(), diag::err_constexpr_virtual_base) -<< isa(NewFD) +<< IsCtor << getRecordDiagFromTagKind(RD->getTagKind()) << RD->getNumVBases(); for (const auto &I : RD->vbases()) Diag(I.getLocStart(), diag::note_constexpr_virtual_base_here) << I.getSourceRange(); return false; } +// A constructor for a polymorphic class cannot be constexpr if the class +// has been marked dllimport. This is because dllimport data cannot be +// resolved in a constant: code must be executed to dereference the __imp +// symbol. +if (IsCtor && RD->isPolymorphic() && RD->hasAttr()) { + Diag(NewFD->getLocation(), diag::err_constexpr_ctor); + Diag(RD->getLocStart(), diag::note_due_to_dllimported_class) << RD; + return false; +} } if (!isa(NewFD)) { Index: lib/AST/DeclCXX.cpp === --- lib/AST/DeclCXX.cpp +++ lib/AST/DeclCXX.cpp @@ -463,6 +463,12 @@ } } + // We cannot have a constexpr default constructor if the class is polymorphic + // because it is impossible to synthesize a reference to the imported vtable + // without generating code. + if (data().Polymorphic && hasAttr()) +data().DefaultedDefaultConstructorIsConstexpr = false; + // Notify the listener if an implicit member was added after the definition // was completed. if (!isBeingDefined() && D->isImplicit()) Index: include/clang/Basic/DiagnosticSemaKinds.td === --- include/clang/Basic/DiagnosticSemaKinds.td +++ include/clang/Basic/DiagnosticSemaKinds.td @@ -1949,6 +1949,9 @@ "constexpr%select{; did you intend to make it %select{const|static}0?|}1">; def err_constexpr_tag : Error< "%select{class|struct|interface|union|enum}0 cannot be marked constexpr">; +def err_constexpr_ctor : Error<"constructor cannot be marked constexpr">; +def note_due_to_dllimported_class : Note< + "due to %0 being dllimported">; def err_constexpr_dtor : Error<"destructor cannot be marked constexpr">; def err_constexpr_no_declarators : Error< "constexpr can only be used in variable and function declarations">; Index: test/SemaCXX/dllimport.cpp === --- test/SemaCXX/dllimport.cpp +++ test/SemaCXX/dllimport.cpp @@ -1259,6 +1259,15 @@ template struct ExpliciallySpecializedClassTemplate {}
Please review: http://reviews.llvm.org/D15883 and http://reviews.llvm.org/D15781
Hi there, Could someone take a look at http://reviews.llvm.org/D15883 and http://reviews.llvm.org/D15781. I was halfway through the review process, with Logan (on to: line) as my main reviewer, but he seems to have become unresponsive. I was told by Logan to submit patch D15883 first, so as not to break the bootstrap build of compiler-rt. Hence the reason for the two separate patches. Your reviews will be much appreciated! Cheers, Timon ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r260017 - Sema: handle typo correction on ARC'ed ivar
Author: compnerd Date: Sat Feb 6 20:30:59 2016 New Revision: 260017 URL: http://llvm.org/viewvc/llvm-project?rev=260017&view=rev Log: Sema: handle typo correction on ARC'ed ivar The ivar ref would be transformed by the Typo Correction TreeTransform, but not be owned, resulting in the source location being invalid. This would eventually lead to an assertion in findCapturingExpr. Prevent this assertion from triggering. Resolves PR25113. Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp cfe/trunk/test/SemaObjC/typo-correction-arc.m Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=260017&r1=260016&r2=260017&view=diff == --- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original) +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Sat Feb 6 20:30:59 2016 @@ -6590,6 +6590,10 @@ public: return Owned(E); } + ExprResult TransformObjCIvarRefExpr(ObjCIvarRefExpr *E) { +return Owned(E); + } + ExprResult Transform(Expr *E) { ExprResult Res; while (true) { Modified: cfe/trunk/test/SemaObjC/typo-correction-arc.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/typo-correction-arc.m?rev=260017&r1=260016&r2=260017&view=diff == --- cfe/trunk/test/SemaObjC/typo-correction-arc.m (original) +++ cfe/trunk/test/SemaObjC/typo-correction-arc.m Sat Feb 6 20:30:59 2016 @@ -2,16 +2,21 @@ typedef unsigned long NSUInteger; +id nameless; // expected-note{{'nameless' declared here}} + @interface NSArray - (instancetype)initWithObjects:(const id[])objects count:(NSUInteger)count; @end @interface I @property NSArray *array; +- (id)getArrayById:(id)name; +- (void)setArrayValue:(id)array; @end @interface J - (void)setArray:(id)array; +- (void)setIvarArray; @end @implementation J { @@ -20,5 +25,8 @@ typedef unsigned long NSUInteger; - (void)setArray:(id)array { // expected-note{{'array' declared here}} i.array = aray; // expected-error{{use of undeclared identifier 'aray'; did you mean 'array'}} } +- (void)setIvarArray { + [i setArrayValue:[i getArrayById:nameles]]; // expected-error{{use of undeclared identifier 'nameles'; did you mean 'nameless'}} +} @end ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r260016 - Sema: handle typo correction with ARC'ed objc properties
Author: compnerd Date: Sat Feb 6 20:30:55 2016 New Revision: 260016 URL: http://llvm.org/viewvc/llvm-project?rev=260016&view=rev Log: Sema: handle typo correction with ARC'ed objc properties We would previously assert in findCapturingExpr when performing a typo correction resulting in an assignment of an ObjC property with a strong lifetype specifier due to the expression not being rooted in the file (invalid SLoc) during the retain cycle check on the typo-corrected expression. Handle the expression type appropriately during the TreeTransform to ensure that we have a source location associated with the expression. Fixes PR26486. Added: cfe/trunk/test/SemaObjC/typo-correction-arc.m Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=260016&r1=260015&r2=260016&view=diff == --- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original) +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Sat Feb 6 20:30:55 2016 @@ -6586,6 +6586,10 @@ public: ExprResult TransformBlockExpr(BlockExpr *E) { return Owned(E); } + ExprResult TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { +return Owned(E); + } + ExprResult Transform(Expr *E) { ExprResult Res; while (true) { Added: cfe/trunk/test/SemaObjC/typo-correction-arc.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/typo-correction-arc.m?rev=260016&view=auto == --- cfe/trunk/test/SemaObjC/typo-correction-arc.m (added) +++ cfe/trunk/test/SemaObjC/typo-correction-arc.m Sat Feb 6 20:30:55 2016 @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -triple i386-apple-macosx10.10 -fobjc-arc -fsyntax-only -Wno-objc-root-class %s -verify + +typedef unsigned long NSUInteger; + +@interface NSArray +- (instancetype)initWithObjects:(const id[])objects count:(NSUInteger)count; +@end + +@interface I +@property NSArray *array; +@end + +@interface J +- (void)setArray:(id)array; +@end + +@implementation J { + I *i; +} +- (void)setArray:(id)array { // expected-note{{'array' declared here}} + i.array = aray; // expected-error{{use of undeclared identifier 'aray'; did you mean 'array'}} +} +@end + ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D16953: Enhance clang-tidy modernize-redundant-void-arg check to apply fixes to header files
LegalizeAdulthood created this revision. LegalizeAdulthood added a reviewer: alexfh. LegalizeAdulthood added a subscriber: cfe-commits. Update `check_clang_tidy.py` to handle fixes applied to header files by adding `--header-filter` argument that: - Passes `-header-filter` down to `clang-tidy` - Copies named header to temporary directory where `clang-tidy` is run - Performs `FileCheck` checks on the header for `CHECK-MESSAGES` - Performs `FileCheck` checks on the header for `CHECK-FIXES` Fixes PR25894 http://reviews.llvm.org/D16953 Files: clang-tidy/modernize/RedundantVoidArgCheck.cpp test/clang-tidy/check_clang_tidy.py test/clang-tidy/modernize-redundant-void-arg.cpp test/clang-tidy/modernize-redundant-void-arg.h Index: test/clang-tidy/modernize-redundant-void-arg.h === --- /dev/null +++ test/clang-tidy/modernize-redundant-void-arg.h @@ -0,0 +1,8 @@ +#ifndef LLVM_CLANG_TOOLS_EXTRA_TEST_CLANG_TIDY_MODERNIZE_REDUNDANT_VOID_ARG_H +#define LLVM_CLANG_TOOLS_EXTRA_TEST_CLANG_TIDY_MODERNIZE_REDUNDANT_VOID_ARG_H + +extern int foo(void); +// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: redundant void argument list in function declaration [modernize-redundant-void-arg] +// CHECK-FIXES: {{^}}extern int foo();{{$}} + +#endif // LLVM_CLANG_TOOLS_EXTRA_TEST_CLANG_TIDY_MODERNIZE_REDUNDANT_VOID_ARG_H Index: test/clang-tidy/modernize-redundant-void-arg.cpp === --- test/clang-tidy/modernize-redundant-void-arg.cpp +++ test/clang-tidy/modernize-redundant-void-arg.cpp @@ -1,4 +1,6 @@ -// RUN: %check_clang_tidy %s modernize-redundant-void-arg %t +// RUN: %check_clang_tidy --header-filter=modernize-redundant-void-arg.h %s modernize-redundant-void-arg %t + +#include "modernize-redundant-void-arg.h" #define NULL 0 Index: test/clang-tidy/check_clang_tidy.py === --- test/clang-tidy/check_clang_tidy.py +++ test/clang-tidy/check_clang_tidy.py @@ -25,6 +25,7 @@ """ import argparse +import os import re import subprocess import sys @@ -35,16 +36,98 @@ f.write(text) f.truncate() + +# Remove the contents of the CHECK lines to avoid CHECKs matching on +# themselves. We need to keep the comments to preserve line numbers while +# avoiding empty lines which could potentially trigger formatting-related +# checks. +def clean_text(input_text): + return re.sub('// *CHECK-[A-Z-]*:[^\r\n]*', '//', input_text) + + +def write_cleaned_header(input_file_path, temp_file_name, header_file_name): + src_path = os.path.join(os.path.dirname(input_file_path), header_file_name) + fixed_path = os.path.join(os.path.dirname(temp_file_name), header_file_name) + with open(src_path, 'r') as input_file: +cleaned_text = clean_text(input_file.read()) + cleaned_path = fixed_path + '.orig' + write_file(cleaned_path, cleaned_text) + write_file(fixed_path, cleaned_text) + return cleaned_path, fixed_path, src_path + + +def separate_output(clang_tidy_output, header_file_name, input_file_name): + input_file_name = os.path.basename(input_file_name) + input_file_output = '' + header_file_output = '' + input_messages = True + for line in clang_tidy_output.splitlines(True): +if input_messages: + if header_file_name in line: +input_messages = False +header_file_output += line + else: +input_file_output += line +else: + if input_file_name in line: +input_messages = True +input_file_output += line + else: +header_file_output += line + return header_file_output, input_file_output + + +def try_run(args): + try: +clang_tidy_output = \ + subprocess.check_output(args, stderr=subprocess.STDOUT).decode() + except subprocess.CalledProcessError as e: +print('%s failed:\n%s' % (' '.join(args), e.output.decode())) +raise + return clang_tidy_output + + +def check_output_for_messages(messages_file, input_file_name): + try_run( +['FileCheck', '-input-file=' + messages_file, input_file_name, + '-check-prefix=CHECK-MESSAGES', + '-implicit-check-not={{warning|error}}:']) + + +def check_output_for_fixes(temp_file_name, input_file_name): + try_run( + ['FileCheck', '-input-file=' + temp_file_name, input_file_name, + '-check-prefix=CHECK-FIXES', '-strict-whitespace']) + + +def has_checks(input_text): + has_check_fixes = input_text.find('CHECK-FIXES') >= 0 + has_check_messages = input_text.find('CHECK-MESSAGES') >= 0 + return has_check_fixes, has_check_messages + + +def diff_source_files(original_file_name, temp_file_name): + try: +diff_output = subprocess.check_output( + ['diff', '-u', original_file_name, temp_file_name], + stderr=subprocess.STDOUT) + except subprocess.CalledProcessError as e: +diff_output = e.output + return diff_output + + def main(): parser = argparse.ArgumentParser() parser.add_argument('
r260019 - Driver: adjust linker invocation for GNUTools
Author: compnerd Date: Sun Feb 7 00:03:38 2016 New Revision: 260019 URL: http://llvm.org/viewvc/llvm-project?rev=260019&view=rev Log: Driver: adjust linker invocation for GNUTools Adjust the driver to invoke the linker more similar to gcc. -dynamic-linker is only passed if -static and -shared are not part of the compiler (driver) invocation. Replicate the passing of -export-rdynamic as per the GCC link spec: %{!static: %{rdynamic:-export-dynamic} %{!shared:-dynamic-linker ...}} This behaviour is consistent across all the targets that are supported, so no need to conditionalise it on the target. Resolves PR24245. Added: cfe/trunk/test/Driver/dynamic-linker.c Modified: cfe/trunk/lib/Driver/Tools.cpp Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=260019&r1=260018&r2=260019&view=diff == --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Sun Feb 7 00:03:38 2016 @@ -8900,13 +8900,16 @@ void gnutools::Linker::ConstructJob(Comp CmdArgs.push_back("-shared"); } - if (Arch == llvm::Triple::arm || Arch == llvm::Triple::armeb || - Arch == llvm::Triple::thumb || Arch == llvm::Triple::thumbeb || - (!Args.hasArg(options::OPT_static) && - !Args.hasArg(options::OPT_shared))) { -CmdArgs.push_back("-dynamic-linker"); -CmdArgs.push_back(Args.MakeArgString( -D.DyldPrefix + getLinuxDynamicLinker(Args, ToolChain))); + if (!Args.hasArg(options::OPT_static)) { +if (Args.hasArg(options::OPT_rdynamic)) + CmdArgs.push_back("-export-dynamic"); + +if (!Args.hasArg(options::OPT_shared)) { + const std::string Loader = + D.DyldPrefix + getLinuxDynamicLinker(Args, ToolChain); + CmdArgs.push_back("-dynamic-linker"); + CmdArgs.push_back(Args.MakeArgString(Loader)); +} } CmdArgs.push_back("-o"); Added: cfe/trunk/test/Driver/dynamic-linker.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/dynamic-linker.c?rev=260019&view=auto == --- cfe/trunk/test/Driver/dynamic-linker.c (added) +++ cfe/trunk/test/Driver/dynamic-linker.c Sun Feb 7 00:03:38 2016 @@ -0,0 +1,32 @@ +// RUN: %clang -target armv7-unknown-linux-gnueabi -### /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-DYNAMIC-LINKER %s +// RUN: %clang -target i386-unknown-linux-gnu -### /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-DYNAMIC-LINKER %s +// RUN: %clang -target mips64-unknown-linux-gnu -### /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-DYNAMIC-LINKER %s +// RUN: %clang -target powerpc64-unknown-linux-gnu -### /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-DYNAMIC-LINKER %s +// RUN: %clang -target x86_64-unknown-linux-gnu -### /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-DYNAMIC-LINKER %s + +// RUN: %clang -target armv7-unknown-linux-gnueabi -### -shared /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-SHARED %s +// RUN: %clang -target i386-unknown-linux-gnu -### -shared /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-SHARED %s +// RUN: %clang -target mips64-unknown-linux-gnu -### -shared /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-SHARED %s +// RUN: %clang -target powerpc64-unknown-linux-gnu -### -shared /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-SHARED %s +// RUN: %clang -target x86_64-unknown-linux-gnu -### -shared /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-SHARED %s + + +// RUN: %clang -target armv7-unknown-linux-gnueabi -### -shared -rdynamic /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-SHARED -check-prefix CHECK-RDYNAMIC %s +// RUN: %clang -target i386-unknown-linux-gnu -### -shared -rdynamic /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-SHARED -check-prefix CHECK-RDYNAMIC %s +// RUN: %clang -target mips64-unknown-linux-gnu -### -shared -rdynamic /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-SHARED -check-prefix CHECK-RDYNAMIC %s +// RUN: %clang -target powerpc64-unknown-linux-gnu -### -shared -rdynamic /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-SHARED -check-prefix CHECK-RDYNAMIC %s +// RUN: %clang -target x86_64-unknown-linux-gnu -### -shared -rdynamic /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-SHARED -check-prefix CHECK-RDYNAMIC %s + +// RUN: %clang -target armv7-unknown-linux-gnueabi -### -static /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-STATIC %s +// RUN: %clang -target i386-unknown-linux-gnu -### -static /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-STATIC %s +// RUN: %clang -target mips64-unknown-linux-gnu -### -static /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-STATIC %s +// RUN: %clang -target powerpc64-unknown-
r260020 - Fix typo in comment. NFC
Author: ctopper Date: Sun Feb 7 00:39:23 2016 New Revision: 260020 URL: http://llvm.org/viewvc/llvm-project?rev=260020&view=rev Log: Fix typo in comment. NFC Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=260020&r1=260019&r2=260020&view=diff == --- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Sun Feb 7 00:39:23 2016 @@ -109,7 +109,7 @@ class CGDebugInfo { /// compilation. std::vector> ReplaceMap; - /// Cache of replaceable forward declarartions (functions and + /// Cache of replaceable forward declarations (functions and /// variables) to RAUW at the end of compilation. std::vector> FwdDeclReplaceMap; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r260021 - [PGO] add profile/coverage test cases for defaulted ctor/ctors
Author: davidxl Date: Sun Feb 7 00:57:29 2016 New Revision: 260021 URL: http://llvm.org/viewvc/llvm-project?rev=260021&view=rev Log: [PGO] add profile/coverage test cases for defaulted ctor/ctors Added: cfe/trunk/test/Profile/def-ctors.cpp cfe/trunk/test/Profile/def-dtors.cpp Added: cfe/trunk/test/Profile/def-ctors.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Profile/def-ctors.cpp?rev=260021&view=auto == --- cfe/trunk/test/Profile/def-ctors.cpp (added) +++ cfe/trunk/test/Profile/def-ctors.cpp Sun Feb 7 00:57:29 2016 @@ -0,0 +1,49 @@ +// RUN: %clang_cc1 -x c++ -std=c++11 %s -triple x86_64-unknown-linux-gnu +// -main-file-name def-ctors.cpp -o - -emit-llvm -fprofile-instrument=clang | +// FileCheck --check-prefix=PGOGEN %s + +// RUN: %clang_cc1 -x c++ -std=c++11 %s -triple x86_64-unknown-linux-gnu +// -main-file-name def-ctors.cpp -o - -emit-llvm -fprofile-instrument=clang +// -fcoverage-mapping | FileCheck --check-prefix=COVMAP %s + +struct Base { + int B; + Base() : B(2) {} + Base(const struct Base &b2) { +if (b2.B == 0) { + B = b2.B + 1; +} else + B = b2.B; + } +}; + +struct Derived : public Base { + Derived(const Derived &) = default; + // PGOGEN-DAG: define {{.*}}@_ZN7DerivedC2ERKS_ + // PGOGEN-DAG: %pgocount = load {{.*}} @__profc__ZN7DerivedC2ERKS_ + // PGOGEN-DAG: {{.*}}add{{.*}}%pgocount, 1 + // PGOGEN-DAG: store{{.*}}@__profc__ZN7DerivedC2ERKS_ + Derived() = default; + // PGOGEN-DAG: define {{.*}}@_ZN7DerivedC2Ev + // PGOGEN-DAG: %pgocount = load {{.*}} @__profc__ZN7DerivedC2Ev + // PGOGEN-DAG: {{.*}}add{{.*}}%pgocount, 1 + // PGOGEN-DAG: store{{.*}}@__profc__ZN7DerivedC2Ev + + // Check that coverage mapping has 6 function records including + // the defaulted Derived::Derived(const Derived), and Derived::Derived() + // methds. + // COVMAP: @__llvm_coverage_mapping = {{.*}} { { i32, i32, i32, i32 }, [6 x + // <{{.*}}>], + int I; + int J; + int getI() { return I; } +}; + +Derived dd; +int g; +int main() { + Derived dd2(dd); + + g = dd2.getI(); + return 0; +} Added: cfe/trunk/test/Profile/def-dtors.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Profile/def-dtors.cpp?rev=260021&view=auto == --- cfe/trunk/test/Profile/def-dtors.cpp (added) +++ cfe/trunk/test/Profile/def-dtors.cpp Sun Feb 7 00:57:29 2016 @@ -0,0 +1,39 @@ +// RUN: %clang_cc1 -x c++ -std=c++11 %s -triple x86_64-unknown-linux-gnu +// -main-file-name def-dtors.cpp -o - -emit-llvm -fprofile-instrument=clang | +// FileCheck --check-prefix=PGOGEN %s + +// RUN: %clang_cc1 -x c++ -std=c++11 %s -triple x86_64-unknown-linux-gnu +// -main-file-name def-dtors.cpp -o - -emit-llvm -fprofile-instrument=clang +// -fcoverage-mapping | FileCheck --check-prefix=COVMAP %s + +struct Base { + int B; + Base(int B_) : B(B_) {} + ~Base() {} +}; + +struct Derived : public Base { + Derived(int K) : Base(K), I(K), J(K) {} + ~Derived() = default; + // PGOGEN-LABEL: define {{.*}}@_ZN7DerivedD2Ev + // PGOGEN: %pgocount = load {{.*}} @__profc__ZN7DerivedD2Ev + // PGOGEN: {{.*}}add{{.*}}%pgocount, 1 + // PGOGEN: store{{.*}}@__profc__ZN7DerivedD2Ev + + // Check that coverage mapping has 6 function records including + // the default destructor in the derived class. + // COVMAP: @__llvm_coverage_mapping = {{.*}} { { i32, i32, i32, i32 }, [6 x + // <{{.*}}>], + + int I; + int J; + int getI() { return I; } +}; + +Derived dd(100); +int g; +int main() { + Derived dd2(dd.getI()); + g = dd2.getI(); + return 0; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r260022 - Fix test case problem(caused by clang-format
Author: davidxl Date: Sun Feb 7 01:13:18 2016 New Revision: 260022 URL: http://llvm.org/viewvc/llvm-project?rev=260022&view=rev Log: Fix test case problem(caused by clang-format Modified: cfe/trunk/test/Profile/def-ctors.cpp cfe/trunk/test/Profile/def-dtors.cpp Modified: cfe/trunk/test/Profile/def-ctors.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Profile/def-ctors.cpp?rev=260022&r1=260021&r2=260022&view=diff == --- cfe/trunk/test/Profile/def-ctors.cpp (original) +++ cfe/trunk/test/Profile/def-ctors.cpp Sun Feb 7 01:13:18 2016 @@ -1,10 +1,6 @@ -// RUN: %clang_cc1 -x c++ -std=c++11 %s -triple x86_64-unknown-linux-gnu -// -main-file-name def-ctors.cpp -o - -emit-llvm -fprofile-instrument=clang | -// FileCheck --check-prefix=PGOGEN %s +// RUN: %clang_cc1 -x c++ -std=c++11 %s -triple x86_64-unknown-linux-gnu -main-file-name def-ctors.cpp -o - -emit-llvm -fprofile-instrument=clang | FileCheck --check-prefix=PGOGEN %s -// RUN: %clang_cc1 -x c++ -std=c++11 %s -triple x86_64-unknown-linux-gnu -// -main-file-name def-ctors.cpp -o - -emit-llvm -fprofile-instrument=clang -// -fcoverage-mapping | FileCheck --check-prefix=COVMAP %s +// RUN: %clang_cc1 -x c++ -std=c++11 %s -triple x86_64-unknown-linux-gnu -main-file-name def-ctors.cpp -o - -emit-llvm -fprofile-instrument=clang -fcoverage-mapping | FileCheck --check-prefix=COVMAP %s struct Base { int B; Modified: cfe/trunk/test/Profile/def-dtors.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Profile/def-dtors.cpp?rev=260022&r1=260021&r2=260022&view=diff == --- cfe/trunk/test/Profile/def-dtors.cpp (original) +++ cfe/trunk/test/Profile/def-dtors.cpp Sun Feb 7 01:13:18 2016 @@ -1,10 +1,6 @@ -// RUN: %clang_cc1 -x c++ -std=c++11 %s -triple x86_64-unknown-linux-gnu -// -main-file-name def-dtors.cpp -o - -emit-llvm -fprofile-instrument=clang | -// FileCheck --check-prefix=PGOGEN %s +// RUN: %clang_cc1 -x c++ -std=c++11 %s -triple x86_64-unknown-linux-gnu -main-file-name def-dtors.cpp -o - -emit-llvm -fprofile-instrument=clang | FileCheck --check-prefix=PGOGEN %s -// RUN: %clang_cc1 -x c++ -std=c++11 %s -triple x86_64-unknown-linux-gnu -// -main-file-name def-dtors.cpp -o - -emit-llvm -fprofile-instrument=clang -// -fcoverage-mapping | FileCheck --check-prefix=COVMAP %s +// RUN: %clang_cc1 -x c++ -std=c++11 %s -triple x86_64-unknown-linux-gnu -main-file-name def-dtors.cpp -o - -emit-llvm -fprofile-instrument=clang -fcoverage-mapping | FileCheck --check-prefix=COVMAP %s struct Base { int B; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits