[PATCH] D26588: Add LocationContext to members of check::RegionChanges
zaks.anna added a comment. Hi and welcome to the project! This patch definitely looks quite complex for a first contribution, so great job at digging through the analyzer internals! One higher level comment I have is that you should try and split patches whenever possible. For example, in the description, you mention that the patch contains 2 changes: - extending RegionChanges interface with LocationContext - adding an easy way to obtain arguments' SVals from StackFrameCtx Since they are independent changes, please submit them as separate patches. This simplifies the job of the reviewers and anyone who will ever look at this patch in commit history or on phabricator. Also, this ensures that each change has sufficient test coverage. The LLVM Dev policy has a great explanation of the reasoning behind this: http://llvm.org/docs/DeveloperPolicy.html#incremental-development. How do you plan on testing these changes? The main 2 methods are unit tests and checker regression tests. Since no checker uses these maybe we should only commit them once such checker is added... I've only started looking at the first change and would like to understand the motivation behind it a bit more. Comment at: include/clang/StaticAnalyzer/Core/Checker.h:325 + const CallEvent *Call, + const LocationContext *LCtx) { +return ((const CHECKER *) checker)->checkRegionChanges(state, invalidated, LocationContext can be obtained by calling CallEvent::getLocationContext(). I do not think that adding another parameter here buys us much. Am I missing something? Comment at: include/clang/StaticAnalyzer/Core/Checker.h:333 + ProgramStateRef state, + const LocationContext *LCtx) { +return ((const CHECKER *) checker)->wantsRegionChangeUpdate(state, LCtx); What is the scenario in which you need the context here? The idea is that the checker would be interested in region changes if it is already tracking information in the state. For that check, the information in the state is sufficient. What is your scenario? Also, For any checker API change, we need to update the CheckerDocumentation.cpp. https://reviews.llvm.org/D26588 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
phosek updated this revision to Diff 77950. Repository: rL LLVM https://reviews.llvm.org/D26649 Files: CMakeLists.txt Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -511,10 +511,10 @@ set(STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-stamps/) set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-bins/) - # If the next stage is LTO we need to depend on LTO and possibly LLVMgold + # If the next stage is LTO we need to depend on LTO and possibly lld or LLVMgold if(BOOTSTRAP_LLVM_ENABLE_LTO OR LLVM_ENABLE_LTO AND NOT LLVM_BUILD_INSTRUMENTED) -add_dependencies(clang-bootstrap-deps LTO) if(APPLE) + add_dependencies(clang-bootstrap-deps LTO) # on Darwin we need to set DARWIN_LTO_LIBRARY so that -flto will work # using the just-built compiler, and we need to override DYLD_LIBRARY_PATH # so that the host object file tools will use the just-built libLTO. @@ -526,7 +526,12 @@ set(LTO_LIBRARY -DDARWIN_LTO_LIBRARY=${LLVM_SHLIB_OUTPUT_INTDIR}/libLTO.dylib -DDYLD_LIBRARY_PATH=${LLVM_LIBRARY_OUTPUT_INTDIR}) elseif(NOT WIN32) - add_dependencies(clang-bootstrap-deps LLVMgold llvm-ar llvm-ranlib) + add_dependencies(clang-bootstrap-deps llvm-ar llvm-ranlib) + if(BOOTSTRAP_LLVM_ENABLE_LLD) +add_dependencies(clang-bootstrap-deps lld) + elseif(LLVM_BINUTILS_INCDIR) +add_dependencies(clang-bootstrap-deps LLVMgold) + endif() set(LTO_AR -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar) set(LTO_RANLIB -DCMAKE_RANLIB=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib) endif() Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -511,10 +511,10 @@ set(STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-stamps/) set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-bins/) - # If the next stage is LTO we need to depend on LTO and possibly LLVMgold + # If the next stage is LTO we need to depend on LTO and possibly lld or LLVMgold if(BOOTSTRAP_LLVM_ENABLE_LTO OR LLVM_ENABLE_LTO AND NOT LLVM_BUILD_INSTRUMENTED) -add_dependencies(clang-bootstrap-deps LTO) if(APPLE) + add_dependencies(clang-bootstrap-deps LTO) # on Darwin we need to set DARWIN_LTO_LIBRARY so that -flto will work # using the just-built compiler, and we need to override DYLD_LIBRARY_PATH # so that the host object file tools will use the just-built libLTO. @@ -526,7 +526,12 @@ set(LTO_LIBRARY -DDARWIN_LTO_LIBRARY=${LLVM_SHLIB_OUTPUT_INTDIR}/libLTO.dylib -DDYLD_LIBRARY_PATH=${LLVM_LIBRARY_OUTPUT_INTDIR}) elseif(NOT WIN32) - add_dependencies(clang-bootstrap-deps LLVMgold llvm-ar llvm-ranlib) + add_dependencies(clang-bootstrap-deps llvm-ar llvm-ranlib) + if(BOOTSTRAP_LLVM_ENABLE_LLD) +add_dependencies(clang-bootstrap-deps lld) + elseif(LLVM_BINUTILS_INCDIR) +add_dependencies(clang-bootstrap-deps LLVMgold) + endif() set(LTO_AR -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar) set(LTO_RANLIB -DCMAKE_RANLIB=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib) endif() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
mehdi_amini added a comment. In https://reviews.llvm.org/D26649#595429, @phosek wrote: > AFAIK lld on Darwin doesn't support LTO (last I heard it cannot even > self-host at the moment) so I'm not sure if it makes sense to enable it > `if(APPLE)`. OK, we could error instead of ignoring then. But you still need to restore the dependency on libLTO, unless I'm missing something. Repository: rL LLVM https://reviews.llvm.org/D26649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
phosek added a comment. AFAIK lld on Darwin doesn't support LTO (last I heard it cannot even self-host at the moment) so I'm not sure if it makes sense to enable it `if(APPLE)`. Repository: rL LLVM https://reviews.llvm.org/D26649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D21737: [PATCH] [CodeGen] Insert TargetLibraryInfoWrapperPass before anything else.
mehdi_amini accepted this revision. mehdi_amini added a comment. This revision is now accepted and ready to land. LGTM. Thanks! Comment at: lib/CodeGen/BackendUtil.cpp:422 // Set up the per-function pass manager. + FPM.add(new TargetLibraryInfoWrapperPass(*TLII)); if (CodeGenOpts.VerifyModule) koriakin wrote: > mehdi_amini wrote: > > This seems unnecessary? > This ensures FPM passes get the right TLI as well - since I'm removing the > PMBuilder.LIbraryInfo assignment, they would otherwise get the > default-constructed ones. Or should I keep the assignment instead, and only > special-case MPM? Oh right, I was looking at the existing code and I missed that you were removing the LibraryInfo initialization. Repository: rL LLVM https://reviews.llvm.org/D21737 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r286932 - Missed one of the try blocks the first time :-(. Thanks to Renato for the heads up.
Author: marshall Date: Mon Nov 14 23:03:22 2016 New Revision: 286932 URL: http://llvm.org/viewvc/llvm-project?rev=286932&view=rev Log: Missed one of the try blocks the first time :-(. Thanks to Renato for the heads up. Modified: libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp Modified: libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp?rev=286932&r1=286931&r2=286932&view=diff == --- libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp (original) +++ libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp Mon Nov 14 23:03:22 2016 @@ -64,7 +64,7 @@ test(SV sv, unsigned pos, unsigned n, co { typedef typename S::traits_type T; typedef typename S::allocator_type A; -try +if (pos <= sv.size()) { S s2(sv, pos, n, a); LIBCPP_ASSERT(s2.__invariants()); @@ -75,10 +75,20 @@ test(SV sv, unsigned pos, unsigned n, co assert(s2.get_allocator() == a); assert(s2.capacity() >= s2.size()); } -catch (std::out_of_range&) +#ifndef TEST_HAS_NO_EXCEPTIONS +else { -assert(pos > sv.size()); +try +{ +S s2(sv, pos, n, a); +assert(false); +} +catch (std::out_of_range&) +{ +assert(pos > sv.size()); +} } +#endif } int main() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
mehdi_amini added a comment. What about the following logic? if(BOOTSTRAP_LLVM_ENABLE_LLD) add_dependencies(clang-bootstrap-deps lld) endif() if(APPLE) # on Darwin we need to set DARWIN_LTO_LIBRARY so that -flto will work # using the just-built compiler, and we need to override DYLD_LIBRARY_PATH # so that the host object file tools will use the just-built libLTO. # However if System Integrity Protection is enabled the DYLD variables # will be scrubbed from the environment of any base system commands. This # includes /bin/sh, which ninja uses when executing build commands. To # work around the envar being filtered away we pass it in as a CMake # variable, and have LLVM's CMake append the envar to the archiver calls. set(LTO_LIBRARY -DDARWIN_LTO_LIBRARY=${LLVM_SHLIB_OUTPUT_INTDIR}/libLTO.dylib -DDYLD_LIBRARY_PATH=${LLVM_LIBRARY_OUTPUT_INTDIR}) elseif(NOT WIN32) add_dependencies(clang-bootstrap-deps llvm-ar llvm-ranlib) if(NOT LLVM_ENABLE_LLD AND LLVM_BINUTILS_INCDIR) add_dependencies(clang-bootstrap-deps LLVMgold) endif() set(LTO_AR -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar) set(LTO_RANLIB -DCMAKE_RANLIB=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib) endif() endif() I'm not even sure why we don't use `llvm-ar` and `llvm-ranlib` on OSX by the way, this makes the logic more complicated here, but there might be a good reason for that. Repository: rL LLVM https://reviews.llvm.org/D26649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
mehdi_amini requested changes to this revision. mehdi_amini added inline comments. This revision now requires changes to proceed. Comment at: CMakeLists.txt:516 if(BOOTSTRAP_LLVM_ENABLE_LTO OR LLVM_ENABLE_LTO AND NOT LLVM_BUILD_INSTRUMENTED) -add_dependencies(clang-bootstrap-deps LTO) if(APPLE) This is needed in the "if(APPLE)" case. And conditonalized by "if(!BOOTSTRAP_LLVM_ENABLE_LLD))" Comment at: CMakeLists.txt:530 + if(BOOTSTRAP_LLVM_ENABLE_LLD) +add_dependencies(clang-bootstrap-deps lld) + elseif(LLVM_BINUTILS_INCDIR) Actually, not clear why this is behind `if(!APPLE)` Repository: rL LLVM https://reviews.llvm.org/D26649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26559: Insert a type check before reading vtable.
krasin added inline comments. Comment at: lib/CodeGen/CGExprCXX.cpp:93 + + EmitTypeCheck(CodeGenFunction::TCK_MemberCall, +CallLoc, This, C.getRecordType(DD->getParent())); pcc wrote: > krasin wrote: > > pcc wrote: > > > pcc wrote: > > > > Is it correct to emit a type check at this point? Looking at [0] it > > > > looks like this function is only called from the Microsoft C++ ABI > > > > after we have already resolved the virtual function pointer. > > > > > > > > [0] > > > > http://llvm-cs.pcc.me.uk/tools/clang/lib/CodeGen/CGExprCXX.cpp/rEmitCXXDestructorCall > > > What about this comment? > > Sorry, I have missed the comment. I have added this check here to preserve > > the existing behavior. > > > > From what you describe, there could be a very similar issue related to the > > Microsoft C++ ABI to the one that I fix here. I am okay to file a bug or > > add a note about this, your choice. > Have you looked at how hard it would be to fix this? Done. Note: since I don't have an ability to test on Windows, this CL is now high-risk. If it breaks any Windows-specific tests, when submitted, I will revert the CL and undo the MSABI change. After all, the previous state was to keep things working as they were before. https://reviews.llvm.org/D26559 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
mehdi_amini accepted this revision. mehdi_amini added a reviewer: mehdi_amini. mehdi_amini added a comment. This revision is now accepted and ready to land. LGTM. Repository: rL LLVM https://reviews.llvm.org/D26649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26559: Insert a type check before reading vtable.
krasin updated this revision to Diff 77941. krasin added a comment. Do better job with destructors. https://reviews.llvm.org/D26559 Files: lib/CodeGen/CGExprCXX.cpp lib/CodeGen/MicrosoftCXXABI.cpp test/CodeGenCXX/ubsan-vtable-checks.cpp Index: test/CodeGenCXX/ubsan-vtable-checks.cpp === --- /dev/null +++ test/CodeGenCXX/ubsan-vtable-checks.cpp @@ -0,0 +1,40 @@ +// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm -fsanitize=null %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NULL --check-prefix=ITANIUM +// RUN: %clang_cc1 -std=c++11 -triple x86_64-windows -emit-llvm -fsanitize=null %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NULL --check-prefix=MSABI +// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm -fsanitize=vptr %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-VPTR --check-prefix=ITANIUM +// RUN: %clang_cc1 -std=c++11 -triple x86_64-windows -emit-llvm -fsanitize=vptr %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-VPTR --check-prefix=MSABI +struct T { + virtual ~T() {} + virtual int v() { return 1; } +}; + +struct U : T { + ~U(); + virtual int v() { return 2; } +}; + +U::~U() {} + +// ITANIUM: define i32 @_Z5get_vP1T +// MSABI: define i32 @"\01?get_v +int get_v(T* t) { + // First, we check that vtable is not loaded before a type check. + // CHECK-NULL-NOT: load {{.*}} (%struct.T*{{.*}})**, {{.*}} (%struct.T*{{.*}})*** + // CHECK-NULL: [[UBSAN_CMP_RES:%[0-9]+]] = icmp ne %struct.T* %{{[_a-z0-9]+}}, null + // CHECK-NULL-NEXT: br i1 [[UBSAN_CMP_RES]], label %cont, label %handler.type_mismatch + // CHECK-NULL: call void @__ubsan_handle_type_mismatch_abort + // Second, we check that vtable is actually loaded once the type check is done. + // CHECK-NULL: load {{.*}} (%struct.T*{{.*}})**, {{.*}} (%struct.T*{{.*}})*** + return t->v(); +} + +// ITANIUM: define void @_Z9delete_itP1T +// MSABI: define void @"\01?delete_it +void delete_it(T *t) { + // First, we check that vtable is not loaded before a type check. + // CHECK-VPTR-NOT: load {{.*}} (%struct.T*{{.*}})**, {{.*}} (%struct.T*{{.*}})*** + // CHECK-VPTR: br i1 {{.*}} label %handler.dynamic_type_cache_miss + // CHECK-VPTR: call void @__ubsan_handle_dynamic_type_cache_miss_abort + // Second, we check that vtable is actually loaded once the type check is done. + // CHECK-VPTR: load {{.*}} (%struct.T*{{.*}})**, {{.*}} (%struct.T*{{.*}})*** + delete t; +} Index: lib/CodeGen/MicrosoftCXXABI.cpp === --- lib/CodeGen/MicrosoftCXXABI.cpp +++ lib/CodeGen/MicrosoftCXXABI.cpp @@ -1817,16 +1817,21 @@ assert(CE == nullptr || CE->arg_begin() == CE->arg_end()); assert(DtorType == Dtor_Deleting || DtorType == Dtor_Complete); + ASTContext &Context = getContext(); + SourceLocation CallLoc = CE ? CE->getLocStart() : SourceLocation(); + CGF.EmitTypeCheck(CodeGenFunction::TCK_MemberCall, +CallLoc, This.getPointer(), +Context.getRecordType(Dtor->getParent())); + // We have only one destructor in the vftable but can get both behaviors // by passing an implicit int parameter. GlobalDecl GD(Dtor, Dtor_Deleting); const CGFunctionInfo *FInfo = &CGM.getTypes().arrangeCXXStructorDeclaration( Dtor, StructorType::Deleting); llvm::Type *Ty = CGF.CGM.getTypes().GetFunctionType(*FInfo); CGCallee Callee = getVirtualFunctionPointer( - CGF, GD, This, Ty, CE ? CE->getLocStart() : SourceLocation()); + CGF, GD, This, Ty, CallLoc); - ASTContext &Context = getContext(); llvm::Value *ImplicitParam = llvm::ConstantInt::get( llvm::IntegerType::getInt32Ty(CGF.getLLVMContext()), DtorType == Dtor_Deleting); Index: lib/CodeGen/CGExprCXX.cpp === --- lib/CodeGen/CGExprCXX.cpp +++ lib/CodeGen/CGExprCXX.cpp @@ -35,17 +35,6 @@ "Trying to emit a member or operator call expr on a static method!"); ASTContext &C = CGF.getContext(); - // C++11 [class.mfct.non-static]p2: - // If a non-static member function of a class X is called for an object that - // is not of type X, or of a type derived from X, the behavior is undefined. - SourceLocation CallLoc; - if (CE) -CallLoc = CE->getExprLoc(); - CGF.EmitTypeCheck(isa(MD) -? CodeGenFunction::TCK_ConstructorCall -: CodeGenFunction::TCK_MemberCall, -CallLoc, This, C.getRecordType(MD->getParent())); - // Push the this ptr. const CXXRecordDecl *RD = CGF.CGM.getCXXABI().getThisArgumentTypeForMethod(MD); @@ -293,6 +282,19 @@ llvm::FunctionType *Ty = CGM.getTypes().GetFunctionType(*FInfo); + // C++11 [class.mfct.non-static]p2: + // If a non-static member function of a class X is called for an object that + // is not of type X, or
[PATCH] D26588: Add LocationContext to members of check::RegionChanges
NoQ added inline comments. Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:735 + const FunctionDecl *FunctionDecl = SFC->getDecl()->getAsFunction(); + unsigned NumArgs = FunctionDecl->getNumParams(); + assert(ArgIdx < NumArgs && "Arg access out of range!"); a.sidorin wrote: > Maybe we should put a check that requested StackFrame is our StackFrame or > our parent StackFrame here? Hmm. We should probably add a similar check to `getSVal(Ex, LCtx)`!- and also check that `Ex` is an active expression. Unfortunately, we do not know the current location context within any of these methods, not sure how to implement that. https://reviews.llvm.org/D26588 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26657: [Sema] Respect DLL attributes more faithfully
smeenai created this revision. smeenai added reviewers: compnerd, hans. smeenai added a subscriber: cfe-commits. On MSVC, if an implicit instantiation already exists and an explicit instantiation definition with a DLL attribute is created, the DLL attribute still takes effect. Make clang match this behavior. https://reviews.llvm.org/D26657 Files: lib/Sema/SemaTemplate.cpp test/CodeGenCXX/dllexport.cpp test/CodeGenCXX/dllimport.cpp test/CodeGenCXX/windows-itanium-dllexport.cpp Index: test/CodeGenCXX/windows-itanium-dllexport.cpp === --- test/CodeGenCXX/windows-itanium-dllexport.cpp +++ test/CodeGenCXX/windows-itanium-dllexport.cpp @@ -23,3 +23,8 @@ // CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIcEaSERKS0_ // CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIcE1fEv +c g; +template class __declspec(dllexport) c; + +// CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIdEaSERKS0_ +// CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIdE1fEv Index: test/CodeGenCXX/dllimport.cpp === --- test/CodeGenCXX/dllimport.cpp +++ test/CodeGenCXX/dllimport.cpp @@ -814,6 +814,13 @@ // M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"\01?f@?$ExplicitInstantiationDeclExportedDefImportedTemplate@H@@QAEXXZ" // M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc %struct.ExplicitInstantiationDeclExportedDefImportedTemplate* @"\01??0?$ExplicitInstantiationDeclExportedDefImportedTemplate@H@@QAE@XZ" +template struct ImplicitInstantiationExplicitInstantiationDefImportedTemplate { void f() {} }; +ImplicitInstantiationExplicitInstantiationDefImportedTemplate ImplicitInstantiationExplicitInstantiationDefImportedTemplateInstance; +template class __declspec(dllimport) ImplicitInstantiationExplicitInstantiationDefImportedTemplate; +USEMEMFUNC(ImplicitInstantiationExplicitInstantiationDefImportedTemplate, f); +// M32-DAG: declare dllimport x86_thiscallcc void @"\01?f@?$ImplicitInstantiationExplicitInstantiationDefImportedTemplate@H@@QAEXXZ" +// G32-DAG: define weak_odr x86_thiscallcc void @_ZN61ImplicitInstantiationExplicitInstantiationDefImportedTemplateIiE1fEv + template struct PR23770BaseTemplate { void f() {} }; template struct PR23770DerivedTemplate : PR23770BaseTemplate {}; extern template struct PR23770DerivedTemplate; Index: test/CodeGenCXX/dllexport.cpp === --- test/CodeGenCXX/dllexport.cpp +++ test/CodeGenCXX/dllexport.cpp @@ -771,6 +771,13 @@ // M32-DAG: define weak_odr dllexport x86_thiscallcc %struct.ExplicitInstantiationDeclExportedDefTemplate* @"\01??0?$ExplicitInstantiationDeclExportedDefTemplate@H@@QAE@XZ" // G32-DAG: define weak_odr x86_thiscallcc void @_ZN44ExplicitInstantiationDeclExportedDefTemplateIiE1fEv +template struct ImplicitInstantiationExplicitInstantiationDefExportedTemplate { void f() {} }; +ImplicitInstantiationExplicitInstantiationDefExportedTemplate ImplicitInstantiationExplicitInstantiationDefExportedTemplateInstance; +template class __declspec(dllexport) ImplicitInstantiationExplicitInstantiationDefExportedTemplate; +USEMEMFUNC(ImplicitInstantiationExplicitInstantiationDefExportedTemplate, f); +// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01?f@?$ImplicitInstantiationExplicitInstantiationDefExportedTemplate@H@@QAEXXZ" +// G32-DAG: define weak_odr x86_thiscallcc void @_ZN61ImplicitInstantiationExplicitInstantiationDefExportedTemplateIiE1fEv + namespace { struct InternalLinkageType {}; } struct __declspec(dllexport) PR23308 { void f(InternalLinkageType*); Index: lib/Sema/SemaTemplate.cpp === --- lib/Sema/SemaTemplate.cpp +++ lib/Sema/SemaTemplate.cpp @@ -7665,20 +7665,22 @@ Specialization->getDefinition()); if (Def) { TemplateSpecializationKind Old_TSK = Def->getTemplateSpecializationKind(); -// Fix a TSK_ExplicitInstantiationDeclaration followed by a -// TSK_ExplicitInstantiationDefinition -if (Old_TSK == TSK_ExplicitInstantiationDeclaration && +// Fix a TSK_ExplicitInstantiationDeclaration or a TSK_ImplicitInstantiation +// followed by a TSK_ExplicitInstantiationDefinition +if ((Old_TSK == TSK_ExplicitInstantiationDeclaration || + Old_TSK == TSK_ImplicitInstantiation) && (TSK == TSK_ExplicitInstantiationDefinition || DLLImportExplicitInstantiationDef)) { // FIXME: Need to notify the ASTMutationListener that we did this. Def->setTemplateSpecializationKind(TSK); - if (!getDLLAttr(Def) && getDLLAttr(Specialization) && + if (getDLLAttr(Specialization) && + (!getDLLAttr(Def) || Old_TSK == TSK_ImplicitInstantiation) && (Context.getTargetInfo().getCXXABI().isMicrosoft() || Context.getTargetInfo().g
[PATCH] D26546: [PPC] Add vec_insert4b/vec_extract4b to altivec.h
sfertile added inline comments. Comment at: lib/Headers/altivec.h:11908 +#define vec_extract4b(__a, __b) \ + vec_reve((vector unsigned long long) \ +__builtin_vsx_xxextractuw((__a), (12 - (__b & 0xF nemanjai wrote: > I find it difficult to follow and understand this logic when it's in the > header. > What I'd prefer to see here is that the macro simply expands into > `__builtin_vsx_xxextractuw` and then handle all this logic in the code that > emits an intrinsic call. > Namely if the target is little endian, we adjust the parameter, emit the > intrinsic call and finally emit a shufflevector. I think this is a good idea, looking at the code its not obvious what is going on. Comment at: lib/Headers/altivec.h:12014 +#define vec_insert4b(__a, __b, __c) \ + ((vector unsigned char)__builtin_vsx_xxinsertw((__a), (__b), (__c) & 0xF)) +#endif kbarton wrote: > nemanjai wrote: > > As far as I can tell by looking at this patch and the corresponding back > > end patch, the `__a` argument will have a word inserted into it and it will > > be returned. > > > > Is that the semantics that the ABI specifies (I can't seem to make sense of > > the description). > > > > ``` > > vector unsigned int a = { 0x, 0xBB, 0xCC, 0xDD }; > > vector unsigned char b = (vector unsigned char) 0xFF; > > vector unsigned char c = vec_insert4b(a, b, 4); > > // Do we expect vector c to be: > > // { 0xAA, 0xAA, 0xAA, 0xAA, 0xFF, 0xFF, 0xFF, 0xFF, 0xCC, 0xCC, 0xCC, > > 0xCC, 0xDD, 0xDD, 0xDD, 0xDD } > > ``` > I think the current version of the ABI document has an error in it. The > description of the vec_insert4b is identical to the vec_extract4b, so I > expect it was copy/pasted in error. I think we need to open up an (internal) > bug against the ABI and wait for clarification to complete this. You have it correct Nemanja, word 1 will be extracted from b, and it will get inserted into a. The word will be inserted at the byte position starting at the 3rd argument. (so in this case byte offsets 4 to 7) I talked to Bill Schmidt earlier today and he already has a bug open. It hasn't been updated yet, but it should roughly correspond to the description for the xxinsertw instruction: The contents of word element 1 of VSR[XB] are placed into byte elements UIM:UIM+3 of VSR[XT]. The contents of the remaining byte elements of VSR[XT] are not modified. Repository: rL LLVM https://reviews.llvm.org/D26546 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
phosek added a comment. In https://reviews.llvm.org/D26649#595367, @mehdi_amini wrote: > OK, but still, LLVM_ENABLE_LLD needs to be passed to stage-2, so it needs to > be actually BOOTSTRAP_LLVM_ENABLE_LLD. > I looked at all the CMake `_PASSTHROUGH` and didn't find it mentioned > anywhere. We could make it auto-forwarded in this case maybe, @beanz is best > to answer this. > > Have you looked into turning `if(LLVM_ENABLE_LLD)` into > `if(BOOTSTRAP_LLVM_ENABLE_LLD)`? > Technically we may want to have the stage-2 linked with lld even if lld is > not on the system and not available during stage1. Yes, I just finished a test build and `BOOTSTRAP_LLVM_ENABLE_LLD` seems to work, see the updated diff. Repository: rL LLVM https://reviews.llvm.org/D26649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
phosek updated this revision to Diff 77938. phosek marked an inline comment as done. Repository: rL LLVM https://reviews.llvm.org/D26649 Files: CMakeLists.txt Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -511,9 +511,8 @@ set(STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-stamps/) set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-bins/) - # If the next stage is LTO we need to depend on LTO and possibly LLVMgold + # If the next stage is LTO we need to depend on LTO and possibly lld or LLVMgold if(BOOTSTRAP_LLVM_ENABLE_LTO OR LLVM_ENABLE_LTO AND NOT LLVM_BUILD_INSTRUMENTED) -add_dependencies(clang-bootstrap-deps LTO) if(APPLE) # on Darwin we need to set DARWIN_LTO_LIBRARY so that -flto will work # using the just-built compiler, and we need to override DYLD_LIBRARY_PATH @@ -526,7 +525,12 @@ set(LTO_LIBRARY -DDARWIN_LTO_LIBRARY=${LLVM_SHLIB_OUTPUT_INTDIR}/libLTO.dylib -DDYLD_LIBRARY_PATH=${LLVM_LIBRARY_OUTPUT_INTDIR}) elseif(NOT WIN32) - add_dependencies(clang-bootstrap-deps LLVMgold llvm-ar llvm-ranlib) + add_dependencies(clang-bootstrap-deps llvm-ar llvm-ranlib) + if(BOOTSTRAP_LLVM_ENABLE_LLD) +add_dependencies(clang-bootstrap-deps lld) + elseif(LLVM_BINUTILS_INCDIR) +add_dependencies(clang-bootstrap-deps LLVMgold) + endif() set(LTO_AR -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar) set(LTO_RANLIB -DCMAKE_RANLIB=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib) endif() Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -511,9 +511,8 @@ set(STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-stamps/) set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-bins/) - # If the next stage is LTO we need to depend on LTO and possibly LLVMgold + # If the next stage is LTO we need to depend on LTO and possibly lld or LLVMgold if(BOOTSTRAP_LLVM_ENABLE_LTO OR LLVM_ENABLE_LTO AND NOT LLVM_BUILD_INSTRUMENTED) -add_dependencies(clang-bootstrap-deps LTO) if(APPLE) # on Darwin we need to set DARWIN_LTO_LIBRARY so that -flto will work # using the just-built compiler, and we need to override DYLD_LIBRARY_PATH @@ -526,7 +525,12 @@ set(LTO_LIBRARY -DDARWIN_LTO_LIBRARY=${LLVM_SHLIB_OUTPUT_INTDIR}/libLTO.dylib -DDYLD_LIBRARY_PATH=${LLVM_LIBRARY_OUTPUT_INTDIR}) elseif(NOT WIN32) - add_dependencies(clang-bootstrap-deps LLVMgold llvm-ar llvm-ranlib) + add_dependencies(clang-bootstrap-deps llvm-ar llvm-ranlib) + if(BOOTSTRAP_LLVM_ENABLE_LLD) +add_dependencies(clang-bootstrap-deps lld) + elseif(LLVM_BINUTILS_INCDIR) +add_dependencies(clang-bootstrap-deps LLVMgold) + endif() set(LTO_AR -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar) set(LTO_RANLIB -DCMAKE_RANLIB=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib) endif() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
mehdi_amini added a comment. In https://reviews.llvm.org/D26649#595361, @phosek wrote: > In https://reviews.llvm.org/D26649#595356, @mehdi_amini wrote: > > > In https://reviews.llvm.org/D26649#595296, @phosek wrote: > > > > > It's sufficient, I just tested it. > > > > > > How did you check it? I don't understand how LLVM_ENABLE_LLD is propagated > > to stage-2? > > > Sufficient as in Clang looks for lld in the same directory where > `clang`/`clang++` binary is first so we don't need to explicitly pass the > path to lld to later stages. OK, but still, LLVM_ENABLE_LLD needs to be passed to stage-2, so it needs to be actually BOOTSTRAP_LLVM_ENABLE_LLD. I looked at all the CMake `_PASSTHROUGH` and didn't find it mentioned anywhere. We could make it auto-forwarded in this case maybe, @beanz is best to answer this. Have you looked into turning `if(LLVM_ENABLE_LLD)` into `if(BOOTSTRAP_LLVM_ENABLE_LLD)`? Technically we may want to have the stage-2 linked with lld even if lld is not on the system and not available during stage1. Repository: rL LLVM https://reviews.llvm.org/D26649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
phosek added a comment. In https://reviews.llvm.org/D26649#595356, @mehdi_amini wrote: > In https://reviews.llvm.org/D26649#595296, @phosek wrote: > > > It's sufficient, I just tested it. > > > How did you check it? I don't understand how LLVM_ENABLE_LLD is propagated to > stage-2? Sufficient as in Clang looks for lld in the same directory where `clang`/`clang++` binary is first so we don't need to explicitly pass the path to lld to later stages. Comment at: CMakeLists.txt:534 +add_dependencies(LLVMgold) + endif() set(LTO_AR -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar) mehdi_amini wrote: > What if not by the way? Should we error out here? What is the expected > behavior? I assume that's platform dependent; if some platforms (other than Darwin) use linker other than gold or lld for LTO build, erroring out here might break them. I don't think there are any such platforms though because they'd be broken already as we currently always try to use LLVMgold which causes CMake error in case we're not building with Binutils (that's how I discovered this issue, since we're using lld rather than gold on our platform). Repository: rL LLVM https://reviews.llvm.org/D26649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
mehdi_amini added a comment. In https://reviews.llvm.org/D26649#595296, @phosek wrote: > It's sufficient, I just tested it. How did you check it? I don't understand how LLVM_ENABLE_LLD is propagated to stage-2? Comment at: CMakeLists.txt:534 +add_dependencies(LLVMgold) + endif() set(LTO_AR -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar) What if not by the way? Should we error out here? What is the expected behavior? Repository: rL LLVM https://reviews.llvm.org/D26649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
Eugene.Zelenko added a comment. Yes, you are correct, I meant later. Repository: rL LLVM https://reviews.llvm.org/D26649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
mehdi_amini added a comment. In https://reviews.llvm.org/D26649#595334, @Eugene.Zelenko wrote: > I meant that multi-stage build is processed by higher level script. So it > should take care about consistency of source code srt versus later stages > build options. We have a 2-stage build directly with a single CMake invocation, this is what this code path is about. Are you referring to this situation or are you referring to 2-stage builds that are not "visible" from CMake itself and requires to first build stage-1 before configuring stage-2 with a second cmake invocation? (If I understand correctly I suspect you meant the latter) Repository: rL LLVM https://reviews.llvm.org/D26649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
Eugene.Zelenko added a comment. I meant that multi-stage build is processed by higher level script. So it should take care about consistency of source code srt versus later stages build options. Repository: rL LLVM https://reviews.llvm.org/D26649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
mehdi_amini added a comment. In https://reviews.llvm.org/D26649#595301, @Eugene.Zelenko wrote: > I think this should be handled in higher level script > (utils/release/test-release.sh or similar), not in CMake. CMake compiler > tests just need to fail when LLVM_ENABLE_LLD is used without actually having > them. I don't understand what you mean here, mind elaborating a bit? Repository: rL LLVM https://reviews.llvm.org/D26649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r286927 - [analyzer] Rename assumeWithinInclusiveRange*()
Author: ddcc Date: Mon Nov 14 19:54:41 2016 New Revision: 286927 URL: http://llvm.org/viewvc/llvm-project?rev=286927&view=rev Log: [analyzer] Rename assumeWithinInclusiveRange*() Summary: The name is slightly confusing, since the constraint is not necessarily within the range unless `Assumption` is true. Split out renaming for ConstraintManager.h from D26061 Reviewers: zaks.anna, dcoughlin Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26644 Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h cfe/trunk/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp cfe/trunk/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp cfe/trunk/lib/StaticAnalyzer/Core/SimpleConstraintManager.h Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h?rev=286927&r1=286926&r2=286927&view=diff == --- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h (original) +++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h Mon Nov 14 19:54:41 2016 @@ -36,7 +36,7 @@ public: /// Construct a ConstraintVal indicating the constraint is underconstrained. ConditionTruthVal() {} - + /// Return true if the constraint is perfectly constrained to 'true'. bool isConstrainedTrue() const { return Val.hasValue() && Val.getValue(); @@ -58,11 +58,11 @@ public: return !Val.hasValue(); } }; - + class ConstraintManager { public: ConstraintManager() : NotifyAssumeClients(true) {} - + virtual ~ConstraintManager(); virtual ProgramStateRef assume(ProgramStateRef state, DefinedSVal Cond, @@ -99,25 +99,26 @@ public: return ProgramStatePair(StTrue, StFalse); } - virtual ProgramStateRef assumeWithinInclusiveRange(ProgramStateRef State, - NonLoc Value, - const llvm::APSInt &From, - const llvm::APSInt &To, - bool InBound) = 0; - - virtual ProgramStatePair assumeWithinInclusiveRangeDual( - ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, - const llvm::APSInt &To) { -ProgramStateRef StInRange = assumeWithinInclusiveRange(State, Value, From, - To, true); + virtual ProgramStateRef assumeInclusiveRange(ProgramStateRef State, + NonLoc Value, + const llvm::APSInt &From, + const llvm::APSInt &To, + bool InBound) = 0; + + virtual ProgramStatePair assumeInclusiveRangeDual(ProgramStateRef State, +NonLoc Value, +const llvm::APSInt &From, +const llvm::APSInt &To) { +ProgramStateRef StInRange = +assumeInclusiveRange(State, Value, From, To, true); // If StTrue is infeasible, asserting the falseness of Cond is unnecessary // because the existing constraints already establish this. if (!StInRange) return ProgramStatePair((ProgramStateRef)nullptr, State); -ProgramStateRef StOutOfRange = assumeWithinInclusiveRange(State, Value, - From, To, false); +ProgramStateRef StOutOfRange = +assumeInclusiveRange(State, Value, From, To, false); if (!StOutOfRange) { // We are careful to return the original state, /not/ StTrue, // because we want to avoid having callers generate a new node @@ -147,7 +148,7 @@ public: const char *sep) = 0; virtual void EndPath(ProgramStateRef state) {} - + /// Convenience method to query the state to see if a symbol is null or /// not null, or if neither assumption can be made. ConditionTruthVal isNull(ProgramStateRef State, SymbolRef Sym) { @@ -173,7 +174,7 @@ protected: virtual bool canReasonAbout(SVal X) const = 0; /// Returns whether or not a symbol is known to be null ("true"), known to be - /// non-null ("false"), or may be either ("underconstrained"). + /// non-null ("false"), or may be either ("underconstrained"). virtual ConditionTruthVal checkNull(ProgramStateRef State, SymbolRef Sym); }; Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/P
[PATCH] D26644: [analyzer] Rename assumeWithinInclusiveRange*()
This revision was automatically updated to reflect the committed changes. Closed by commit rL286927: [analyzer] Rename assumeWithinInclusiveRange*() (authored by ddcc). Changed prior to commit: https://reviews.llvm.org/D26644?vs=77930&id=77933#toc Repository: rL LLVM https://reviews.llvm.org/D26644 Files: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h cfe/trunk/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp cfe/trunk/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp cfe/trunk/lib/StaticAnalyzer/Core/SimpleConstraintManager.h Index: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp === --- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -1836,7 +1836,7 @@ ProgramStateRef StateCase; if (Optional NL = CondV.getAs()) std::tie(StateCase, DefaultSt) = - DefaultSt->assumeWithinInclusiveRange(*NL, V1, V2); + DefaultSt->assumeInclusiveRange(*NL, V1, V2); else // UnknownVal StateCase = DefaultSt; Index: cfe/trunk/lib/StaticAnalyzer/Core/SimpleConstraintManager.h === --- cfe/trunk/lib/StaticAnalyzer/Core/SimpleConstraintManager.h +++ cfe/trunk/lib/StaticAnalyzer/Core/SimpleConstraintManager.h @@ -38,7 +38,7 @@ ProgramStateRef assume(ProgramStateRef state, NonLoc Cond, bool Assumption); - ProgramStateRef assumeWithinInclusiveRange(ProgramStateRef State, + ProgramStateRef assumeInclusiveRange(ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, const llvm::APSInt &To, Index: cfe/trunk/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp === --- cfe/trunk/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp +++ cfe/trunk/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp @@ -190,7 +190,7 @@ } // end switch } -ProgramStateRef SimpleConstraintManager::assumeWithinInclusiveRange( +ProgramStateRef SimpleConstraintManager::assumeInclusiveRange( ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, const llvm::APSInt &To, bool InRange) { @@ -207,7 +207,7 @@ switch (Value.getSubKind()) { default: -llvm_unreachable("'assumeWithinInclusiveRange' is not implemented" +llvm_unreachable("'assumeInclusiveRange' is not implemented" "for this NonLoc"); case nonloc::LocAsIntegerKind: Index: cfe/trunk/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp === --- cfe/trunk/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp +++ cfe/trunk/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp @@ -254,7 +254,7 @@ const llvm::APSInt &Min = BVF.getValue(R[I].first, T); const llvm::APSInt &Max = BVF.getValue(R[I].second, T); assert(Min <= Max); - State = CM.assumeWithinInclusiveRange(State, *N, Min, Max, false); + State = CM.assumeInclusiveRange(State, *N, Min, Max, false); if (!State) break; } @@ -288,24 +288,24 @@ const llvm::APSInt &Left = BVF.getValue(R[0].first - 1ULL, T); if (Left != PlusInf) { assert(MinusInf <= Left); - State = CM.assumeWithinInclusiveRange(State, *N, MinusInf, Left, false); + State = CM.assumeInclusiveRange(State, *N, MinusInf, Left, false); if (!State) return nullptr; } const llvm::APSInt &Right = BVF.getValue(R[E - 1].second + 1ULL, T); if (Right != MinusInf) { assert(Right <= PlusInf); - State = CM.assumeWithinInclusiveRange(State, *N, Right, PlusInf, false); + State = CM.assumeInclusiveRange(State, *N, Right, PlusInf, false); if (!State) return nullptr; } for (size_t I = 1; I != E; ++I) { const llvm::APSInt &Min = BVF.getValue(R[I - 1].second + 1ULL, T); const llvm::APSInt &Max = BVF.getValue(R[I].first - 1ULL, T); assert(Min <= Max); - State = CM.assumeWithinInclusiveRange(State, *N, Min, Max, false); + State = CM.assumeInclusiveRange(State, *N, Min, Max, false); if (!State) return nullptr; } Index: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h === --- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h +++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h @@ -36,7 +36,7 @@ /// Construct a ConstraintVal indicating the constraint is underconstrained. ConditionTruthVal() {} -
[PATCH] D26644: [analyzer] Rename assumeWithinInclusiveRange*()
ddcc updated this revision to Diff 77930. ddcc added a comment. Fix formatting https://reviews.llvm.org/D26644 Files: include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp lib/StaticAnalyzer/Core/ExprEngine.cpp lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp lib/StaticAnalyzer/Core/SimpleConstraintManager.h Index: lib/StaticAnalyzer/Core/SimpleConstraintManager.h === --- lib/StaticAnalyzer/Core/SimpleConstraintManager.h +++ lib/StaticAnalyzer/Core/SimpleConstraintManager.h @@ -38,7 +38,7 @@ ProgramStateRef assume(ProgramStateRef state, NonLoc Cond, bool Assumption); - ProgramStateRef assumeWithinInclusiveRange(ProgramStateRef State, + ProgramStateRef assumeInclusiveRange(ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, const llvm::APSInt &To, Index: lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp === --- lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp +++ lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp @@ -190,7 +190,7 @@ } // end switch } -ProgramStateRef SimpleConstraintManager::assumeWithinInclusiveRange( +ProgramStateRef SimpleConstraintManager::assumeInclusiveRange( ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, const llvm::APSInt &To, bool InRange) { @@ -207,7 +207,7 @@ switch (Value.getSubKind()) { default: -llvm_unreachable("'assumeWithinInclusiveRange' is not implemented" +llvm_unreachable("'assumeInclusiveRange' is not implemented" "for this NonLoc"); case nonloc::LocAsIntegerKind: Index: lib/StaticAnalyzer/Core/ExprEngine.cpp === --- lib/StaticAnalyzer/Core/ExprEngine.cpp +++ lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -1836,7 +1836,7 @@ ProgramStateRef StateCase; if (Optional NL = CondV.getAs()) std::tie(StateCase, DefaultSt) = - DefaultSt->assumeWithinInclusiveRange(*NL, V1, V2); + DefaultSt->assumeInclusiveRange(*NL, V1, V2); else // UnknownVal StateCase = DefaultSt; Index: lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp === --- lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp +++ lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp @@ -254,7 +254,7 @@ const llvm::APSInt &Min = BVF.getValue(R[I].first, T); const llvm::APSInt &Max = BVF.getValue(R[I].second, T); assert(Min <= Max); - State = CM.assumeWithinInclusiveRange(State, *N, Min, Max, false); + State = CM.assumeInclusiveRange(State, *N, Min, Max, false); if (!State) break; } @@ -288,24 +288,24 @@ const llvm::APSInt &Left = BVF.getValue(R[0].first - 1ULL, T); if (Left != PlusInf) { assert(MinusInf <= Left); - State = CM.assumeWithinInclusiveRange(State, *N, MinusInf, Left, false); + State = CM.assumeInclusiveRange(State, *N, MinusInf, Left, false); if (!State) return nullptr; } const llvm::APSInt &Right = BVF.getValue(R[E - 1].second + 1ULL, T); if (Right != MinusInf) { assert(Right <= PlusInf); - State = CM.assumeWithinInclusiveRange(State, *N, Right, PlusInf, false); + State = CM.assumeInclusiveRange(State, *N, Right, PlusInf, false); if (!State) return nullptr; } for (size_t I = 1; I != E; ++I) { const llvm::APSInt &Min = BVF.getValue(R[I - 1].second + 1ULL, T); const llvm::APSInt &Max = BVF.getValue(R[I].first - 1ULL, T); assert(Min <= Max); - State = CM.assumeWithinInclusiveRange(State, *N, Min, Max, false); + State = CM.assumeInclusiveRange(State, *N, Min, Max, false); if (!State) return nullptr; } Index: include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h === --- include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h +++ include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h @@ -98,18 +98,18 @@ /// This ctor is used when creating the first ProgramState object. ProgramState(ProgramStateManager *mgr, const Environment& env, StoreRef st, GenericDataMap gdm); - + /// Copy ctor - We must explicitly define this or else the "Next" ptr /// in FoldingSetNode will also get copied. ProgramState(const ProgramState &RHS); - + ~ProgramState(); /// Return the ProgramStateManager associated with this state. ProgramStateManager &getStateManager() const { return *stateMgr; } - +
[PATCH] D26642: [analyzer] Minor optimization: avoid setting state if unchanged
This revision was automatically updated to reflect the committed changes. Closed by commit rL286925: [analyzer] Minor optimization: avoid setting state if unchanged (authored by ddcc). Changed prior to commit: https://reviews.llvm.org/D26642?vs=77897&id=77929#toc Repository: rL LLVM https://reviews.llvm.org/D26642 Files: cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp Index: cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp === --- cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp +++ cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp @@ -398,17 +398,19 @@ ProgramStateRef RangeConstraintManager::removeDeadBindings(ProgramStateRef state, SymbolReaper& SymReaper) { - + bool Changed = false; ConstraintRangeTy CR = state->get(); - ConstraintRangeTy::Factory& CRFactory = state->get_context(); + ConstraintRangeTy::Factory &CRFactory = state->get_context(); for (ConstraintRangeTy::iterator I = CR.begin(), E = CR.end(); I != E; ++I) { SymbolRef sym = I.getKey(); -if (SymReaper.maybeDead(sym)) +if (SymReaper.maybeDead(sym)) { + Changed = true; CR = CRFactory.remove(CR, sym); +} } - return state->set(CR); + return Changed ? state->set(CR) : state; } RangeSet Index: cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp === --- cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp +++ cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp @@ -398,17 +398,19 @@ ProgramStateRef RangeConstraintManager::removeDeadBindings(ProgramStateRef state, SymbolReaper& SymReaper) { - + bool Changed = false; ConstraintRangeTy CR = state->get(); - ConstraintRangeTy::Factory& CRFactory = state->get_context(); + ConstraintRangeTy::Factory &CRFactory = state->get_context(); for (ConstraintRangeTy::iterator I = CR.begin(), E = CR.end(); I != E; ++I) { SymbolRef sym = I.getKey(); -if (SymReaper.maybeDead(sym)) +if (SymReaper.maybeDead(sym)) { + Changed = true; CR = CRFactory.remove(CR, sym); +} } - return state->set(CR); + return Changed ? state->set(CR) : state; } RangeSet ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r286925 - [analyzer] Minor optimization: avoid setting state if unchanged
Author: ddcc Date: Mon Nov 14 19:40:58 2016 New Revision: 286925 URL: http://llvm.org/viewvc/llvm-project?rev=286925&view=rev Log: [analyzer] Minor optimization: avoid setting state if unchanged Summary: Split out optimization from D26061 Reviewers: zaks.anna, dcoughlin Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26642 Modified: cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp Modified: cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp?rev=286925&r1=286924&r2=286925&view=diff == --- cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp Mon Nov 14 19:40:58 2016 @@ -398,17 +398,19 @@ ConditionTruthVal RangeConstraintManager ProgramStateRef RangeConstraintManager::removeDeadBindings(ProgramStateRef state, SymbolReaper& SymReaper) { - + bool Changed = false; ConstraintRangeTy CR = state->get(); - ConstraintRangeTy::Factory& CRFactory = state->get_context(); + ConstraintRangeTy::Factory &CRFactory = state->get_context(); for (ConstraintRangeTy::iterator I = CR.begin(), E = CR.end(); I != E; ++I) { SymbolRef sym = I.getKey(); -if (SymReaper.maybeDead(sym)) +if (SymReaper.maybeDead(sym)) { + Changed = true; CR = CRFactory.remove(CR, sym); +} } - return state->set(CR); + return Changed ? state->set(CR) : state; } RangeSet ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
Eugene.Zelenko added a comment. I think this should be handled in higher level script (utils/release/test-release.sh or similar), not in CMake. CMake compiler tests just need to fail when LLVM_ENABLE_LLD is used without actually having them. Repository: rL LLVM https://reviews.llvm.org/D26649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
mehdi_amini added a comment. In https://reviews.llvm.org/D26649#595296, @phosek wrote: > It's sufficient, I just tested it. I'm not actually sure if `LLVM_ENABLE_LLD` > here is correct, `LLVM_ENABLE_LLD` forces the use of lld, but lld might not > be available during first stage. We need `LLVM_ENABLE_LLD` to be set, but > only for the second stage (which is something that can be done in the cache > file), in the first stage we should probably just check whether lld source is > available and we're building it, but I'm not sure what's the easiest/cleanest > way to do that? `-DBOOTSTRAP_ LLVM_ENABLE_LLD` is the right way to check for stage-2 options. If you look just a few lines above your check you'll see an example of check for `BOOTSTRAP_LLVM_ENABLE_LTO` Repository: rL LLVM https://reviews.llvm.org/D26649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
phosek added a comment. It's sufficient, I just tested it. I'm not actually sure if `LLVM_ENABLE_LLD` here is correct, `LLVM_ENABLE_LLD` forces the use of lld, but lld might not be available during first stage. We need `LLVM_ENABLE_LLD` to be set, but only for the second stage (which is something that can be done in the cache file), in the first stage we should probably just check whether lld source is available and we're building it, but I'm not sure what's the easiest/cleanest way to do that? Repository: rL LLVM https://reviews.llvm.org/D26649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26571: Clean up layout of ASTMerge tests
spyffe added a reviewer: beanz. spyffe updated this revision to Diff 77928. spyffe added a comment. Updated the locations so the structure is now a/test.c a/Inputs/a1.c a/Inputs/a2.c The naming of "test.c" is no longer a requirement but only a convention. Also `lit.site.cfg` is no longer required because we no longer do anything unusual from `lit`'s perspective. Repository: rL LLVM https://reviews.llvm.org/D26571 Files: Inputs/anonymous-fields1.cpp Inputs/anonymous-fields2.cpp Inputs/asm-function.cpp Inputs/body1.c Inputs/body2.c Inputs/category1.m Inputs/category2.m Inputs/class-template1.cpp Inputs/class-template2.cpp Inputs/class1.cpp Inputs/class2.cpp Inputs/class3.cpp Inputs/enum1.c Inputs/enum2.c Inputs/exprs1.c Inputs/exprs2.c Inputs/exprs3.cpp Inputs/function1.c Inputs/function2.c Inputs/inheritance-base.cpp Inputs/init-ctors-classes.cpp Inputs/interface1.m Inputs/interface2.m Inputs/macro.modulemap Inputs/macro1.h Inputs/macro1.m Inputs/macro2.m Inputs/namespace1.cpp Inputs/namespace2.cpp Inputs/property1.m Inputs/property2.m Inputs/struct1.c Inputs/struct2.c Inputs/typedef1.c Inputs/typedef2.c Inputs/var1.c Inputs/var1.h Inputs/var2.c anonymous-fields.cpp anonymous-fields/Inputs/anonymous-fields1.cpp anonymous-fields/Inputs/anonymous-fields2.cpp anonymous-fields/test.cpp asm.cpp asm/Inputs/asm-function.cpp asm/test.cpp category.m category/Inputs/category1.m category/Inputs/category2.m category/test.m class-template.cpp class-template/Inputs/class-template1.cpp class-template/Inputs/class-template2.cpp class-template/test.cpp class.cpp class/Inputs/class1.cpp class/Inputs/class2.cpp class/test.cpp class2.cpp class2/Inputs/class3.cpp class2/test.cpp codegen-body.c codegen-body/Inputs/body1.c codegen-body/Inputs/body2.c codegen-body/test.c codegen-exprs.c codegen-exprs/Inputs/exprs1.c codegen-exprs/Inputs/exprs2.c codegen-exprs/test.c enum.c enum/Inputs/enum1.c enum/Inputs/enum2.c enum/test.c exprs-cpp/Inputs/exprs3.cpp exprs-cpp/test.cpp exprs.c exprs.cpp exprs/Inputs/exprs1.c exprs/Inputs/exprs2.c exprs/test.c function.c function/Inputs/function1.c function/Inputs/function2.c function/test.c inheritance.cpp inheritance/Inputs/inheritance-base.cpp inheritance/test.cpp init-ctors.cpp init-ctors/Inputs/init-ctors-classes.cpp init-ctors/test.cpp interface.m interface/Inputs/interface1.m interface/Inputs/interface2.m interface/test.m macro.m macro/Inputs/macro.modulemap macro/Inputs/macro1.h macro/Inputs/macro1.m macro/Inputs/macro2.m macro/test.m namespace.cpp namespace/Inputs/namespace1.cpp namespace/Inputs/namespace2.cpp namespace/test.cpp property.m property/Inputs/property1.m property/Inputs/property2.m property/test.m struct.c struct/Inputs/struct1.c struct/Inputs/struct2.c struct/test.c typedef.c typedef/Inputs/typedef1.c typedef/Inputs/typedef2.c typedef/test.c var.c var/Inputs/var1.c var/Inputs/var1.h var/Inputs/var2.c var/test.c Index: var.c === --- var.c +++ var.c @@ -1,12 +0,0 @@ -// RUN: %clang_cc1 -emit-pch -o %t.1.ast %S/Inputs/var1.c -// RUN: %clang_cc1 -emit-pch -o %t.2.ast %S/Inputs/var2.c -// RUN: not %clang_cc1 -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only -fdiagnostics-show-note-include-stack %s 2>&1 | FileCheck %s - -// CHECK: var2.c:2:9: error: external variable 'x1' declared with incompatible types in different translation units ('double *' vs. 'float **') -// CHECK: var1.c:2:9: note: declared here with type 'float **' -// CHECK: var2.c:3:5: error: external variable 'x2' declared with incompatible types in different translation units ('int' vs. 'double') -// CHECK: In file included from{{.*}}var1.c:3: -// CHECK: var1.h:1:8: note: declared here with type 'double' -// CHECK: error: external variable 'xarray3' declared with incompatible types in different translation units ('int [17]' vs. 'int [18]') -// CHECK: var1.c:7:5: note: declared here with type 'int [18]' -// CHECK: 3 errors Index: typedef.c === --- typedef.c +++ typedef.c @@ -1,7 +0,0 @@ -// RUN: %clang_cc1 -emit-pch -o %t.1.ast %S/Inputs/typedef1.c -// RUN: %clang_cc1 -emit-pch -o %t.2.ast %S/Inputs/typedef2.c -// RUN: not %clang_cc1 -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only %s 2>&1 | FileCheck %s - -// CHECK: typedef2.c:4:10: error: external variable 'x2' declared with incompatible types in different translation units ('Typedef2' (aka 'double') vs. 'Typedef2' (aka 'int')) -// CHECK: typedef1.c:4:10: note: declared here with type 'Typedef2' (aka 'int') -// CHECK: 1 error Index: struct.c === --- struct.c +++ struct.c @@ -1,42 +0,0 @@ -// RUN: %clang_cc1 -emit-p
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
Eugene.Zelenko added a comment. In https://reviews.llvm.org/D26649#595213, @mehdi_amini wrote: > Make sense to me, but I don't think it is enough: LLVM_ENABLE_LLD should be > passed to stage-2, and it also should be set to the absolute path of the > stage-1 lld build. What is search directories order in Clang? It's reasonable it it tries to look into same directory first. In this case CMAKE_C_COMPILER/CMAKE_CXX_COMPILER should be enough for later stages. Repository: rL LLVM https://reviews.llvm.org/D26649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D22997: [cxx1z-constexpr-lambda] Make conversion function constexpr, and teach the expression-evaluator to evaluate the static-invoker.
faisalv updated this revision to Diff 77926. faisalv marked an inline comment as done. faisalv added a comment. Simplify the check for zero captures in a lambda expression (within the assert) by comparing the begin and end pointers directly (as opposed to using distance) - thanks to Akira! https://reviews.llvm.org/D22997 Files: lib/AST/ExprConstant.cpp lib/Sema/SemaLambda.cpp test/SemaCXX/cxx1z-constexpr-lambdas.cpp Index: test/SemaCXX/cxx1z-constexpr-lambdas.cpp === --- test/SemaCXX/cxx1z-constexpr-lambdas.cpp +++ test/SemaCXX/cxx1z-constexpr-lambdas.cpp @@ -59,4 +59,30 @@ } } + +namespace test_conversion_function_for_non_capturing_lambdas { + +namespace ns1 { +auto L = [](int i) { return i; }; +constexpr int (*fpi)(int) = L; +static_assert(fpi(3) == 3); +auto GL = [](auto a) { return a; }; + +constexpr char (*fp2)(char) = GL; +constexpr double (*fp3)(double) = GL; +constexpr const char* (*fp4)(const char*) = GL; +static_assert(fp2('3') == '3'); +static_assert(fp3(3.14) == 3.14); +constexpr const char *Str = "abc"; +static_assert(fp4(Str) == Str); + +auto NCL = [](int i) { static int j; return j; }; //expected-note{{declared here}} +constexpr int (*fp5)(int) = NCL; +constexpr int I = //expected-error{{must be initialized by a constant expression}} + fp5(5); //expected-note{{non-constexpr function}} + +} // end ns1 + +} // end ns test_conversion_function_for_non_capturing_lambdas + #endif // ndef CPP14_AND_EARLIER Index: lib/Sema/SemaLambda.cpp === --- lib/Sema/SemaLambda.cpp +++ lib/Sema/SemaLambda.cpp @@ -1273,7 +1273,7 @@ ConvTy, ConvTSI, /*isInline=*/true, /*isExplicit=*/false, -/*isConstexpr=*/false, +/*isConstexpr=*/S.getLangOpts().CPlusPlus1z, CallOperator->getBody()->getLocEnd()); Conversion->setAccess(AS_public); Conversion->setImplicit(true); Index: lib/AST/ExprConstant.cpp === --- lib/AST/ExprConstant.cpp +++ lib/AST/ExprConstant.cpp @@ -4399,6 +4399,10 @@ Call.getLValueBase().dyn_cast()); if (!FD) return Error(Callee); + + // Don't call function pointers which have been cast to some other type. + if (!Info.Ctx.hasSameType(CalleeType->getPointeeType(), FD->getType())) +return Error(E); // Overloaded operator calls to member functions are represented as normal // calls with '*this' as the first argument. @@ -4414,11 +4418,41 @@ return false; This = &ThisVal; Args = Args.slice(1); + } else if (MD && MD->isLambdaStaticInvoker()) { +// Map the static invoker for the lambda back to the call operator. +// Conveniently, we don't have to slice out the 'this' argument (as is +// being done for the non-static case), since a static member function +// doesn't have an implicit argument passed in. +const CXXRecordDecl *ClosureClass = MD->getParent(); +assert( +ClosureClass->captures_begin() == ClosureClass->captures_end() && +"Number of captures must be zero for conversion to function-ptr"); + +const CXXMethodDecl *LambdaCallOp = +ClosureClass->getLambdaCallOperator(); + +// Set 'FD', the function that will be called below, to the call +// operator. If the closure object represents a generic lambda, find +// the corresponding specialization of the call operator. + +if (ClosureClass->isGenericLambda()) { + assert(MD->isFunctionTemplateSpecialization() && + "A generic lambda's static-invoker function must be a " + "template specialization"); + const TemplateArgumentList *TAL = MD->getTemplateSpecializationArgs(); + FunctionTemplateDecl *CallOpTemplate = + LambdaCallOp->getDescribedFunctionTemplate(); + void *InsertPos = nullptr; + FunctionDecl *CorrespondingCallOpSpecialization = + CallOpTemplate->findSpecialization(TAL->asArray(), InsertPos); + assert(CorrespondingCallOpSpecialization && + "We must always have a function call operator specialization " + "that corresponds to our static invoker specialization"); + FD = cast(CorrespondingCallOpSpecialization); +} else + FD = LambdaCallOp; } - - // Don't call function pointers which have been cast to some other type. - if (!Info.Ctx.hasSameType(CalleeType->getPointeeType(), FD->getType())) -return Error(E); + } else return Error(E); ___ cfe-c
[PATCH] D26435: Use unique_ptr for cached tokens for default arguments in C++.
dtarditi added a comment. I sync'ed to the head of the tree. I tried to reproduce the failures that you saw and couldn't.I'm building on Windows 10 x64 using Visual Studio. What platform/OS did you build on? I built and test both Debug and RelWithDebugInfo. Here's what I saw for RelWithDebugInfo Running the Clang regression tests -- Testing: 10026 tests, 24 threads -- Testing Time: 604.17s Expected Passes: 9922 Expected Failures : 21 Unsupported Tests : 83 https://reviews.llvm.org/D26435 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26654: [CMake] Add Fuchsia toolchain CMake cache files
phosek created this revision. phosek added a reviewer: beanz. phosek added a subscriber: cfe-commits. phosek set the repository for this revision to rL LLVM. Herald added a subscriber: mgorny. These cache files can be used to build Fuchsia Clang toolchain. They also demonstrate the use of multi-target builtins build. Repository: rL LLVM https://reviews.llvm.org/D26654 Files: cmake/caches/Fuchsia-stage2.cmake cmake/caches/Fuchsia.cmake Index: cmake/caches/Fuchsia.cmake === --- /dev/null +++ cmake/caches/Fuchsia.cmake @@ -0,0 +1,33 @@ +# This file sets up a CMakeCache for a Fuchsia toolchain build. + +set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "") + +set(CMAKE_BUILD_TYPE Release CACHE STRING "") + +set(PACKAGE_VENDOR Fuchsia CACHE STRING "") + +set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "") + +set(CLANG_BOOTSTRAP_TARGETS + check-all + check-llvm + check-clang + llvm-config + test-suite + test-depends + llvm-test-depends + clang-test-depends + distribution + install-distribution + clang CACHE STRING "") + +if(FUCHSIA_SYSROOT) + set(EXTRA_ARGS -DFUCHSIA_SYSROOT=${FUCHSIA_SYSROOT}) +endif() + +# Setup the bootstrap build. +set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "") +set(CLANG_BOOTSTRAP_CMAKE_ARGS + ${EXTRA_ARGS} + -C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake + CACHE STRING "") Index: cmake/caches/Fuchsia-stage2.cmake === --- /dev/null +++ cmake/caches/Fuchsia-stage2.cmake @@ -0,0 +1,46 @@ +# This file sets up a CMakeCache for the second stage of a Fuchsia toolchain +# build. + +set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "") + +set(LLVM_ENABLE_LTO ON CACHE BOOL "") +if(NOT APPLE) + set(LLVM_ENABLE_LLD ON CACHE BOOL "") +endif() + +set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "") +set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE STRING "") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE STRING "") + +set(LLVM_BUILTIN_TARGETS "x86_64-fuchsia;aarch64-fuchsia" CACHE STRING "") +set(BUILTINS_x86_64-fuchsia_CMAKE_SYSROOT ${FUCHSIA_SYSROOT} CACHE STRING "") +set(BUILTINS_x86_64-fuchsia_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "") +set(BUILTINS_aarch64-fuchsia_CMAKE_SYSROOT ${FUCHSIA_SYSROOT} CACHE STRING "") +set(BUILTINS_aarch64-fuchsia_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "") + +# Setup toolchain. +set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "") +set(LLVM_TOOLCHAIN_TOOLS + llvm-ar + llvm-cov + llvm-cxxfilt + llvm-dwarfdump + llvm-dsymutil + llvm-lib + llvm-nm + llvm-objdump + llvm-profdata + llvm-ranlib + llvm-readobj + llvm-size + llvm-symbolizer + CACHE STRING "") + +set(LLVM_DISTRIBUTION_COMPONENTS + clang + LTO + clang-format + clang-headers + runtimes + ${LLVM_TOOLCHAIN_TOOLS} + CACHE STRING "") Index: cmake/caches/Fuchsia.cmake === --- /dev/null +++ cmake/caches/Fuchsia.cmake @@ -0,0 +1,33 @@ +# This file sets up a CMakeCache for a Fuchsia toolchain build. + +set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "") + +set(CMAKE_BUILD_TYPE Release CACHE STRING "") + +set(PACKAGE_VENDOR Fuchsia CACHE STRING "") + +set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "") + +set(CLANG_BOOTSTRAP_TARGETS + check-all + check-llvm + check-clang + llvm-config + test-suite + test-depends + llvm-test-depends + clang-test-depends + distribution + install-distribution + clang CACHE STRING "") + +if(FUCHSIA_SYSROOT) + set(EXTRA_ARGS -DFUCHSIA_SYSROOT=${FUCHSIA_SYSROOT}) +endif() + +# Setup the bootstrap build. +set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "") +set(CLANG_BOOTSTRAP_CMAKE_ARGS + ${EXTRA_ARGS} + -C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake + CACHE STRING "") Index: cmake/caches/Fuchsia-stage2.cmake === --- /dev/null +++ cmake/caches/Fuchsia-stage2.cmake @@ -0,0 +1,46 @@ +# This file sets up a CMakeCache for the second stage of a Fuchsia toolchain +# build. + +set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "") + +set(LLVM_ENABLE_LTO ON CACHE BOOL "") +if(NOT APPLE) + set(LLVM_ENABLE_LLD ON CACHE BOOL "") +endif() + +set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "") +set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE STRING "") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE STRING "") + +set(LLVM_BUILTIN_TARGETS "x86_64-fuchsia;aarch64-fuchsia" CACHE STRING "") +set(BUILTINS_x86_64-fuchsia_CMAKE_SYSROOT ${FUCHSIA_SYSROOT} CACHE STRING "") +set(BUILTINS_x86_64-fuchsia_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "") +set(BUILTINS_aarch64-fuchsia_CMAKE_SYSROOT ${FUCHSIA_SYSROOT} CACHE STRING "") +set(BUILTINS_aarch64-fuchsia_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "") + +# Setup toolchain. +set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "") +set(LLVM_TOOLCHAIN_TOOLS + llvm-ar
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
mehdi_amini added inline comments. Comment at: CMakeLists.txt:516 if(BOOTSTRAP_LLVM_ENABLE_LTO OR LLVM_ENABLE_LTO AND NOT LLVM_BUILD_INSTRUMENTED) add_dependencies(clang-bootstrap-deps LTO) if(APPLE) This dep does not make sense when using either lld or gold by the way. Repository: rL LLVM https://reviews.llvm.org/D26649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
mehdi_amini added a comment. Make sense to me, but I don't think it is enough: LLVM_ENABLE_LLD should be passed to stage-2, and it also should be set to the absolute path of the stage-1 lld build. Repository: rL LLVM https://reviews.llvm.org/D26649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26649: [CMake] Support lld with LTO bootstrap
phosek created this revision. phosek added a reviewer: beanz. phosek added subscribers: cfe-commits, ruiu. phosek set the repository for this revision to rL LLVM. Herald added subscribers: mehdi_amini, mgorny. lld has LTO support, if requested we should add a dependency on lld rather than LLVMgold when doing LTO bootstrap build. Repository: rL LLVM https://reviews.llvm.org/D26649 Files: CMakeLists.txt Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -511,7 +511,7 @@ set(STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-stamps/) set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-bins/) - # If the next stage is LTO we need to depend on LTO and possibly LLVMgold + # If the next stage is LTO we need to depend on LTO and possibly lld or LLVMgold if(BOOTSTRAP_LLVM_ENABLE_LTO OR LLVM_ENABLE_LTO AND NOT LLVM_BUILD_INSTRUMENTED) add_dependencies(clang-bootstrap-deps LTO) if(APPLE) @@ -526,7 +526,12 @@ set(LTO_LIBRARY -DDARWIN_LTO_LIBRARY=${LLVM_SHLIB_OUTPUT_INTDIR}/libLTO.dylib -DDYLD_LIBRARY_PATH=${LLVM_LIBRARY_OUTPUT_INTDIR}) elseif(NOT WIN32) - add_dependencies(clang-bootstrap-deps LLVMgold llvm-ar llvm-ranlib) + add_dependencies(clang-bootstrap-deps llvm-ar llvm-ranlib) + if(LLVM_ENABLE_LLD) +add_dependencies(lld) + elseif(LLVM_BINUTILS_INCDIR) +add_dependencies(LLVMgold) + endif() set(LTO_AR -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar) set(LTO_RANLIB -DCMAKE_RANLIB=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib) endif() Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -511,7 +511,7 @@ set(STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-stamps/) set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-bins/) - # If the next stage is LTO we need to depend on LTO and possibly LLVMgold + # If the next stage is LTO we need to depend on LTO and possibly lld or LLVMgold if(BOOTSTRAP_LLVM_ENABLE_LTO OR LLVM_ENABLE_LTO AND NOT LLVM_BUILD_INSTRUMENTED) add_dependencies(clang-bootstrap-deps LTO) if(APPLE) @@ -526,7 +526,12 @@ set(LTO_LIBRARY -DDARWIN_LTO_LIBRARY=${LLVM_SHLIB_OUTPUT_INTDIR}/libLTO.dylib -DDYLD_LIBRARY_PATH=${LLVM_LIBRARY_OUTPUT_INTDIR}) elseif(NOT WIN32) - add_dependencies(clang-bootstrap-deps LLVMgold llvm-ar llvm-ranlib) + add_dependencies(clang-bootstrap-deps llvm-ar llvm-ranlib) + if(LLVM_ENABLE_LLD) +add_dependencies(lld) + elseif(LLVM_BINUTILS_INCDIR) +add_dependencies(LLVMgold) + endif() set(LTO_AR -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar) set(LTO_RANLIB -DCMAKE_RANLIB=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib) endif() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25916: Modules: emit an error instead of a random crash (or a misleading error) due to use-after-free.
manmanren added a comment. In https://reviews.llvm.org/D25916#594844, @benlangmuir wrote: > > Does it mean that a system module should only import system modules? If a > > system module is allowed to import non-system modules, for a non-system > > module, we will validate diagnostic options differently depending on > > whether a system module or a non-system module imports it. This will cause > > a non-system module that was validated earlier to be invalidated by a child > > thread. > > It seems like we should validate the options the same way regardless of what > the importer is, but I'm guessing this was done for a reason... What's the > behaviour of a user-header imported by a system header (without modules)? If > the user header warnings show up even without -Wsystem-headers, then we > should be okay validating, right? I tried a simple example: cat test.mm #include "a.h" cat Inputs/System/a.h #include "b.h" cat Inputs/b.h void double_declarator1(int *_Nonnull *); // expected-warning{{pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)}} clang -cc1 -fsyntax-only -fblocks -I Inputs/ -isystem Inputs/System/ test.mm --> has no warning ~/llvm_gmail/debug/bin/clang -cc1 -fsyntax-only -fblocks -I Inputs/ -isystem Inputs/System/ test.mm -Wsystem-headers --> has one warning Without modules, the user header warnings do not show up if it is included by a system header (without -Wsystem-headers). To exactly match this behavior, user modules need to be validated considering the importing context. We will need to change the code snippets I mentioned earlier to re-validate the options when the importing context changes. Thanks, Manman https://reviews.llvm.org/D25916 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26642: [analyzer] Minor optimization: avoid setting state if unchanged
dcoughlin accepted this revision. dcoughlin added a comment. This revision is now accepted and ready to land. LGTM. Please commit! https://reviews.llvm.org/D26642 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26644: [analyzer] Rename assumeWithinInclusiveRange*()
dcoughlin accepted this revision. dcoughlin added a comment. This revision is now accepted and ready to land. LGTM, other then some indentation issues for arguments and parameters after the rename. Please fix those and commit! And thanks for splitting this up. Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h:103 + virtual ProgramStateRef assumeInclusiveRange(ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, Nit: The indentation here (and elsewhere) is off after the rename. https://reviews.llvm.org/D26644 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26644: [analyzer] Rename assumeWithinInclusiveRange*()
ddcc created this revision. ddcc added reviewers: zaks.anna, dcoughlin. ddcc added a subscriber: cfe-commits. The name is slightly confusing, since the constraint is not necessarily within the range unless `Assumption` is true. Split out renaming for ConstraintManager.h from https://reviews.llvm.org/D26061 https://reviews.llvm.org/D26644 Files: include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp lib/StaticAnalyzer/Core/ExprEngine.cpp lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp lib/StaticAnalyzer/Core/SimpleConstraintManager.h Index: lib/StaticAnalyzer/Core/SimpleConstraintManager.h === --- lib/StaticAnalyzer/Core/SimpleConstraintManager.h +++ lib/StaticAnalyzer/Core/SimpleConstraintManager.h @@ -38,7 +38,7 @@ ProgramStateRef assume(ProgramStateRef state, NonLoc Cond, bool Assumption); - ProgramStateRef assumeWithinInclusiveRange(ProgramStateRef State, + ProgramStateRef assumeInclusiveRange(ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, const llvm::APSInt &To, Index: lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp === --- lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp +++ lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp @@ -190,7 +190,7 @@ } // end switch } -ProgramStateRef SimpleConstraintManager::assumeWithinInclusiveRange( +ProgramStateRef SimpleConstraintManager::assumeInclusiveRange( ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, const llvm::APSInt &To, bool InRange) { @@ -207,7 +207,7 @@ switch (Value.getSubKind()) { default: -llvm_unreachable("'assumeWithinInclusiveRange' is not implemented" +llvm_unreachable("'assumeInclusiveRange' is not implemented" "for this NonLoc"); case nonloc::LocAsIntegerKind: Index: lib/StaticAnalyzer/Core/ExprEngine.cpp === --- lib/StaticAnalyzer/Core/ExprEngine.cpp +++ lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -1836,7 +1836,7 @@ ProgramStateRef StateCase; if (Optional NL = CondV.getAs()) std::tie(StateCase, DefaultSt) = - DefaultSt->assumeWithinInclusiveRange(*NL, V1, V2); + DefaultSt->assumeInclusiveRange(*NL, V1, V2); else // UnknownVal StateCase = DefaultSt; Index: lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp === --- lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp +++ lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp @@ -254,7 +254,7 @@ const llvm::APSInt &Min = BVF.getValue(R[I].first, T); const llvm::APSInt &Max = BVF.getValue(R[I].second, T); assert(Min <= Max); - State = CM.assumeWithinInclusiveRange(State, *N, Min, Max, false); + State = CM.assumeInclusiveRange(State, *N, Min, Max, false); if (!State) break; } @@ -288,24 +288,24 @@ const llvm::APSInt &Left = BVF.getValue(R[0].first - 1ULL, T); if (Left != PlusInf) { assert(MinusInf <= Left); - State = CM.assumeWithinInclusiveRange(State, *N, MinusInf, Left, false); + State = CM.assumeInclusiveRange(State, *N, MinusInf, Left, false); if (!State) return nullptr; } const llvm::APSInt &Right = BVF.getValue(R[E - 1].second + 1ULL, T); if (Right != MinusInf) { assert(Right <= PlusInf); - State = CM.assumeWithinInclusiveRange(State, *N, Right, PlusInf, false); + State = CM.assumeInclusiveRange(State, *N, Right, PlusInf, false); if (!State) return nullptr; } for (size_t I = 1; I != E; ++I) { const llvm::APSInt &Min = BVF.getValue(R[I - 1].second + 1ULL, T); const llvm::APSInt &Max = BVF.getValue(R[I].first - 1ULL, T); assert(Min <= Max); - State = CM.assumeWithinInclusiveRange(State, *N, Min, Max, false); + State = CM.assumeInclusiveRange(State, *N, Min, Max, false); if (!State) return nullptr; } Index: include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h === --- include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h +++ include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h @@ -98,18 +98,18 @@ /// This ctor is used when creating the first ProgramState object. ProgramState(ProgramStateManager *mgr, const Environment& env, StoreRef st, GenericDataMap gdm); - + /// Copy ctor - We must explicitly define this or else the "Next" ptr /// in FoldingSetNode will also
[PATCH] D26642: [analyzer] Minor optimizaiton: avoid setting state if unchanged
ddcc created this revision. ddcc added reviewers: zaks.anna, dcoughlin. ddcc added a subscriber: cfe-commits. Split out optimization from https://reviews.llvm.org/D26061 https://reviews.llvm.org/D26642 Files: lib/StaticAnalyzer/Core/RangeConstraintManager.cpp Index: lib/StaticAnalyzer/Core/RangeConstraintManager.cpp === --- lib/StaticAnalyzer/Core/RangeConstraintManager.cpp +++ lib/StaticAnalyzer/Core/RangeConstraintManager.cpp @@ -398,17 +398,19 @@ ProgramStateRef RangeConstraintManager::removeDeadBindings(ProgramStateRef state, SymbolReaper& SymReaper) { - + bool Changed = false; ConstraintRangeTy CR = state->get(); - ConstraintRangeTy::Factory& CRFactory = state->get_context(); + ConstraintRangeTy::Factory &CRFactory = state->get_context(); for (ConstraintRangeTy::iterator I = CR.begin(), E = CR.end(); I != E; ++I) { SymbolRef sym = I.getKey(); -if (SymReaper.maybeDead(sym)) +if (SymReaper.maybeDead(sym)) { + Changed = true; CR = CRFactory.remove(CR, sym); +} } - return state->set(CR); + return Changed ? state->set(CR) : state; } RangeSet Index: lib/StaticAnalyzer/Core/RangeConstraintManager.cpp === --- lib/StaticAnalyzer/Core/RangeConstraintManager.cpp +++ lib/StaticAnalyzer/Core/RangeConstraintManager.cpp @@ -398,17 +398,19 @@ ProgramStateRef RangeConstraintManager::removeDeadBindings(ProgramStateRef state, SymbolReaper& SymReaper) { - + bool Changed = false; ConstraintRangeTy CR = state->get(); - ConstraintRangeTy::Factory& CRFactory = state->get_context(); + ConstraintRangeTy::Factory &CRFactory = state->get_context(); for (ConstraintRangeTy::iterator I = CR.begin(), E = CR.end(); I != E; ++I) { SymbolRef sym = I.getKey(); -if (SymReaper.maybeDead(sym)) +if (SymReaper.maybeDead(sym)) { + Changed = true; CR = CRFactory.remove(CR, sym); +} } - return state->set(CR); + return Changed ? state->set(CR) : state; } RangeSet ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26115: [test] Correctly include build llvm_shlib_dir in stand-alone builds
beanz accepted this revision. beanz added a comment. This revision is now accepted and ready to land. LGTM! Comment at: test/lit.cfg:109 +if not llvm_shlib_dir: +lit_config.fatal('No LLVM shlib dir set!') llvm_libs_dir = getattr(config, 'llvm_libs_dir', None) mgorny wrote: > beanz wrote: > > Should this really be fatal? It seems to me in many cases you might not > > need this to be set. > I don't mind either way. I left it like this since I really don't see a case > when it could be unset ;-). Ah! You're right. I didn't see where it was getting set. https://reviews.llvm.org/D26115 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r286901 - [analyzer] Fix crash in NullabilityChecker calling block with too few arguments
Author: dcoughlin Date: Mon Nov 14 16:46:02 2016 New Revision: 286901 URL: http://llvm.org/viewvc/llvm-project?rev=286901&view=rev Log: [analyzer] Fix crash in NullabilityChecker calling block with too few arguments Fix a crash when checking parameter nullability on a block invocation with fewer arguments than the block declaration requires. rdar://problem/29237566 Added: cfe/trunk/test/Analysis/nullability.c Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp?rev=286901&r1=286900&r2=286901&view=diff == --- cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp Mon Nov 14 16:46:02 2016 @@ -679,9 +679,10 @@ void NullabilityChecker::checkPreCall(co if (Param->isParameterPack()) break; -const Expr *ArgExpr = nullptr; -if (Idx < Call.getNumArgs()) - ArgExpr = Call.getArgExpr(Idx); +if (Idx >= Call.getNumArgs()) + break; + +const Expr *ArgExpr = Call.getArgExpr(Idx); auto ArgSVal = Call.getArgSVal(Idx++).getAs(); if (!ArgSVal) continue; Added: cfe/trunk/test/Analysis/nullability.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/nullability.c?rev=286901&view=auto == --- cfe/trunk/test/Analysis/nullability.c (added) +++ cfe/trunk/test/Analysis/nullability.c Mon Nov 14 16:46:02 2016 @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -fblocks -analyze -analyzer-checker=core,nullability -verify %s + +void it_takes_two(int a, int b); +void function_pointer_arity_mismatch() { + void(*fptr)() = it_takes_two; + fptr(1); // no-crash expected-warning {{Function taking 2 arguments is called with less (1)}} +} + +void block_arity_mismatch() { + void(^b)() = ^(int a, int b) { }; // no-crash + b(1); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r286898 - [sanitizer] Passthrough CMAKE_OSX_DEPLOYMENT_TARGET when building compiler-rt from clang/runtime/CMakeLists.txt
Author: kuba.brecka Date: Mon Nov 14 16:38:57 2016 New Revision: 286898 URL: http://llvm.org/viewvc/llvm-project?rev=286898&view=rev Log: [sanitizer] Passthrough CMAKE_OSX_DEPLOYMENT_TARGET when building compiler-rt from clang/runtime/CMakeLists.txt This breaks some Swift builds, because Swift's build scripts explicitly set CMAKE_OSX_DEPLOYMENT_TARGET. This however isn't propagated to the compiler-rt build, causing build errors. Differential Revision: https://reviews.llvm.org/D26558 Modified: cfe/trunk/runtime/CMakeLists.txt Modified: cfe/trunk/runtime/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/runtime/CMakeLists.txt?rev=286898&r1=286897&r2=286898&view=diff == --- cfe/trunk/runtime/CMakeLists.txt (original) +++ cfe/trunk/runtime/CMakeLists.txt Mon Nov 14 16:38:57 2016 @@ -77,6 +77,7 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND E -DCOMPILER_RT_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} ${COMPILER_RT_PASSTHROUGH_VARIABLES} INSTALL_COMMAND "" STEP_TARGETS configure build ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r286748 - Fix PR28366: Handle variables from enclosing local scopes more gracefully during constant expression evaluation.
Reverting this commit doesn't solve anything, sorry for the noise. It seems to hit an infinite loop: frame #17: 0x0001083d48ab clang`::Visit() [inlined] HandleConditionalOperator + 165 at ExprConstant.cpp:4212 frame #18: 0x0001083d4806 clang`::Visit() [inlined] VisitConditionalOperator at ExprConstant.cpp:4331 frame #19: 0x0001083d4806 clang`::Visit() + 33158 at StmtNodes.inc:129 frame #20: 0x00010835c43c clang`::Evaluate() + 1468 at ExprConstant.cpp:9155 frame #21: 0x0001083bad54 clang`::EvaluateStmt() + 15572 at ExprConstant.cpp:3663 frame #22: 0x0001083b9147 clang`::EvaluateStmt() + 8391 at ExprConstant.cpp:3673 frame #23: 0x000108360829 clang`::HandleFunctionCall() + 1657 at ExprConstant.cpp:3994 frame #24: 0x00010842f681 clang`::handleCallExpr() + 3697 at ExprConstant.cpp:4438 frame #25: 0x0001083ea4c5 clang`::VisitCallExpr() [inlined] VisitCallExpr + 54 at ExprConstant.cpp:4355 frame #26: 0x0001083ea48f clang`::VisitCallExpr() + 11407 at ExprConstant.cpp:6937 frame #27: 0x0001083ccdcd clang`::Visit() + 1869 at Expr.h:1705 frame #28: 0x00010835c43c clang`::Evaluate() + 1468 at ExprConstant.cpp:9155 frame #29: 0x0001083cf094 clang`::Visit() [inlined] VisitBinaryConditionalOperator + 145 at ExprConstant.cpp:4307 frame #30: 0x0001083cf003 clang`::Visit() + 10627 at StmtNodes.inc:123 frame #31: 0x0001083d1b7f clang`::Visit() + 21759 at ExprCXX.h:2998 frame #32: 0x0001083d48ab clang`::Visit() [inlined] HandleConditionalOperator + 165 at ExprConstant.cpp:4212 sudo ulimit -s 65000 && lldb /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang-build/./bin/clang -- -cc1 -internal-isystem /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang-build/bin/../lib/clang/4.0.0/include -nostdsysteminc -triple i686-linux -Wno-string-plus-int -Wno-pointer-arith -Wno-zero-length-array -fsyntax-only -fcxx-exceptions -verify -std=c++11 -pedantic /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang/src/tools/clang/test/SemaCXX/constant-expression-cxx11.cpp -Wno-comment -Wno-tautological-pointer-compare -Wno-bool-conversion vedant > On Nov 14, 2016, at 1:56 PM, Vedant Kumar wrote: > > Hi Faisal, > > Our ASan bot started complaining after this commit. > > I'm not 100% sure this caused it yet, though I'm running tests. > > Could you take a look? > > thanks, > vedant > > > FAIL: Clang :: SemaCXX/constant-expression-cxx11.cpp (9393 of 29261) > > TEST 'Clang :: SemaCXX/constant-expression-cxx11.cpp' > FAILED > > Script: > -- > ulimit -s 1 && > /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang-build/./bin/clang > -cc1 -internal-isystem > /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang-build/bin/../lib/clang/4.0.0/include > -nostdsysteminc -triple i686-linux -Wno-string-plus-int -Wno-pointer-arith > -Wno-zero-length-array -fsyntax-only -fcxx-exceptions -verify -std=c++11 > -pedantic > /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang/src/tools/clang/test/SemaCXX/constant-expression-cxx11.cpp > -Wno-comment -Wno-tautological-pointer-compare -Wno-bool-conversion > -- > Exit Code: 134 > > Command Output (stderr): > -- > ASAN:DEADLYSIGNAL > = > ==86262==ERROR: AddressSanitizer: stack-overflow on address 0x7fff50fda580 > (pc 0x0001165bcf2d bp 0x7fff50fdb1f0 sp 0x7fff50fda580 T0) >#0 0x1165bcf2c in Evaluate(clang::APValue&, (anonymous > namespace)::EvalInfo&, clang::Expr const*) ExprConstant.cpp:9142 > > SUMMARY: AddressSanitizer: stack-overflow ExprConstant.cpp:9142 in > Evaluate(clang::APValue&, (anonymous namespace)::EvalInfo&, clang::Expr > const*) > ==86262==ABORTING > Stack dump: > 0.Program arguments: > /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang-build/./bin/clang > -cc1 -internal-isystem > /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang-build/bin/../lib/clang/4.0.0/include > -nostdsysteminc -triple i686-linux -Wno-string-plus-int -Wno-pointer-arith > -Wno-zero-length-array -fsyntax-only -fcxx-exceptions -verify -std=c++11 > -pedantic > /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang/src/tools/clang/test/SemaCXX/constant-expression-cxx11.cpp > -Wno-comment -Wno-tautological-pointer-compare -Wno-bool-conversion > 1. > /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang/src/tools/clang/test/SemaCXX/constant-expression-cxx11.cpp:1457:1: > current parser token '}' > 2. > /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang/src/tools/clang/test/SemaCXX/constant-expression-cxx11.cpp:1435:1: > parsing namespace 'RecursiveOpaqueEx
[PATCH] D26559: Insert a type check before reading vtable.
pcc added inline comments. Comment at: lib/CodeGen/CGExprCXX.cpp:93 + + EmitTypeCheck(CodeGenFunction::TCK_MemberCall, +CallLoc, This, C.getRecordType(DD->getParent())); krasin wrote: > pcc wrote: > > pcc wrote: > > > Is it correct to emit a type check at this point? Looking at [0] it looks > > > like this function is only called from the Microsoft C++ ABI after we > > > have already resolved the virtual function pointer. > > > > > > [0] > > > http://llvm-cs.pcc.me.uk/tools/clang/lib/CodeGen/CGExprCXX.cpp/rEmitCXXDestructorCall > > What about this comment? > Sorry, I have missed the comment. I have added this check here to preserve > the existing behavior. > > From what you describe, there could be a very similar issue related to the > Microsoft C++ ABI to the one that I fix here. I am okay to file a bug or add > a note about this, your choice. Have you looked at how hard it would be to fix this? https://reviews.llvm.org/D26559 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26559: Insert a type check before reading vtable.
krasin added inline comments. Comment at: lib/CodeGen/CGExprCXX.cpp:93 + + EmitTypeCheck(CodeGenFunction::TCK_MemberCall, +CallLoc, This, C.getRecordType(DD->getParent())); pcc wrote: > pcc wrote: > > Is it correct to emit a type check at this point? Looking at [0] it looks > > like this function is only called from the Microsoft C++ ABI after we have > > already resolved the virtual function pointer. > > > > [0] > > http://llvm-cs.pcc.me.uk/tools/clang/lib/CodeGen/CGExprCXX.cpp/rEmitCXXDestructorCall > What about this comment? Sorry, I have missed the comment. I have added this check here to preserve the existing behavior. From what you describe, there could be a very similar issue related to the Microsoft C++ ABI to the one that I fix here. I am okay to file a bug or add a note about this, your choice. https://reviews.llvm.org/D26559 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26115: [test] Correctly include build llvm_shlib_dir in stand-alone builds
mgorny added inline comments. Comment at: test/lit.cfg:109 +if not llvm_shlib_dir: +lit_config.fatal('No LLVM shlib dir set!') llvm_libs_dir = getattr(config, 'llvm_libs_dir', None) beanz wrote: > Should this really be fatal? It seems to me in many cases you might not need > this to be set. I don't mind either way. I left it like this since I really don't see a case when it could be unset ;-). https://reviews.llvm.org/D26115 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r286748 - Fix PR28366: Handle variables from enclosing local scopes more gracefully during constant expression evaluation.
Hi Faisal, Our ASan bot started complaining after this commit. I'm not 100% sure this caused it yet, though I'm running tests. Could you take a look? thanks, vedant FAIL: Clang :: SemaCXX/constant-expression-cxx11.cpp (9393 of 29261) TEST 'Clang :: SemaCXX/constant-expression-cxx11.cpp' FAILED Script: -- ulimit -s 1 && /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang-build/./bin/clang -cc1 -internal-isystem /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang-build/bin/../lib/clang/4.0.0/include -nostdsysteminc -triple i686-linux -Wno-string-plus-int -Wno-pointer-arith -Wno-zero-length-array -fsyntax-only -fcxx-exceptions -verify -std=c++11 -pedantic /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang/src/tools/clang/test/SemaCXX/constant-expression-cxx11.cpp -Wno-comment -Wno-tautological-pointer-compare -Wno-bool-conversion -- Exit Code: 134 Command Output (stderr): -- ASAN:DEADLYSIGNAL = ==86262==ERROR: AddressSanitizer: stack-overflow on address 0x7fff50fda580 (pc 0x0001165bcf2d bp 0x7fff50fdb1f0 sp 0x7fff50fda580 T0) #0 0x1165bcf2c in Evaluate(clang::APValue&, (anonymous namespace)::EvalInfo&, clang::Expr const*) ExprConstant.cpp:9142 SUMMARY: AddressSanitizer: stack-overflow ExprConstant.cpp:9142 in Evaluate(clang::APValue&, (anonymous namespace)::EvalInfo&, clang::Expr const*) ==86262==ABORTING Stack dump: 0. Program arguments: /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang-build/./bin/clang -cc1 -internal-isystem /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang-build/bin/../lib/clang/4.0.0/include -nostdsysteminc -triple i686-linux -Wno-string-plus-int -Wno-pointer-arith -Wno-zero-length-array -fsyntax-only -fcxx-exceptions -verify -std=c++11 -pedantic /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang/src/tools/clang/test/SemaCXX/constant-expression-cxx11.cpp -Wno-comment -Wno-tautological-pointer-compare -Wno-bool-conversion 1. /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang/src/tools/clang/test/SemaCXX/constant-expression-cxx11.cpp:1457:1: current parser token '}' 2. /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang/src/tools/clang/test/SemaCXX/constant-expression-cxx11.cpp:1435:1: parsing namespace 'RecursiveOpaqueExpr' /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang-build/tools/clang/test/SemaCXX/Output/constant-expression-cxx11.cpp.script: line 1: 86262 Abort trap: 6 /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang-build/./bin/clang -cc1 -internal-isystem /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang-build/bin/../lib/clang/4.0.0/include -nostdsysteminc -triple i686-linux -Wno-string-plus-int -Wno-pointer-arith -Wno-zero-length-array -fsyntax-only -fcxx-exceptions -verify -std=c++11 -pedantic /Users/buildslave/jenkins/workspace/clangsan-branch-R-nobootstrap-cmake/clang/src/tools/clang/test/SemaCXX/constant-expression-cxx11.cpp -Wno-comment -Wno-tautological-pointer-compare -Wno-bool-conversion > On Nov 12, 2016, at 10:09 PM, Faisal Vali via cfe-commits > wrote: > > Author: faisalv > Date: Sun Nov 13 00:09:16 2016 > New Revision: 286748 > > URL: http://llvm.org/viewvc/llvm-project?rev=286748&view=rev > Log: > Fix PR28366: Handle variables from enclosing local scopes more gracefully > during constant expression evaluation. > > Only look for a variable's value in the constant expression evaluation > activation frame, if the variable was indeed declared in that frame, > otherwise it might be a constant expression and be usable within a nested > local scope or emit an error. > > > void f(char c) { > struct X { >static constexpr char f() { > return c; // error gracefully here as opposed to crashing. >} > }; > int I = X::f(); > } > > > Modified: >cfe/trunk/lib/AST/ExprConstant.cpp >cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp >cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp >cfe/trunk/test/SemaCXX/cxx1z-constexpr-lambdas.cpp > > Modified: cfe/trunk/lib/AST/ExprConstant.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=286748&r1=286747&r2=286748&view=diff > == > --- cfe/trunk/lib/AST/ExprConstant.cpp (original) > +++ cfe/trunk/lib/AST/ExprConstant.cpp Sun Nov 13 00:09:16 2016 > @@ -4803,10 +4803,21 @@ bool LValueExprEvaluator::VisitDeclRefEx > return Error(E); > } > > + > bool LValueExprEvaluator::VisitVarDecl(const Expr *E, const VarDecl *VD) { > CallStackFrame *Frame = nullptr; > - if (VD->hasLocalStorage() && Info.CurrentCall->In
[PATCH] D26115: [test] Correctly include build llvm_shlib_dir in stand-alone builds
beanz added inline comments. Comment at: test/lit.cfg:109 +if not llvm_shlib_dir: +lit_config.fatal('No LLVM shlib dir set!') llvm_libs_dir = getattr(config, 'llvm_libs_dir', None) Should this really be fatal? It seems to me in many cases you might not need this to be set. https://reviews.llvm.org/D26115 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25916: Modules: emit an error instead of a random crash (or a misleading error) due to use-after-free.
benlangmuir added a comment. > Does it mean that a system module should only import system modules? If a > system module is allowed to import non-system modules, for a non-system > module, we will validate diagnostic options differently depending on whether > a system module or a non-system module imports it. This will cause a > non-system module that was validated earlier to be invalidated by a child > thread. It seems like we should validate the options the same way regardless of what the importer is, but I'm guessing this was done for a reason... What's the behaviour of a user-header imported by a system header (without modules)? If the user header warnings show up even without -Wsystem-headers, then we should be okay validating, right? https://reviews.llvm.org/D25916 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25206: [Parser] Correct typo after lambda capture initializer is parsed
ahatanak added a comment. Are there any further comments? https://reviews.llvm.org/D25206 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D22997: [cxx1z-constexpr-lambda] Make conversion function constexpr, and teach the expression-evaluator to evaluate the static-invoker.
ahatanak added inline comments. Comment at: lib/AST/ExprConstant.cpp:4427 +const CXXRecordDecl *ClosureClass = MD->getParent(); +assert((std::distance(ClosureClass->captures_begin(), + ClosureClass->captures_end()) == 0) && Can you just compare iterators here? ``` ClosureClass->captures_begin() == ClosureClass->captures_end() ``` https://reviews.llvm.org/D22997 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r286884 - P0503R0, adopted in Issaquah, rewords some requirements on nullptr_t and istream_iterator. No code changes were needed, but I updated a few tests. Also resolved P0509 and P0521, whi
Author: marshall Date: Mon Nov 14 14:41:17 2016 New Revision: 286884 URL: http://llvm.org/viewvc/llvm-project?rev=286884&view=rev Log: P0503R0, adopted in Issaquah, rewords some requirements on nullptr_t and istream_iterator. No code changes were needed, but I updated a few tests. Also resolved P0509 and P0521, which required no changes to the library or tests. Modified: libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/copy.pass.cpp libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp libcxx/trunk/www/cxx1z_status.html Modified: libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/copy.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/copy.pass.cpp?rev=286884&r1=286883&r2=286884&view=diff == --- libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/copy.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/copy.pass.cpp Mon Nov 14 14:41:17 2016 @@ -12,11 +12,15 @@ // class istream_iterator // istream_iterator(const istream_iterator& x); +// C++17 says: If is_trivially_copy_constructible_v is true, then +// this constructor shall beis a trivial copy constructor. #include #include #include +#include "test_macros.h" + int main() { { Modified: libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp?rev=286884&r1=286883&r2=286884&view=diff == --- libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp Mon Nov 14 14:41:17 2016 @@ -12,12 +12,32 @@ // class istream_iterator // constexpr istream_iterator(); +// C++17 says: If is_trivially_default_constructible_v is true, then this +//constructor shall beis a constexpr constructor. #include #include +#include #include "test_macros.h" +struct S { S(); }; // not constexpr + +#if TEST_STD_VER > 14 +template > +struct test_trivial { +void operator ()() const { +constexpr std::istream_iterator it; +} +}; + +template +struct test_trivial { +void operator ()() const {} +}; +#endif + + int main() { { @@ -29,4 +49,11 @@ int main() #endif } +#if TEST_STD_VER > 14 +test_trivial()(); +test_trivial()(); +test_trivial()(); +test_trivial()(); +test_trivial()(); +#endif } Modified: libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp?rev=286884&r1=286883&r2=286884&view=diff == --- libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp Mon Nov 14 14:41:17 2016 @@ -23,9 +23,18 @@ // typedef basic_istream istream_type; // ... // +// Before C++17, we have: // If T is a literal type, then the default constructor shall be a constexpr constructor. // If T is a literal type, then this constructor shall be a trivial copy constructor. // If T is a literal type, then this destructor shall be a trivial destructor. +// C++17 says: +// If is_trivially_default_constructible_v is true, then +// this constructor (the default ctor) shall beis a constexpr constructor. +// If is_trivially_copy_constructible_v is true, then +// this constructor (the copy ctor) shall beis a trivial copy constructor. +// If is_trivially_destructible_v is true, then this +// destructor shall beis a trivial destructor. +// Testing the C++17 ctors for this are in the ctor tests. #include #include @@ -33,7 +42,7 @@ int main() { -typedef std::istream_iterator I1; +typedef std::istream_iterator I1; // double is trivially destructible static_assert((std::is_convertible >::value), ""); @@ -43,7 +52,7 @@ int main() static_assert( std::is_trivially_copy_constructible::value, ""); static_assert( std::is_trivially_destructible::value, ""); -typedef std::istream_iterator I2; +typedef std::istream_iterator I2; // unsigned is trivially destructible static_assert((std::is_c
[PATCH] D26559: Insert a type check before reading vtable.
krasin updated this revision to Diff 77868. krasin added a comment. Add a regression test. https://reviews.llvm.org/D26559 Files: lib/CodeGen/CGExprCXX.cpp test/CodeGenCXX/ubsan-null.cpp Index: test/CodeGenCXX/ubsan-null.cpp === --- /dev/null +++ test/CodeGenCXX/ubsan-null.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm -fsanitize=null %s -o - | FileCheck %s +struct T { + virtual int v() { return 1; } +}; + +struct U : T { + virtual int v() { return 2; } +}; + +// CHECK: define i32 @_Z5get_vP1T +int get_v(T* t) { + // CHECK: [[UBSAN_CMP_RES:%[0-9]+]] = icmp ne %struct.T* %{{[_a-z0-9]+}}, null + // CHECK-NEXT: br i1 [[UBSAN_CMP_RES]], label %cont, label %handler.type_mismatch + // CHECK: call void @__ubsan_handle_type_mismatch_abort + // CHECK: load i32 (%struct.T*)**, i32 (%struct.T*)*** + return t->v(); +} Index: lib/CodeGen/CGExprCXX.cpp === --- lib/CodeGen/CGExprCXX.cpp +++ lib/CodeGen/CGExprCXX.cpp @@ -35,17 +35,6 @@ "Trying to emit a member or operator call expr on a static method!"); ASTContext &C = CGF.getContext(); - // C++11 [class.mfct.non-static]p2: - // If a non-static member function of a class X is called for an object that - // is not of type X, or of a type derived from X, the behavior is undefined. - SourceLocation CallLoc; - if (CE) -CallLoc = CE->getExprLoc(); - CGF.EmitTypeCheck(isa(MD) -? CodeGenFunction::TCK_ConstructorCall -: CodeGenFunction::TCK_MemberCall, -CallLoc, This, C.getRecordType(MD->getParent())); - // Push the this ptr. const CXXRecordDecl *RD = CGF.CGM.getCXXABI().getThisArgumentTypeForMethod(MD); @@ -96,6 +85,14 @@ const CXXDestructorDecl *DD, const CGCallee &Callee, llvm::Value *This, llvm::Value *ImplicitParam, QualType ImplicitParamTy, const CallExpr *CE, StructorType Type) { +SourceLocation CallLoc; + ASTContext &C = getContext(); + if (CE) +CallLoc = CE->getExprLoc(); + + EmitTypeCheck(CodeGenFunction::TCK_MemberCall, +CallLoc, This, C.getRecordType(DD->getParent())); + CallArgList Args; commonEmitCXXMemberOrOperatorCall(*this, DD, This, ImplicitParam, ImplicitParamTy, CE, Args, nullptr); @@ -293,6 +290,19 @@ llvm::FunctionType *Ty = CGM.getTypes().GetFunctionType(*FInfo); + // C++11 [class.mfct.non-static]p2: + // If a non-static member function of a class X is called for an object that + // is not of type X, or of a type derived from X, the behavior is undefined. + SourceLocation CallLoc; + ASTContext &C = getContext(); + if (CE) +CallLoc = CE->getExprLoc(); + + EmitTypeCheck(isa(CalleeDecl) +? CodeGenFunction::TCK_ConstructorCall +: CodeGenFunction::TCK_MemberCall, +CallLoc, This.getPointer(), C.getRecordType(CalleeDecl->getParent())); + // FIXME: Uses of 'MD' past this point need to be audited. We may need to use // 'CalleeDecl' instead. Index: test/CodeGenCXX/ubsan-null.cpp === --- /dev/null +++ test/CodeGenCXX/ubsan-null.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm -fsanitize=null %s -o - | FileCheck %s +struct T { + virtual int v() { return 1; } +}; + +struct U : T { + virtual int v() { return 2; } +}; + +// CHECK: define i32 @_Z5get_vP1T +int get_v(T* t) { + // CHECK: [[UBSAN_CMP_RES:%[0-9]+]] = icmp ne %struct.T* %{{[_a-z0-9]+}}, null + // CHECK-NEXT: br i1 [[UBSAN_CMP_RES]], label %cont, label %handler.type_mismatch + // CHECK: call void @__ubsan_handle_type_mismatch_abort + // CHECK: load i32 (%struct.T*)**, i32 (%struct.T*)*** + return t->v(); +} Index: lib/CodeGen/CGExprCXX.cpp === --- lib/CodeGen/CGExprCXX.cpp +++ lib/CodeGen/CGExprCXX.cpp @@ -35,17 +35,6 @@ "Trying to emit a member or operator call expr on a static method!"); ASTContext &C = CGF.getContext(); - // C++11 [class.mfct.non-static]p2: - // If a non-static member function of a class X is called for an object that - // is not of type X, or of a type derived from X, the behavior is undefined. - SourceLocation CallLoc; - if (CE) -CallLoc = CE->getExprLoc(); - CGF.EmitTypeCheck(isa(MD) -? CodeGenFunction::TCK_ConstructorCall -: CodeGenFunction::TCK_MemberCall, -CallLoc, This, C.getRecordType(MD->getParent())); - // Push the this ptr. const CXXRecordDecl *RD = CGF.CGM.getCXXABI().getThisArgumentTypeForMethod(MD); @@ -96,6 +85,14 @@ const CXXDestructorDecl *DD, const CGCallee &Callee, llvm::Value *This, llvm::Value *ImplicitParam, QualTyp
[libcxx] r286883 - Missed a test with exceptions disabled earlier. Oops.
Author: marshall Date: Mon Nov 14 14:38:43 2016 New Revision: 286883 URL: http://llvm.org/viewvc/llvm-project?rev=286883&view=rev Log: Missed a test with exceptions disabled earlier. Oops. Modified: libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp Modified: libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp?rev=286883&r1=286882&r2=286883&view=diff == --- libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp (original) +++ libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp Mon Nov 14 14:38:43 2016 @@ -31,7 +31,7 @@ test(SV sv, unsigned pos, unsigned n) { typedef typename S::traits_type T; typedef typename S::allocator_type A; -try +if (pos <= sv.size()) { S s2(sv, pos, n); LIBCPP_ASSERT(s2.__invariants()); @@ -42,10 +42,20 @@ test(SV sv, unsigned pos, unsigned n) assert(s2.get_allocator() == A()); assert(s2.capacity() >= s2.size()); } -catch (std::out_of_range&) +#ifndef TEST_HAS_NO_EXCEPTIONS +else { -assert(pos > sv.size()); +try +{ +S s2(sv, pos, n); +assert(false); +} +catch (std::out_of_range&) +{ +assert(pos > sv.size()); +} } +#endif } template @@ -162,5 +172,5 @@ int main() S s7(s.data(), 2); // calls ctor(const char *, len) assert(s7 == "AB"); - } +} } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26559: Insert a type check before reading vtable.
pcc added inline comments. Comment at: lib/CodeGen/CGExprCXX.cpp:93 + + EmitTypeCheck(CodeGenFunction::TCK_MemberCall, +CallLoc, This, C.getRecordType(DD->getParent())); pcc wrote: > Is it correct to emit a type check at this point? Looking at [0] it looks > like this function is only called from the Microsoft C++ ABI after we have > already resolved the virtual function pointer. > > [0] > http://llvm-cs.pcc.me.uk/tools/clang/lib/CodeGen/CGExprCXX.cpp/rEmitCXXDestructorCall What about this comment? https://reviews.llvm.org/D26559 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26627: [libcxx] [test] Fix ordering assumptions in unordered container tests.
STL_MSFT created this revision. STL_MSFT added reviewers: EricWF, mclow.lists. STL_MSFT added a subscriber: cfe-commits. [libcxx] [test] Fix ordering assumptions in unordered container tests. https://reviews.llvm.org/D26627 Files: test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp Index: test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp === --- test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp +++ test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp @@ -146,18 +146,10 @@ C c(std::move(c0), A()); assert(c.bucket_count() >= 7); assert(c.size() == 6); -C::const_iterator i = c.cbegin(); -assert(*i == 4); -++i; -assert(*i == 3); -++i; -assert(*i == 2); -++i; -assert(*i == 2); -++i; -assert(*i == 1); -++i; -assert(*i == 1); +assert(c.count(1) == 2); +assert(c.count(2) == 2); +assert(c.count(3) == 1); +assert(c.count(4) == 1); assert(c.hash_function() == test_hash >(8)); assert(c.key_eq() == test_compare >(9)); assert(c.get_allocator() == A()); Index: test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp === --- test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp +++ test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp @@ -204,18 +204,10 @@ c = std::move(c0); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); -C::const_iterator i = c.cbegin(); -assert(*i == 4); -++i; -assert(*i == 3); -++i; -assert(*i == 2); -++i; -assert(*i == 2); -++i; -assert(*i == 1); -++i; -assert(*i == 1); +assert(c.count(1) == 2); +assert(c.count(2) == 2); +assert(c.count(3) == 1); +assert(c.count(4) == 1); assert(c.hash_function() == test_hash >(8)); assert(c.key_eq() == test_compare >(9)); assert(c.get_allocator() == A()); Index: test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp === --- test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp @@ -25,6 +25,7 @@ #include "../../../Emplaceable.h" #include "min_allocator.h" +#include "test_macros.h" int main() { @@ -44,20 +45,20 @@ assert(c.size() == 2); assert(r->first == 3); assert(r->second == Emplaceable(5, 6)); -assert(r == next(c.begin())); +LIBCPP_ASSERT(r == next(c.begin())); r = c.emplace_hint(r, std::piecewise_construct, std::forward_as_tuple(3), std::forward_as_tuple(6, 7)); assert(c.size() == 3); assert(r->first == 3); assert(r->second == Emplaceable(6, 7)); -assert(r == next(c.begin())); +LIBCPP_ASSERT(r == next(c.begin())); r = c.begin(); assert(r->first == 3); -assert(r->second == Emplaceable()); +LIBCPP_ASSERT(r->second == Emplaceable()); r = next(r, 2); assert(r->first == 3); -assert(r->second == Emplaceable(5, 6)); +LIBCPP_ASSERT(r->second == Emplaceable(5, 6)); } #if TEST_STD_VER >= 11 { @@ -76,20 +77,20 @@ assert(c.size() == 2); assert(r->first == 3); assert(r->second == Emplaceable(5, 6)); -assert(r == next(c.begin())); +LIBCPP_ASSERT(r == next(c.begin())); r = c.emplace_hint(r, std::piecewise_construct, std::forward_as_tuple(3), std::forward_as_tuple(6, 7)); assert(c.size() == 3); assert(r->first == 3); assert(r->second == Emplaceable(6, 7)); -assert(r == next(c.begin())); +LIBCPP_ASSERT(r == next(c.begin())); r = c.begin(); assert(r->first == 3); -assert(r->second == Emplaceable()); +LIBCPP_ASSERT(r->second == Emplaceable()); r = next(r, 2); assert(r->first == 3); -assert(r->second == Emplaceable(5, 6)); +LIBCPP_ASSERT(r->second == Emplaceable(5, 6)); } #endif #if _LIBCPP_DEBUG >= 1 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/c
[PATCH] D26623: [libcxx] [test] Swapping non-equal non-POCS allocators is UB.
STL_MSFT created this revision. STL_MSFT added reviewers: EricWF, mclow.lists. STL_MSFT added a subscriber: cfe-commits. [libcxx] [test] Swapping non-equal non-POCS allocators is UB. test_allocator is a non-POCS allocator. Instead of swapping containers with A(1) and A(2), which triggers undefined behavior, swapping A(3) with A(3) is conformant. test/std/containers/sequences/vector/vector.special/swap.pass.cpp Remove "#ifndef _LIBCPP_DEBUG_LEVEL" and a comment about the now-fixed undefined behavior. https://reviews.llvm.org/D26623 Files: test/std/containers/associative/map/map.special/non_member_swap.pass.cpp test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp test/std/containers/associative/set/set.special/non_member_swap.pass.cpp test/std/containers/sequences/deque/deque.special/swap.pass.cpp test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp test/std/containers/sequences/vector.bool/swap.pass.cpp test/std/containers/sequences/vector/vector.special/swap.pass.cpp test/std/containers/unord/unord.map/swap_member.pass.cpp test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp test/std/containers/unord/unord.multimap/swap_member.pass.cpp test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp test/std/containers/unord/unord.multiset/swap_member.pass.cpp test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp test/std/containers/unord/unord.set/swap_member.pass.cpp test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp Index: test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp === --- test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp +++ test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp @@ -32,25 +32,25 @@ typedef test_allocator Alloc; typedef std::unordered_set C; typedef int P; -C c1(0, Hash(1), Compare(1), Alloc(1)); -C c2(0, Hash(2), Compare(2), Alloc(2)); +C c1(0, Hash(1), Compare(1), Alloc(3)); +C c2(0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); swap(c1, c2); LIBCPP_ASSERT(c1.bucket_count() == 0); assert(c1.size() == 0); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); -assert(c1.get_allocator() == Alloc(1)); +assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); -assert(c2.get_allocator() == Alloc(2)); +assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -72,8 +72,8 @@ P(70), P(80) }; -C c1(0, Hash(1), Compare(1), Alloc(1)); -C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2)); +C c1(0, Hash(1), Compare(1), Alloc(3)); +C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); swap(c1, c2); @@ -89,16 +89,16 @@ assert(*c1.find(80) == 80); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); -assert(c1.get_allocator() == Alloc(1)); +assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); -assert(c2.get_allocator() == Alloc(2)); +assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -118,16 +118,16 @@ P(1), P(2) }; -C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1)); -C c2(0, Hash(2), Compare(2), Alloc(2)); +C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(3)); +C c2(0, Hash(2), Compare(2), Alloc(3));
[PATCH] D25916: Modules: emit an error instead of a random crash (or a misleading error) due to use-after-free.
manmanren added a comment. @ Ben, We are hitting this issue when building large projects, but the reproducibility is quite low. This proposed patch is currently a little too complicated. I am thinking about just fixing the testing case for now, and adding the check later when we start to share some data structures between threads (the idea of keeping MemoryBuffer consistent for threads within a single clang invocation). For this testing case, we ignore the diagnostic options when a module is imported by a system module (see the code snippet below): ModuleFile *TopImport = *ModuleMgr.rbegin(); while (!TopImport->ImportedBy.empty()) TopImport = TopImport->ImportedBy[0]; if (TopImport->Kind != MK_ImplicitModule) return false; StringRef ModuleName = TopImport->ModuleName; assert(!ModuleName.empty() && "diagnostic options read before module name"); Module *M = PP.getHeaderSearchInfo().lookupModule(ModuleName); assert(M && "missing module"); // FIXME: if the diagnostics are incompatible, save a DiagnosticOptions that // contains the union of their flags. return checkDiagnosticMappings(*Diags, ExistingDiags, M->IsSystem, Complain); And here // If we're reading the first module for this group, check its options // are compatible with ours. For modules it imports, no further checking // is required, because we checked them when we built it. if (Listener && !ImportedBy) { Does it mean that a system module should only import system modules? If a system module is allowed to import non-system modules, for a non-system module, we will validate diagnostic options differently depending on whether a system module or a non-system module imports it. This will cause a non-system module that was validated earlier to be invalidated by a child thread. Thanks, Manman https://reviews.llvm.org/D25916 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26626: [libcxx] [test] Fix an improper assumption about Null Forward Iterators.
STL_MSFT created this revision. STL_MSFT added reviewers: EricWF, mclow.lists. STL_MSFT added a subscriber: cfe-commits. [libcxx] [test] Fix an improper assumption about Null Forward Iterators. Value-initialized iterators still can't be compared to those with parents. https://reviews.llvm.org/D26626 Files: test/std/containers/sequences/list/iterators.pass.cpp Index: test/std/containers/sequences/list/iterators.pass.cpp === --- test/std/containers/sequences/list/iterators.pass.cpp +++ test/std/containers/sequences/list/iterators.pass.cpp @@ -138,7 +138,6 @@ #endif #if TEST_STD_VER > 11 { -std::list c; std::list::iterator ii1{}, ii2{}; std::list::iterator ii4 = ii1; std::list::const_iterator cii{}; @@ -151,9 +150,6 @@ assert ( (cii == ii1 )); assert (!(ii1 != cii )); assert (!(cii != ii1 )); - -assert ( ii1 != c.cbegin()); -assert ( cii != c.begin()); } #endif Index: test/std/containers/sequences/list/iterators.pass.cpp === --- test/std/containers/sequences/list/iterators.pass.cpp +++ test/std/containers/sequences/list/iterators.pass.cpp @@ -138,7 +138,6 @@ #endif #if TEST_STD_VER > 11 { -std::list c; std::list::iterator ii1{}, ii2{}; std::list::iterator ii4 = ii1; std::list::const_iterator cii{}; @@ -151,9 +150,6 @@ assert ( (cii == ii1 )); assert (!(ii1 != cii )); assert (!(cii != ii1 )); - -assert ( ii1 != c.cbegin()); -assert ( cii != c.begin()); } #endif ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26625: [libcxx] [test] future_error::what() is implementation-defined.
STL_MSFT created this revision. STL_MSFT added reviewers: EricWF, mclow.lists. STL_MSFT added a subscriber: cfe-commits. [libcxx] [test] future_error::what() is implementation-defined. https://reviews.llvm.org/D26625 Files: test/std/thread/futures/futures.future_error/what.pass.cpp Index: test/std/thread/futures/futures.future_error/what.pass.cpp === --- test/std/thread/futures/futures.future_error/what.pass.cpp +++ test/std/thread/futures/futures.future_error/what.pass.cpp @@ -26,25 +26,27 @@ #include #include +#include "test_macros.h" + int main() { { std::future_error f(std::make_error_code(std::future_errc::broken_promise)); -assert(std::strcmp(f.what(), "The associated promise has been destructed prior " +LIBCPP_ASSERT(std::strcmp(f.what(), "The associated promise has been destructed prior " "to the associated state becoming ready.") == 0); } { std::future_error f(std::make_error_code(std::future_errc::future_already_retrieved)); -assert(std::strcmp(f.what(), "The future has already been retrieved from " +LIBCPP_ASSERT(std::strcmp(f.what(), "The future has already been retrieved from " "the promise or packaged_task.") == 0); } { std::future_error f(std::make_error_code(std::future_errc::promise_already_satisfied)); -assert(std::strcmp(f.what(), "The state of the promise has already been set.") == 0); +LIBCPP_ASSERT(std::strcmp(f.what(), "The state of the promise has already been set.") == 0); } { std::future_error f(std::make_error_code(std::future_errc::no_state)); -assert(std::strcmp(f.what(), "Operation not permitted on an object without " +LIBCPP_ASSERT(std::strcmp(f.what(), "Operation not permitted on an object without " "an associated state.") == 0); } } Index: test/std/thread/futures/futures.future_error/what.pass.cpp === --- test/std/thread/futures/futures.future_error/what.pass.cpp +++ test/std/thread/futures/futures.future_error/what.pass.cpp @@ -26,25 +26,27 @@ #include #include +#include "test_macros.h" + int main() { { std::future_error f(std::make_error_code(std::future_errc::broken_promise)); -assert(std::strcmp(f.what(), "The associated promise has been destructed prior " +LIBCPP_ASSERT(std::strcmp(f.what(), "The associated promise has been destructed prior " "to the associated state becoming ready.") == 0); } { std::future_error f(std::make_error_code(std::future_errc::future_already_retrieved)); -assert(std::strcmp(f.what(), "The future has already been retrieved from " +LIBCPP_ASSERT(std::strcmp(f.what(), "The future has already been retrieved from " "the promise or packaged_task.") == 0); } { std::future_error f(std::make_error_code(std::future_errc::promise_already_satisfied)); -assert(std::strcmp(f.what(), "The state of the promise has already been set.") == 0); +LIBCPP_ASSERT(std::strcmp(f.what(), "The state of the promise has already been set.") == 0); } { std::future_error f(std::make_error_code(std::future_errc::no_state)); -assert(std::strcmp(f.what(), "Operation not permitted on an object without " +LIBCPP_ASSERT(std::strcmp(f.what(), "Operation not permitted on an object without " "an associated state.") == 0); } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26624: [libcxx] [test] Fix bucket_count() assumptions.
STL_MSFT created this revision. STL_MSFT added reviewers: EricWF, mclow.lists. STL_MSFT added a subscriber: cfe-commits. [libcxx] [test] Fix bucket_count() assumptions. With a max_load_factor of 1.0, the only guarantee is that bucket_count() >= size(). (Note: setting max_load_factor without rehashing isn't supposed to affect this, because setting max_load_factor is currently specified to be constant time.) https://reviews.llvm.org/D26624 Files: test/std/containers/unord/unord.map/swap_member.pass.cpp test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp test/std/containers/unord/unord.multimap/swap_member.pass.cpp test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp test/std/containers/unord/unord.multiset/swap_member.pass.cpp test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp test/std/containers/unord/unord.set/swap_member.pass.cpp test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp Index: test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp === --- test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp +++ test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp @@ -77,7 +77,7 @@ c2.max_load_factor(2); swap(c1, c2); -assert(c1.bucket_count() >= 11); +assert(c1.bucket_count() >= 8); assert(c1.size() == 8); assert(*c1.find(10) == 10); assert(*c1.find(20) == 20); @@ -132,7 +132,7 @@ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); -assert(c2.bucket_count() >= 5); +assert(c2.bucket_count() >= 4); assert(c2.size() == 4); assert(c2.count(1) == 1); assert(c2.count(2) == 1); @@ -176,7 +176,7 @@ c2.max_load_factor(2); swap(c1, c2); -assert(c1.bucket_count() >= 11); +assert(c1.bucket_count() >= 8); assert(c1.size() == 8); assert(*c1.find(10) == 10); assert(*c1.find(20) == 20); @@ -193,7 +193,7 @@ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); -assert(c2.bucket_count() >= 5); +assert(c2.bucket_count() >= 4); assert(c2.size() == 4); assert(c2.count(1) == 1); assert(c2.count(2) == 1); @@ -258,7 +258,7 @@ c2.max_load_factor(2); swap(c1, c2); -assert(c1.bucket_count() >= 11); +assert(c1.bucket_count() >= 8); assert(c1.size() == 8); assert(*c1.find(10) == 10); assert(*c1.find(20) == 20); @@ -313,7 +313,7 @@ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); -assert(c2.bucket_count() >= 5); +assert(c2.bucket_count() >= 4); assert(c2.size() == 4); assert(c2.count(1) == 1); assert(c2.count(2) == 1); @@ -357,7 +357,7 @@ c2.max_load_factor(2); swap(c1, c2); -assert(c1.bucket_count() >= 11); +assert(c1.bucket_count() >= 8); assert(c1.size() == 8); assert(*c1.find(10) == 10); assert(*c1.find(20) == 20); @@ -374,7 +374,7 @@ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); -assert(c2.bucket_count() >= 5); +assert(c2.bucket_count() >= 4); assert(c2.size() == 4); assert(c2.count(1) == 1); assert(c2.count(2) == 1); @@ -439,7 +439,7 @@ c2.max_load_factor(2); swap(c1, c2); -assert(c1.bucket_count() >= 11); +assert(c1.bucket_count() >= 8); assert(c1.size() == 8); assert(*c1.find(10) == 10); assert(*c1.find(20) == 20); @@ -494,7 +494,7 @@ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); -assert(c2.bucket_count() >= 5); +assert(c2.bucket_count() >= 4); assert(c2.size() == 4); assert(c2.count(1) == 1); assert(c2.count(2) == 1); @@ -538,7 +538,7 @@ c2.max_load_factor(2); swap(c1, c2); -assert(c1.bucket_count() >= 11); +assert(c1.bucket_count() >= 8); assert(c1.size() == 8); assert(*c1.find(10) == 10); assert(*c1.find(20) == 20); @@ -555,7 +555,7 @@ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); -assert(c2.bucket_count() >= 5); +assert(c2.bucket_count() >= 4); assert(c2.size() == 4); assert(c2.count(1) == 1); assert(c2.count(2) == 1); Index: test/std/containers/unord/unord.set/swap_member.pass.cpp === -
[PATCH] D26592: [change-namespace] consider typedef/using alias decls in the moved namespace.
This revision was automatically updated to reflect the committed changes. ioeric marked an inline comment as done. Closed by commit rL286873: [change-namespace] consider typedef/using alias decls in the moved namespace. (authored by ioeric). Changed prior to commit: https://reviews.llvm.org/D26592?vs=77792&id=77852#toc Repository: rL LLVM https://reviews.llvm.org/D26592 Files: clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp Index: clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp === --- clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp +++ clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp @@ -822,22 +822,22 @@ } TEST_F(ChangeNamespaceTest, UsingShadowDeclInClass) { - std::string Code = "namespace na { class C_A {};\n }\n" + std::string Code = "namespace na { class C_A {}; }\n" "namespace na {\n" "namespace nb {\n" "void f() {\n" - " using na::CA;\n" - " CA ca;\n" + " using ::na::C_A;\n" + " C_A ca;\n" "}\n" "} // namespace nb\n" "} // namespace na\n"; - std::string Expected = "namespace na { class C_A {};\n }\n" + std::string Expected = "namespace na { class C_A {}; }\n" "\n" "namespace x {\n" "namespace y {\n" "void f() {\n" - " using na::CA;\n" - " CA ca;\n" + " using ::na::C_A;\n" + " C_A ca;\n" "}\n" "} // namespace y\n" "} // namespace x\n"; @@ -941,6 +941,70 @@ EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code)); } +TEST_F(ChangeNamespaceTest, UsingAliasDecl) { + std::string Code = + "namespace nx { namespace ny { class X {}; } }\n" + "namespace na {\n" + "namespace nb {\n" + "using Y = nx::ny::X;\n" + "void f() { Y y; }\n" + "} // namespace nb\n" + "} // namespace na\n"; + + std::string Expected = "namespace nx { namespace ny { class X {}; } }\n" + "\n" + "namespace x {\n" + "namespace y {\n" + "using Y = nx::ny::X;\n" + "void f() { Y y; }\n" + "} // namespace y\n" + "} // namespace x\n"; + EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code)); +} + +TEST_F(ChangeNamespaceTest, UsingAliasDeclInGlobal) { + std::string Code = + "namespace nx { namespace ny { class X {}; } }\n" + "using Y = nx::ny::X;\n" + "namespace na {\n" + "namespace nb {\n" + "void f() { Y y; }\n" + "} // namespace nb\n" + "} // namespace na\n"; + + std::string Expected = "namespace nx { namespace ny { class X {}; } }\n" + "using Y = nx::ny::X;\n" + "\n" + "namespace x {\n" + "namespace y {\n" + "void f() { Y y; }\n" + "} // namespace y\n" + "} // namespace x\n"; + EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code)); +} + + +TEST_F(ChangeNamespaceTest, TypedefAliasDecl) { + std::string Code = + "namespace nx { namespace ny { class X {}; } }\n" + "namespace na {\n" + "namespace nb {\n" + "typedef nx::ny::X Y;\n" + "void f() { Y y; }\n" + "} // namespace nb\n" + "} // namespace na\n"; + + std::string Expected = "namespace nx { namespace ny { class X {}; } }\n" + "\n" + "namespace x {\n" + "namespace y {\n" + "typedef nx::ny::X Y;\n" + "void f() { Y y; }\n" + "} // namespace y\n" + "} // namespace x\n"; + EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code)); +} + } // anonymous namespace } // namespace change_namespace } // namespace clang Index: clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp === --- clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp +++ clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp @@ -621,8 +621,27 @@ const auto *FromDecl = Result.Nodes.getNodeAs("from_decl"); // `hasDeclaration` gives underlying declaration, but if the type is // a typedef type, we need to use the typedef type instead. - if (auto *Typedef = Type.getType()-
[clang-tools-extra] r286873 - [change-namespace] consider typedef/using alias decls in the moved namespace.
Author: ioeric Date: Mon Nov 14 13:37:55 2016 New Revision: 286873 URL: http://llvm.org/viewvc/llvm-project?rev=286873&view=rev Log: [change-namespace] consider typedef/using alias decls in the moved namespace. Summary: If a TypeLoc refers to a type alias defined in the moved namespace, we do not need to update its specifier since the type alias decl will be moved along with the type reference. Reviewers: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26592 Modified: clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp Modified: clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp?rev=286873&r1=286872&r2=286873&view=diff == --- clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp (original) +++ clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp Mon Nov 14 13:37:55 2016 @@ -621,8 +621,27 @@ void ChangeNamespaceTool::fixTypeLoc( const auto *FromDecl = Result.Nodes.getNodeAs("from_decl"); // `hasDeclaration` gives underlying declaration, but if the type is // a typedef type, we need to use the typedef type instead. - if (auto *Typedef = Type.getType()->getAs()) + if (auto *Typedef = Type.getType()->getAs()) { FromDecl = Typedef->getDecl(); +auto IsInMovedNs = [&](const NamedDecl *D) { + if (!llvm::StringRef(D->getQualifiedNameAsString()) + .startswith(OldNamespace + "::")) +return false; + auto ExpansionLoc = + Result.SourceManager->getExpansionLoc(D->getLocStart()); + if (ExpansionLoc.isInvalid()) +return false; + llvm::StringRef Filename = + Result.SourceManager->getFilename(ExpansionLoc); + llvm::Regex RE(FilePattern); + return RE.match(Filename); +}; +// Don't fix the \p Type if it refers to a type alias decl in the moved +// namespace since the alias decl will be moved along with the type +// reference. +if (IsInMovedNs(FromDecl)) + return; + } const Decl *DeclCtx = Result.Nodes.getNodeAs("dc"); assert(DeclCtx && "Empty decl context."); Modified: clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp?rev=286873&r1=286872&r2=286873&view=diff == --- clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp (original) +++ clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp Mon Nov 14 13:37:55 2016 @@ -822,22 +822,22 @@ TEST_F(ChangeNamespaceTest, UsingShadowD } TEST_F(ChangeNamespaceTest, UsingShadowDeclInClass) { - std::string Code = "namespace na { class C_A {};\n }\n" + std::string Code = "namespace na { class C_A {}; }\n" "namespace na {\n" "namespace nb {\n" "void f() {\n" - " using na::CA;\n" - " CA ca;\n" + " using ::na::C_A;\n" + " C_A ca;\n" "}\n" "} // namespace nb\n" "} // namespace na\n"; - std::string Expected = "namespace na { class C_A {};\n }\n" + std::string Expected = "namespace na { class C_A {}; }\n" "\n" "namespace x {\n" "namespace y {\n" "void f() {\n" - " using na::CA;\n" - " CA ca;\n" + " using ::na::C_A;\n" + " C_A ca;\n" "}\n" "} // namespace y\n" "} // namespace x\n"; @@ -941,6 +941,70 @@ TEST_F(ChangeNamespaceTest, UsingDeclInT EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code)); } +TEST_F(ChangeNamespaceTest, UsingAliasDecl) { + std::string Code = + "namespace nx { namespace ny { class X {}; } }\n" + "namespace na {\n" + "namespace nb {\n" + "using Y = nx::ny::X;\n" + "void f() { Y y; }\n" + "} // namespace nb\n" + "} // namespace na\n"; + + std::string Expected = "namespace nx { namespace ny { class X {}; } }\n" + "\n" + "namespace x {\n" + "namespace y {\n" + "using Y = nx::ny::X;\n" + "void f() { Y y; }\n" + "} // namespace y\n" + "} // namespace x\n"; + EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code)); +} + +TEST_F(ChangeNamespaceT
[libcxx] r286872 - Make one of the new tests fail correctly on pre-C++17 systems
Author: marshall Date: Mon Nov 14 13:35:34 2016 New Revision: 286872 URL: http://llvm.org/viewvc/llvm-project?rev=286872&view=rev Log: Make one of the new tests fail correctly on pre-C++17 systems Modified: libcxx/trunk/test/std/utilities/memory/specialized.algorithms/specialized.addressof/addressof.temp.fail.cpp Modified: libcxx/trunk/test/std/utilities/memory/specialized.algorithms/specialized.addressof/addressof.temp.fail.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/specialized.algorithms/specialized.addressof/addressof.temp.fail.cpp?rev=286872&r1=286871&r2=286872&view=diff == --- libcxx/trunk/test/std/utilities/memory/specialized.algorithms/specialized.addressof/addressof.temp.fail.cpp (original) +++ libcxx/trunk/test/std/utilities/memory/specialized.algorithms/specialized.addressof/addressof.temp.fail.cpp Mon Nov 14 13:35:34 2016 @@ -14,7 +14,13 @@ #include #include +#include "test_macros.h" + int main() { +#if TEST_STD_VER > 14 const int *p = std::addressof(0); +#else +#error +#endif } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26589: Add static analyzer checker for finding infinite recursion
NoQ added a comment. Thank you for working on this! The overall approach is good. Because alpha checkers are disabled by default, false positives can be addressed later in subsequent commits. Comment at: lib/StaticAnalyzer/Checkers/RecursionChecker.cpp:2 +// InfiniteRecursionChecker.cpp - Test if function is infinitely +// recursive--*--// +// Accidental line break :o Comment at: lib/StaticAnalyzer/Checkers/RecursionChecker.cpp:21 + +REGISTER_SET_WITH_PROGRAMSTATE(DirtyStackFrames, const clang::StackFrameContext *) + k-wisniewski wrote: > a.sidorin wrote: > > The idea of "dirty stack frames" deserves some explanation. As I > > understand, it describes function calls where some values may change > > unexpectedly and we cannot consider this calls later. Am I understanding > > correctly? > Yes! Right now it considers frame as "dirty" when there was any kind of > region change in this frame or in any function that was called from it. As > you see below, it then stops the search down the stack once it encounter such > a "dirty" frame, because it can no longer be sure that conditions upon which > the recursive call depends on did not change in an unpredictable way. It's > obviously too broad a definition and in the next iterations I'll try to > narrow it down to variables that affect whether the recursive call happens or > not. I also consider looking at //the way // it changes to determine if it's > meaningful or not. I think this deserves commenting, at least the very mechanism of how a stack frame is considered dirty (if it is present in the set, or if a parent is present in the set, or something else, and why is the chosen method somehow correct). Comment at: lib/StaticAnalyzer/Checkers/RecursionChecker.cpp:145 +BT.reset( +new BugType(this, "Infinite recursion detected", "RecursionChecker")); + I think one of the builtin bugtypes should be used, such as `LogicError`. In any case, both of these should be human-friendly (they appear eg. in scan-view). Comment at: test/Analysis/recursion.cpp:27 + +void f2(); +void f3(); k-wisniewski wrote: > a.sidorin wrote: > > I'd like to see some more informative function names: for me, it is hard to > > distinguish between f1-7 here :) It is also hard to determine the function > > where test starts. > The convention I know is that the bottom-most one gets considered first, but > I may add some explicitly marked entry points for the sake of consistency and > to make it easier to reason about. There's a way to hard-check this through `FileCheck` + `-analyzer-display-progress` (see `inlining/analysis-order.c`). Might be an overkill, but on the other hand may actually improve readability of the test quite a bit. Comment at: test/Analysis/recursion.cpp:37 +void f2() { +SampleGlobalVariable = 1; +f3(); This should eventually warn. Even though the variable is accessed, it's not really changed :) I'd suggest something like: ``` ++SampleGlobalVariable; if (SampleGlobalVariable < 100) f3(); ``` It'd make sure that the test is "correct" (it's obvious to the reader that this is a false positive we'd never want to warn about). But you could also keep the original test with a FIXME remark ("we should eventually warn about this"). I also think that this group of tests deserves to have the following test: ``` bool bar(); // no definition! void foo() { if (bar()) { // may change the global state foo(); // no-warning } } ``` This test case should magically work because calling `bar()` will change the "global memory space" region (invalidate all globals). https://reviews.llvm.org/D26589 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26588: Add LocationContext to members of check::RegionChanges
NoQ added a comment. Welcome to phabricator! I agree that having the location context in this callback is useful, and i'm all for reducing boilerplate in various checkers through better API. Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:231 ProgramStateRef bindLoc(Loc location, SVal V, Because this API becomes more complicated, i think we should add some docstrings here, explaining the meaning of the location context parameter, in particular. Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:733 +inline SVal ProgramState::getArgSVal(const StackFrameContext *SFC, + const unsigned ArgIdx) const { + const FunctionDecl *FunctionDecl = SFC->getDecl()->getAsFunction(); Indent. Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:741 +// because the call wasn't modeled in the first place. +const VarDecl *ArgDecl = FunctionDecl->parameters()[ArgIdx]; +const Loc ArgLoc = getLValue(ArgDecl, SFC); a.sidorin wrote: > Unfortunately, this code does not consider the fact that argument values may > be overwritten. If we want to get initial values, we should find another way. Uhm, yeah, this is in fact a problem! The purpose of this code is, in fact, to construct `SymbolRegionValue` for the parameter, so it is equivalent to calling `SValBuilder::getRegionValueSymbolVal()` over the parameter region, as long as the current `StoreManager` implementation remains unquestioned. We could also ask `StoreManager` to provide a binding for this region from an empty store, maybe extend its API to allow such queries, this would remove the layering violation. Because this topic getting is rather complicated, it might have been better to make a separate review for this change, originally (no problem now that most of the interested people have already had a look). https://reviews.llvm.org/D26588 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r286864 - Implement P0510 'Make future_error Constructible' adopted in Issaquah
Author: marshall Date: Mon Nov 14 12:56:24 2016 New Revision: 286864 URL: http://llvm.org/viewvc/llvm-project?rev=286864&view=rev Log: Implement P0510 'Make future_error Constructible' adopted in Issaquah Modified: libcxx/trunk/include/future libcxx/trunk/test/std/thread/futures/futures.future_error/code.pass.cpp libcxx/trunk/www/cxx1z_status.html Modified: libcxx/trunk/include/future URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/future?rev=286864&r1=286863&r2=286864&view=diff == --- libcxx/trunk/include/future (original) +++ libcxx/trunk/include/future Mon Nov 14 12:56:24 2016 @@ -50,7 +50,7 @@ class future_error { public: future_error(error_code ec); // exposition only - +explicit future_error(future_errc); // C++17 const error_code& code() const noexcept; const char* what() const noexcept; }; @@ -505,7 +505,9 @@ class _LIBCPP_EXCEPTION_ABI future_error error_code __ec_; public: future_error(error_code __ec); - +#if _LIBCPP_STD_VERS > 14 +explicit future_error(future_errc _Ev) : logic_error(), __ec_(make_error_code(_Ev)) {} +#endif _LIBCPP_INLINE_VISIBILITY const error_code& code() const _NOEXCEPT {return __ec_;} Modified: libcxx/trunk/test/std/thread/futures/futures.future_error/code.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/futures/futures.future_error/code.pass.cpp?rev=286864&r1=286863&r2=286864&view=diff == --- libcxx/trunk/test/std/thread/futures/futures.future_error/code.pass.cpp (original) +++ libcxx/trunk/test/std/thread/futures/futures.future_error/code.pass.cpp Mon Nov 14 12:56:24 2016 @@ -12,12 +12,16 @@ // // class future_error +// future_error(error_code __ec); // exposition only +// explicit future_error(future_errc _Ev) : __ec_(make_error_code(_Ev)) {} // C++17 // const error_code& code() const throw(); #include #include +#include "test_macros.h" + int main() { { @@ -40,4 +44,14 @@ int main() std::future_error f(ec); assert(f.code() == ec); } +#if TEST_STD_VER > 14 +{ +std::future_error f(std::future_errc::broken_promise); +assert(f.code() == std::make_error_code(std::future_errc::broken_promise)); +} +{ +std::future_error f(std::future_errc::no_state); +assert(f.code() == std::make_error_code(std::future_errc::no_state)); +} +#endif } Modified: libcxx/trunk/www/cxx1z_status.html URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=286864&r1=286863&r2=286864&view=diff == --- libcxx/trunk/www/cxx1z_status.html (original) +++ libcxx/trunk/www/cxx1z_status.html Mon Nov 14 12:56:24 2016 @@ -138,7 +138,7 @@ http://wg21.link/P0510R0";>P0510R0LWGDisallowing references, incomplete types, arrays, and empty variantsIssaquah http://wg21.link/P0513R0";>P0513R0LWGPoisoning the HashIssaquah http://wg21.link/P0516R0";>P0516R0LWGClarify That shared_futureâs Copy Operations have Wide ContractsIssaquah - http://wg21.link/P0517R0";>P0517R0LWGMake future_error ConstructibleIssaquah + http://wg21.link/P0517R0";>P0517R0LWGMake future_error ConstructibleIssaquahComplete4.0 http://wg21.link/P0521R0";>P0521R0LWGProposed Resolution for CA 14 (shared_ptr use_count/unique)Issaquah ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26534: [PPC] add altivec.h functions for converting a vector of half precision to a vector of single precision
This revision was automatically updated to reflect the committed changes. Closed by commit rL286863: [PPC] altivec.h functions for converting half precision to single precision. (authored by sfertile). Changed prior to commit: https://reviews.llvm.org/D26534?vs=77581&id=77842#toc Repository: rL LLVM https://reviews.llvm.org/D26534 Files: cfe/trunk/include/clang/Basic/BuiltinsPPC.def cfe/trunk/lib/Headers/altivec.h cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c Index: cfe/trunk/include/clang/Basic/BuiltinsPPC.def === --- cfe/trunk/include/clang/Basic/BuiltinsPPC.def +++ cfe/trunk/include/clang/Basic/BuiltinsPPC.def @@ -402,6 +402,7 @@ BUILTIN(__builtin_vsx_xvcvdpsp, "V4fV2d", "") BUILTIN(__builtin_vsx_xvcvsphp, "V4fV4f", "") +BUILTIN(__builtin_vsx_xvcvhpsp, "V4fV8Us", "") // Vector Test Data Class builtins BUILTIN(__builtin_vsx_xvtstdcdp, "V2ULLiV2dIi", "") Index: cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c === --- cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c +++ cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c @@ -967,3 +967,21 @@ // CHECK-NEXT: ret <2 x i64> return vec_test_data_class(vda, __VEC_CLASS_FP_NOT_NORMAL); } +vector float test88(void) { +// CHECK-BE: shufflevector <8 x i16> {{.+}}, <8 x i16> {{.+}}, <8 x i32> +// CHECK-BE: @llvm.ppc.vsx.xvcvhpsp(<8 x i16> {{.+}}) +// CHECK-BE-NEXT: ret <4 x float> +// CHECK-LE: shufflevector <8 x i16> {{.+}}, <8 x i16> {{.+}}, <8 x i32> +// CHECK-LE: @llvm.ppc.vsx.xvcvhpsp(<8 x i16> {{.+}}) +// CHECK-LE-NEXT: ret <4 x float> + return vec_extract_fp32_from_shorth(vusa); +} +vector float test89(void) { +// CHECK-BE: shufflevector <8 x i16> {{.+}}, <8 x i16> {{.+}}, <8 x i32> +// CHECK-BE: @llvm.ppc.vsx.xvcvhpsp(<8 x i16> {{.+}}) +// CHECK-BE-NEXT: ret <4 x float> +// CHECK-LE: shufflevector <8 x i16> {{.+}}, <8 x i16> {{.+}}, <8 x i32> +// CHECK-LE: @llvm.ppc.vsx.xvcvhpsp(<8 x i16> {{.+}}) +// CHECK-LE-NEXT: ret <4 x float> + return vec_extract_fp32_from_shortl(vusa); +} Index: cfe/trunk/lib/Headers/altivec.h === --- cfe/trunk/lib/Headers/altivec.h +++ cfe/trunk/lib/Headers/altivec.h @@ -12322,6 +12322,27 @@ return __builtin_vsx_xvxsigdp(__a); } +static __inline__ vector float __ATTRS_o_ai +vec_extract_fp32_from_shorth(vector unsigned short __a) { + vector unsigned short __b = +#ifdef __LITTLE_ENDIAN__ +__builtin_shufflevector(__a, __a, 0, -1, 1, -1, 2, -1, 3, -1); +#else +__builtin_shufflevector(__a, __a, -1, 0, -1, 1, -1, 2, -1, 3); +#endif + return __builtin_vsx_xvcvhpsp(__b); +} + +static __inline__ vector float __ATTRS_o_ai +vec_extract_fp32_from_shortl(vector unsigned short __a) { + vector unsigned short __b = +#ifdef __LITTLE_ENDIAN__ +__builtin_shufflevector(__a, __a, 4, -1, 5, -1, 6, -1, 7, -1); +#else +__builtin_shufflevector(__a, __a, -1, 4, -1, 5, -1, 6, -1, 7); +#endif + return __builtin_vsx_xvcvhpsp(__b); +} #endif /* __POWER9_VECTOR__ */ /* vec_insert */ Index: cfe/trunk/include/clang/Basic/BuiltinsPPC.def === --- cfe/trunk/include/clang/Basic/BuiltinsPPC.def +++ cfe/trunk/include/clang/Basic/BuiltinsPPC.def @@ -402,6 +402,7 @@ BUILTIN(__builtin_vsx_xvcvdpsp, "V4fV2d", "") BUILTIN(__builtin_vsx_xvcvsphp, "V4fV4f", "") +BUILTIN(__builtin_vsx_xvcvhpsp, "V4fV8Us", "") // Vector Test Data Class builtins BUILTIN(__builtin_vsx_xvtstdcdp, "V2ULLiV2dIi", "") Index: cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c === --- cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c +++ cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c @@ -967,3 +967,21 @@ // CHECK-NEXT: ret <2 x i64> return vec_test_data_class(vda, __VEC_CLASS_FP_NOT_NORMAL); } +vector float test88(void) { +// CHECK-BE: shufflevector <8 x i16> {{.+}}, <8 x i16> {{.+}}, <8 x i32> +// CHECK-BE: @llvm.ppc.vsx.xvcvhpsp(<8 x i16> {{.+}}) +// CHECK-BE-NEXT: ret <4 x float> +// CHECK-LE: shufflevector <8 x i16> {{.+}}, <8 x i16> {{.+}}, <8 x i32> +// CHECK-LE: @llvm.ppc.vsx.xvcvhpsp(<8 x i16> {{.+}}) +// CHECK-LE-NEXT: ret <4 x float> + return vec_extract_fp32_from_shorth(vusa); +} +vector float test89(void) { +// CHECK-BE: shufflevector <8 x i16> {{.+}}, <8 x i16> {{.+}}, <8 x i32> +// CHECK-BE: @llvm.ppc.vsx.xvcvhpsp(<8 x i16> {{.+}}) +// CHECK-BE-NEXT: ret <4 x float> +// CHECK-LE: shufflevector <8 x i16> {{.+}}, <8 x i16> {{.+}}, <8 x i32> +// CHECK-LE: @llvm.ppc.vsx.xvcvhpsp(<8 x i16> {{.+}}) +// CHECK-LE-NEXT: ret <4 x float> + return vec_extract_fp32_from_shortl(vusa); +} Index: cfe/trunk/lib/Headers/altivec.h === --- cfe/trunk/lib/Headers/altivec.h +++ cfe/trunk/lib/Headers/altivec.h @@ -12322,6 +12322,27 @@
r286863 - [PPC] altivec.h functions for converting half precision to single precision.
Author: sfertile Date: Mon Nov 14 12:47:15 2016 New Revision: 286863 URL: http://llvm.org/viewvc/llvm-project?rev=286863&view=rev Log: [PPC] altivec.h functions for converting half precision to single precision. Adds 2 vector functions for converting from a vector of unsigned short to a vector of float. One converts the low 4 halfwords and one converts the high 4 halfwords. Differential Revision: https://reviews.llvm.org/D26534 Modified: cfe/trunk/include/clang/Basic/BuiltinsPPC.def cfe/trunk/lib/Headers/altivec.h cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c Modified: cfe/trunk/include/clang/Basic/BuiltinsPPC.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsPPC.def?rev=286863&r1=286862&r2=286863&view=diff == --- cfe/trunk/include/clang/Basic/BuiltinsPPC.def (original) +++ cfe/trunk/include/clang/Basic/BuiltinsPPC.def Mon Nov 14 12:47:15 2016 @@ -402,6 +402,7 @@ BUILTIN(__builtin_vsx_xvcvuxdsp, "V4fV2U BUILTIN(__builtin_vsx_xvcvdpsp, "V4fV2d", "") BUILTIN(__builtin_vsx_xvcvsphp, "V4fV4f", "") +BUILTIN(__builtin_vsx_xvcvhpsp, "V4fV8Us", "") // Vector Test Data Class builtins BUILTIN(__builtin_vsx_xvtstdcdp, "V2ULLiV2dIi", "") Modified: cfe/trunk/lib/Headers/altivec.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/altivec.h?rev=286863&r1=286862&r2=286863&view=diff == --- cfe/trunk/lib/Headers/altivec.h (original) +++ cfe/trunk/lib/Headers/altivec.h Mon Nov 14 12:47:15 2016 @@ -12322,6 +12322,27 @@ vec_extract_sig (vector double __a) { return __builtin_vsx_xvxsigdp(__a); } +static __inline__ vector float __ATTRS_o_ai +vec_extract_fp32_from_shorth(vector unsigned short __a) { + vector unsigned short __b = +#ifdef __LITTLE_ENDIAN__ +__builtin_shufflevector(__a, __a, 0, -1, 1, -1, 2, -1, 3, -1); +#else +__builtin_shufflevector(__a, __a, -1, 0, -1, 1, -1, 2, -1, 3); +#endif + return __builtin_vsx_xvcvhpsp(__b); +} + +static __inline__ vector float __ATTRS_o_ai +vec_extract_fp32_from_shortl(vector unsigned short __a) { + vector unsigned short __b = +#ifdef __LITTLE_ENDIAN__ +__builtin_shufflevector(__a, __a, 4, -1, 5, -1, 6, -1, 7, -1); +#else +__builtin_shufflevector(__a, __a, -1, 4, -1, 5, -1, 6, -1, 7); +#endif + return __builtin_vsx_xvcvhpsp(__b); +} #endif /* __POWER9_VECTOR__ */ /* vec_insert */ Modified: cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c?rev=286863&r1=286862&r2=286863&view=diff == --- cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c (original) +++ cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c Mon Nov 14 12:47:15 2016 @@ -967,3 +967,21 @@ vector bool long long test87(void) { // CHECK-NEXT: ret <2 x i64> return vec_test_data_class(vda, __VEC_CLASS_FP_NOT_NORMAL); } +vector float test88(void) { +// CHECK-BE: shufflevector <8 x i16> {{.+}}, <8 x i16> {{.+}}, <8 x i32> +// CHECK-BE: @llvm.ppc.vsx.xvcvhpsp(<8 x i16> {{.+}}) +// CHECK-BE-NEXT: ret <4 x float> +// CHECK-LE: shufflevector <8 x i16> {{.+}}, <8 x i16> {{.+}}, <8 x i32> +// CHECK-LE: @llvm.ppc.vsx.xvcvhpsp(<8 x i16> {{.+}}) +// CHECK-LE-NEXT: ret <4 x float> + return vec_extract_fp32_from_shorth(vusa); +} +vector float test89(void) { +// CHECK-BE: shufflevector <8 x i16> {{.+}}, <8 x i16> {{.+}}, <8 x i32> +// CHECK-BE: @llvm.ppc.vsx.xvcvhpsp(<8 x i16> {{.+}}) +// CHECK-BE-NEXT: ret <4 x float> +// CHECK-LE: shufflevector <8 x i16> {{.+}}, <8 x i16> {{.+}}, <8 x i32> +// CHECK-LE: @llvm.ppc.vsx.xvcvhpsp(<8 x i16> {{.+}}) +// CHECK-LE-NEXT: ret <4 x float> + return vec_extract_fp32_from_shortl(vusa); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r286858 - Fixes for LWG 2598, 2686, 2739, 2742, 2747, and 2759, which were adopted last week in Issaquah
Author: marshall Date: Mon Nov 14 12:22:19 2016 New Revision: 286858 URL: http://llvm.org/viewvc/llvm-project?rev=286858&view=rev Log: Fixes for LWG 2598, 2686, 2739, 2742, 2747, and 2759, which were adopted last week in Issaquah Added: libcxx/trunk/test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp libcxx/trunk/test/std/utilities/memory/specialized.algorithms/specialized.addressof/addressof.temp.fail.cpp Modified: libcxx/trunk/include/algorithm libcxx/trunk/include/chrono libcxx/trunk/include/memory libcxx/trunk/include/numeric libcxx/trunk/include/string libcxx/trunk/include/string_view libcxx/trunk/include/system_error libcxx/trunk/include/type_traits libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp libcxx/trunk/test/std/utilities/time/time.point/time.point.nonmember/op_-duration.pass.cpp libcxx/trunk/www/cxx1z_status.html Modified: libcxx/trunk/include/algorithm URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=286858&r1=286857&r2=286858&view=diff == --- libcxx/trunk/include/algorithm (original) +++ libcxx/trunk/include/algorithm Mon Nov 14 12:22:19 2016 @@ -877,7 +877,7 @@ for_each(_InputIterator __first, _InputI { for (; __first != __last; ++__first) __f(*__first); -return _LIBCPP_EXPLICIT_MOVE(__f); // explicitly moved for (emulated) C++03 +return __f; } // find Modified: libcxx/trunk/include/chrono URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/chrono?rev=286858&r1=286857&r2=286858&view=diff == --- libcxx/trunk/include/chrono (original) +++ libcxx/trunk/include/chrono Mon Nov 14 12:22:19 2016 @@ -1026,7 +1026,8 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { -return __lhs + (-__rhs); +typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Ret; +return _Ret(__lhs.time_since_epoch() -__rhs); } // duration operator-(time_point x, time_point y); Modified: libcxx/trunk/include/memory URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=286858&r1=286857&r2=286858&view=diff == --- libcxx/trunk/include/memory (original) +++ libcxx/trunk/include/memory Mon Nov 14 12:22:19 2016 @@ -164,6 +164,7 @@ template pair ge template void return_temporary_buffer(T* p) noexcept; template T* addressof(T& r) noexcept; +template T* addressof(const T&& r) noexcept = delete; template ForwardIterator @@ -675,7 +676,7 @@ _ValueType __libcpp_acquire_load(_ValueT #endif } -// addressof moved to <__functional_base> +// addressof moved to template class allocator; Modified: libcxx/trunk/include/numeric URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/numeric?rev=286858&r1=286857&r2=286858&view=diff == --- libcxx/trunk/include/numeric (original) +++ libcxx/trunk/include/numeric Mon Nov 14 12:22:19 2016 @@ -230,6 +230,8 @@ common_type_t<_Tp,_Up> gcd(_Tp __m, _Up __n) { static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to gcd must be integer types"); +static_assert((!is_same::type, bool>::value), "First argument to gcd cannot be bool" ); +static_assert((!is_same::type, bool>::value), "Second argument to gcd cannot be bool" ); using _Rp = common_type_t<_Tp,_Up>; using _Wp = make_unsigned_t<_Rp>; return static_cast<_Rp>(__gcd(static_cast<_Wp>(__abs<_Tp>()(__m)), @@ -242,6 +244,8 @@ commo
r286856 - Fix OpenCL test for buildbot by removing extra (erroneous) RUN line
Author: stulova Date: Mon Nov 14 12:11:09 2016 New Revision: 286856 URL: http://llvm.org/viewvc/llvm-project?rev=286856&view=rev Log: Fix OpenCL test for buildbot by removing extra (erroneous) RUN line Modified: cfe/trunk/test/SemaOpenCL/cl20-device-side-enqueue.cl Modified: cfe/trunk/test/SemaOpenCL/cl20-device-side-enqueue.cl URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/cl20-device-side-enqueue.cl?rev=286856&r1=286855&r2=286856&view=diff == --- cfe/trunk/test/SemaOpenCL/cl20-device-side-enqueue.cl (original) +++ cfe/trunk/test/SemaOpenCL/cl20-device-side-enqueue.cl Mon Nov 14 12:11:09 2016 @@ -1,4 +1,3 @@ -// RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only // RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir-unknown-unknown" -verify -pedantic -fsyntax-only -DB32 // RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir64-unknown-unknown" -verify -pedantic -fsyntax-only -Wconversion -DWCONV ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26509: [OpenCL] Fix integer parameters of enqueue_kernel
Anastasia closed this revision. Anastasia added a comment. Committed in r286849. https://reviews.llvm.org/D26509 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r286849 - [OpenCL] Fix for integer parameters of enqueue_kernel
Author: stulova Date: Mon Nov 14 11:39:58 2016 New Revision: 286849 URL: http://llvm.org/viewvc/llvm-project?rev=286849&view=rev Log: [OpenCL] Fix for integer parameters of enqueue_kernel Make handling integer parameters more flexible: - For the number of events argument allow to pass larger integers than 32 bits as soon as compiler can prove that the range fits in 32 bits. If not, the diagnostic will be given. - Change type of the arguments specifying the sizes of the corresponding block arguments to be size_t. Review: https://reviews.llvm.org/D26509 Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/CodeGen/CGBuiltin.cpp cfe/trunk/lib/Sema/SemaChecking.cpp cfe/trunk/test/CodeGenOpenCL/cl20-device-side-enqueue.cl cfe/trunk/test/SemaOpenCL/cl20-device-side-enqueue.cl Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=286849&r1=286848&r2=286849&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Nov 14 11:39:58 2016 @@ -8163,7 +8163,7 @@ def err_opencl_enqueue_kernel_expected_t def err_opencl_enqueue_kernel_local_size_args : Error< "mismatch in number of block parameters and local size arguments passed">; def err_opencl_enqueue_kernel_invalid_local_size_type : Error< - "local memory sizes need to be specified as uint">; + "illegal call to enqueue_kernel, parameter needs to be specified as integer type">; def err_opencl_enqueue_kernel_blocks_non_local_void_args : Error< "blocks used in device side enqueue are expected to have parameters of type 'local void*'">; def err_opencl_enqueue_kernel_blocks_no_args : Error< Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=286849&r1=286848&r2=286849&view=diff == --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original) +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Nov 14 11:39:58 2016 @@ -2517,17 +2517,11 @@ RValue CodeGenFunction::EmitBuiltinExpr( std::vector ArgTys = {QueueTy, IntTy, RangeTy, Int8PtrTy, IntTy}; - // Add the variadics. - for (unsigned I = 4; I < NumArgs; ++I) { -llvm::Value *ArgSize = EmitScalarExpr(E->getArg(I)); -unsigned TypeSizeInBytes = -getContext() -.getTypeSizeInChars(E->getArg(I)->getType()) -.getQuantity(); -Args.push_back(TypeSizeInBytes < 4 - ? Builder.CreateZExt(ArgSize, Int32Ty) - : ArgSize); - } + // Each of the following arguments specifies the size of the corresponding + // argument passed to the enqueued block. + for (unsigned I = 4/*Position of the first size arg*/; I < NumArgs; ++I) +Args.push_back( +Builder.CreateZExtOrTrunc(EmitScalarExpr(E->getArg(I)), SizeTy)); llvm::FunctionType *FTy = llvm::FunctionType::get( Int32Ty, llvm::ArrayRef(ArgTys), true); @@ -2541,7 +2535,8 @@ RValue CodeGenFunction::EmitBuiltinExpr( llvm::Type *EventPtrTy = EventTy->getPointerTo( CGM.getContext().getTargetAddressSpace(LangAS::opencl_generic)); - llvm::Value *NumEvents = EmitScalarExpr(E->getArg(3)); + llvm::Value *NumEvents = + Builder.CreateZExtOrTrunc(EmitScalarExpr(E->getArg(3)), Int32Ty); llvm::Value *EventList = E->getArg(4)->getType()->isArrayType() ? EmitArrayToPointerDecay(E->getArg(4)).getPointer() @@ -2575,17 +2570,12 @@ RValue CodeGenFunction::EmitBuiltinExpr( ArgTys.push_back(Int32Ty); Name = "__enqueue_kernel_events_vaargs"; - // Add the variadics. - for (unsigned I = 7; I < NumArgs; ++I) { -llvm::Value *ArgSize = EmitScalarExpr(E->getArg(I)); -unsigned TypeSizeInBytes = -getContext() -.getTypeSizeInChars(E->getArg(I)->getType()) -.getQuantity(); -Args.push_back(TypeSizeInBytes < 4 - ? Builder.CreateZExt(ArgSize, Int32Ty) - : ArgSize); - } + // Each of the following arguments specifies the size of the corresponding + // argument passed to the enqueued block. + for (unsigned I = 7/*Position of the first size arg*/; I < NumArgs; ++I) +Args.push_back( +Builder.CreateZExtOrTrunc(EmitScalarExpr(E->getArg(I)), SizeTy)); + llvm::FunctionType *FTy = llvm::FunctionType::get( Int32Ty, llvm::ArrayRef(ArgTys), true); return RValue::get( Modified: cfe/trunk/lib/Sema/SemaChecking.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema
[PATCH] D26588: Add LocationContext to members of check::RegionChanges
a.sidorin added a comment. Hi Krzysztof! This change seems useful: I can imagine the situation where we want to ask current `LocationContext` in this callback. The change looks pretty intrusive but I mostly agree with it. Initially, I have some questions about the implementation of `getArgSVal()` function (inline comments). I'll add more comments later. Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:735 + const FunctionDecl *FunctionDecl = SFC->getDecl()->getAsFunction(); + unsigned NumArgs = FunctionDecl->getNumParams(); + assert(ArgIdx < NumArgs && "Arg access out of range!"); Maybe we should put a check that requested StackFrame is our StackFrame or our parent StackFrame here? Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:741 +// because the call wasn't modeled in the first place. +const VarDecl *ArgDecl = FunctionDecl->parameters()[ArgIdx]; +const Loc ArgLoc = getLValue(ArgDecl, SFC); Unfortunately, this code does not consider the fact that argument values may be overwritten. If we want to get initial values, we should find another way. https://reviews.llvm.org/D26588 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26314: [libcxx] [test] Fix MSVC warning C4189 "local variable is initialized but not referenced".
STL_MSFT closed this revision. STL_MSFT added a comment. Checked in as r286847. https://reviews.llvm.org/D26314 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r286847 - [libcxx] [test] D26314: Fix MSVC warning C4189 "local variable is initialized but not referenced".
Author: stl_msft Date: Mon Nov 14 11:35:14 2016 New Revision: 286847 URL: http://llvm.org/viewvc/llvm-project?rev=286847&view=rev Log: [libcxx] [test] D26314: Fix MSVC warning C4189 "local variable is initialized but not referenced". test/std/depr/depr.c.headers/inttypes_h.pass.cpp test/std/input.output/file.streams/c.files/cinttypes.pass.cpp test/std/input.output/iostream.forward/iosfwd.pass.cpp Add test() to avoid a bunch of void-casts, although we still need a few. test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp skippingws was unused (it's unclear to me whether this was mistakenly copy-pasted from round_trip() below). test/std/localization/locale.categories/category.collate/locale.collate/types.pass.cpp test/std/localization/locale.categories/category.ctype/facet.ctype.special/types.pass.cpp test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char.pass.cpp test/std/localization/locale.categories/category.ctype/locale.codecvt/types_wchar_t.pass.cpp test/std/localization/locale.categories/category.ctype/locale.ctype/types.pass.cpp test/std/localization/locale.categories/facet.numpunct/locale.numpunct/types.pass.cpp test/std/localization/locales/locale.global.templates/use_facet.pass.cpp When retrieving facets, the references are unused. test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long.pass.cpp test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp "std::ios_base::iostate err = ios.goodbit;" was completely unused here. test/std/localization/locale.categories/category.time/locale.time.get/time_base.pass.cpp test/std/numerics/c.math/ctgmath.pass.cpp test/std/numerics/rand/rand.device/entropy.pass.cpp test/std/numerics/rand/rand.device/eval.pass.cpp test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eof.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eof.pass.cpp test/std/thread/futures/futures.promise/dtor.pass.cpp test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp test/std/thread/thread.condition/thread.condition.condvar/wait_for_pred.pass.cpp These variables are verifying types but are otherwise unused. test/std/strings/basic.string/string.capacity/reserve.pass.cpp old_cap was unused (it's unclear to me whether it was intended to be used). test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/eq.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/lt.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/eq.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/lt.pass.cpp These tests contained unused characters. Modified: libcxx/trunk/test/std/depr/depr.c.headers/inttypes_h.pass.cpp libcxx/trunk/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp libcxx/trunk/test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp libcxx/trunk/test/std/input.output/iostream.forward/iosfwd.pass.cpp libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/types.pass.cpp libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/types.pass.cpp libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char.pass.cpp libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_wchar_t.pass.cpp libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/types.pass.cpp libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long.pass.cpp libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/time_base.pass.cpp libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/types.pass.cpp libcxx/trunk/test/std/localization/locales/locale.global.templates/use_facet.pass.cpp libcxx/trunk/test/std/numerics/c.math/ctgmath.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.device/entropy.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.device/eval.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.capacity/reserve.p
r286846 - [clang docs] Minor fix in ClangCheck.rst
Author: mgrang Date: Mon Nov 14 11:31:24 2016 New Revision: 286846 URL: http://llvm.org/viewvc/llvm-project?rev=286846&view=rev Log: [clang docs] Minor fix in ClangCheck.rst Reviewers: djasper, rengolin Subscribers: Eugene.Zelenko Tags: #clang-c Differential Revision: https://reviews.llvm.org/D26484 Modified: cfe/trunk/docs/ClangCheck.rst Modified: cfe/trunk/docs/ClangCheck.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCheck.rst?rev=286846&r1=286845&r2=286846&view=diff == --- cfe/trunk/docs/ClangCheck.rst (original) +++ cfe/trunk/docs/ClangCheck.rst Mon Nov 14 11:31:24 2016 @@ -31,6 +31,6 @@ do basic error checking and AST dumping. 1 error generated. Error while processing snippet.cc. -The '--' at the end is important as it prevents `clang-check` from search for a -compilation database. For more information on how to setup and use `clang-check` -in a project, see :doc:`HowToSetupToolingForLLVM`. +The '--' at the end is important as it prevents :program:`clang-check` from +searching for a compilation database. For more information on how to setup and +use :program:`clang-check` in a project, see :doc:`HowToSetupToolingForLLVM`. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26509: [OpenCL] Fix integer parameters of enqueue_kernel
Anastasia updated the summary for this revision. Anastasia updated this revision to Diff 77825. Anastasia added a comment. 1. Corrected typos in CodeGen test. 2. Improved description. https://reviews.llvm.org/D26509 Files: include/clang/Basic/DiagnosticSemaKinds.td lib/CodeGen/CGBuiltin.cpp lib/Sema/SemaChecking.cpp test/CodeGenOpenCL/cl20-device-side-enqueue.cl test/SemaOpenCL/cl20-device-side-enqueue.cl Index: lib/CodeGen/CGBuiltin.cpp === --- lib/CodeGen/CGBuiltin.cpp +++ lib/CodeGen/CGBuiltin.cpp @@ -2517,17 +2517,11 @@ std::vector ArgTys = {QueueTy, IntTy, RangeTy, Int8PtrTy, IntTy}; - // Add the variadics. - for (unsigned I = 4; I < NumArgs; ++I) { -llvm::Value *ArgSize = EmitScalarExpr(E->getArg(I)); -unsigned TypeSizeInBytes = -getContext() -.getTypeSizeInChars(E->getArg(I)->getType()) -.getQuantity(); -Args.push_back(TypeSizeInBytes < 4 - ? Builder.CreateZExt(ArgSize, Int32Ty) - : ArgSize); - } + // Each of the following arguments specifies the size of the corresponding + // argument passed to the enqueued block. + for (unsigned I = 4/*Position of the first size arg*/; I < NumArgs; ++I) +Args.push_back( +Builder.CreateZExtOrTrunc(EmitScalarExpr(E->getArg(I)), SizeTy)); llvm::FunctionType *FTy = llvm::FunctionType::get( Int32Ty, llvm::ArrayRef(ArgTys), true); @@ -2541,7 +2535,8 @@ llvm::Type *EventPtrTy = EventTy->getPointerTo( CGM.getContext().getTargetAddressSpace(LangAS::opencl_generic)); - llvm::Value *NumEvents = EmitScalarExpr(E->getArg(3)); + llvm::Value *NumEvents = + Builder.CreateZExtOrTrunc(EmitScalarExpr(E->getArg(3)), Int32Ty); llvm::Value *EventList = E->getArg(4)->getType()->isArrayType() ? EmitArrayToPointerDecay(E->getArg(4)).getPointer() @@ -2575,17 +2570,12 @@ ArgTys.push_back(Int32Ty); Name = "__enqueue_kernel_events_vaargs"; - // Add the variadics. - for (unsigned I = 7; I < NumArgs; ++I) { -llvm::Value *ArgSize = EmitScalarExpr(E->getArg(I)); -unsigned TypeSizeInBytes = -getContext() -.getTypeSizeInChars(E->getArg(I)->getType()) -.getQuantity(); -Args.push_back(TypeSizeInBytes < 4 - ? Builder.CreateZExt(ArgSize, Int32Ty) - : ArgSize); - } + // Each of the following arguments specifies the size of the corresponding + // argument passed to the enqueued block. + for (unsigned I = 7/*Position of the first size arg*/; I < NumArgs; ++I) +Args.push_back( +Builder.CreateZExtOrTrunc(EmitScalarExpr(E->getArg(I)), SizeTy)); + llvm::FunctionType *FTy = llvm::FunctionType::get( Int32Ty, llvm::ArrayRef(ArgTys), true); return RValue::get( Index: lib/Sema/SemaChecking.cpp === --- lib/Sema/SemaChecking.cpp +++ lib/Sema/SemaChecking.cpp @@ -315,8 +315,18 @@ return checkOpenCLBlockArgs(S, BlockArg); } +/// Diagnose integer type and any valid implicit convertion to it. +static bool checkOpenCLEnqueueIntType(Sema &S, Expr *E, + const QualType &IntType); + static bool checkOpenCLEnqueueLocalSizeArgs(Sema &S, CallExpr *TheCall, -unsigned Start, unsigned End); +unsigned Start, unsigned End) { + bool IllegalParams = false; + for (unsigned I = Start; I <= End; ++I) +IllegalParams |= checkOpenCLEnqueueIntType(S, TheCall->getArg(I), + S.Context.getSizeType()); + return IllegalParams; +} /// OpenCL v2.0, s6.13.17.1 - Check that sizes are provided for all /// 'local void*' parameter of passed block. @@ -9325,25 +9335,19 @@ } // end anonymous namespace -static bool checkOpenCLEnqueueLocalSizeArgs(Sema &S, CallExpr *TheCall, -unsigned Start, unsigned End) { - bool IllegalParams = false; - for (unsigned I = Start; I <= End; ++I) { -QualType Ty = TheCall->getArg(I)->getType(); -// Taking into account implicit conversions, -// allow any integer within 32 bits range -if (!Ty->isIntegerType() || -S.Context.getTypeSizeInChars(Ty).getQuantity() > 4) { - S.Diag(TheCall->getArg(I)->getLocStart(), - diag::err_opencl_enqueue_kernel_invalid_local_size_type); - IllegalParams = true; -} -// Potentially emit standard warnings for implicit conversions if enabled -// using -Wconversion. -CheckImplicitConversion(S, TheCall->getArg(I), S.Context.UnsignedIntTy, -
r286842 - Fix the unit test darwin-multiarch-arm.c for windows
Author: sgundapa Date: Mon Nov 14 11:09:39 2016 New Revision: 286842 URL: http://llvm.org/viewvc/llvm-project?rev=286842&view=rev Log: Fix the unit test darwin-multiarch-arm.c for windows Modified: cfe/trunk/test/Driver/darwin-multiarch-arm.c Modified: cfe/trunk/test/Driver/darwin-multiarch-arm.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-multiarch-arm.c?rev=286842&r1=286841&r2=286842&view=diff == --- cfe/trunk/test/Driver/darwin-multiarch-arm.c (original) +++ cfe/trunk/test/Driver/darwin-multiarch-arm.c Mon Nov 14 11:09:39 2016 @@ -9,6 +9,6 @@ // CHECK:"-cc1" "-triple" "thumbv7s-apple-ios5.0.0" // CHECK-SAME: "-o" "[[CC_OUT2:[^"]*]]" // CHECK:ld{{(\.exe)?}}" {{.*}} "-o" "[[LD_OUT2:[^"]*]]" {{.*}} "[[CC_OUT2]]" -// CHECK:lipo" +// CHECK:lipo{{(\.exe)?}}" // CHECK-DAG: "[[LD_OUT1]]" // CHECK-DAG: "[[LD_OUT2]]" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26493: [clang-move] Make the output code look more pretty.
hokein updated this revision to Diff 77821. hokein added a comment. Remove a trailing blank line. https://reviews.llvm.org/D26493 Files: clang-move/ClangMove.cpp unittests/clang-move/ClangMoveTests.cpp Index: unittests/clang-move/ClangMoveTests.cpp === --- unittests/clang-move/ClangMoveTests.cpp +++ unittests/clang-move/ClangMoveTests.cpp @@ -127,8 +127,10 @@ const char ExpectedNewHeader[] = "#ifndef NEW_FOO_H\n" "#define NEW_FOO_H\n" + "\n" "namespace a {\n" "class C1; // test\n" + "\n" "template class C2;\n" "namespace b {\n" "// This is a Foo class\n" @@ -144,6 +146,7 @@ "}; // abc\n" "} // namespace b\n" "} // namespace a\n" + "\n" "#endif // NEW_FOO_H\n"; const char ExpectedNewCC[] = "namespace a {\n" @@ -154,17 +157,21 @@ "/// comment2.\n" "int kConstInt1 = 0;\n" "} // namespace\n" + "\n" "/* comment 3*/\n" "static int kConstInt2 = 1;\n" + "\n" "/** comment4\n" "*/\n" "static int help() {\n" " int a = 0;\n" " return a;\n" "}\n" + "\n" "// comment5\n" "// comment5\n" "void Foo::f() { f1(); }\n" + "\n" "/\n" "// comment //\n" "/\n" @@ -312,15 +319,17 @@ TEST(ClangMove, DontMoveAll) { const char ExpectedHeader[] = "#ifndef NEW_FOO_H\n" "#define NEW_FOO_H\n" +"\n" "class A {\npublic:\n int f();\n};\n" +"\n" "#endif // NEW_FOO_H\n"; const char Code[] = "#include \"foo.h\"\nint A::f() { return 0; }"; std::vector TestHeaders = { -"typedef int Int;\nclass A {\npublic:\n int f();\n};", -"using Int=int;\nclass A {\npublic:\n int f();\n};", -"class B {};\nclass A {\npublic:\n int f();\n};", -"void f() {};\nclass A {\npublic:\n int f();\n};", -"enum Color { RED };\nclass A {\npublic:\n int f();\n};", +"typedef int Int;\nclass A {\npublic:\n int f();\n};\n", +"using Int=int;\nclass A {\npublic:\n int f();\n};\n", +"class B {};\nclass A {\npublic:\n int f();\n};\n", +"void f() {};\nclass A {\npublic:\n int f();\n};\n", +"enum Color { RED };\nclass A {\npublic:\n int f();\n};\n", }; move::ClangMoveTool::MoveDefinitionSpec Spec; Spec.Names.push_back("A"); @@ -332,7 +341,7 @@ auto Results = runClangMoveOnCode(Spec, Header.c_str(), Code); EXPECT_EQ(ExpectedHeader, Results[Spec.NewHeader]); // The expected old header should not contain class A definition. -std::string ExpectedOldHeader = Header.substr(0, Header.size() - 31); +std::string ExpectedOldHeader = Header.substr(0, Header.size() - 32); EXPECT_EQ(ExpectedOldHeader, Results[Spec.OldHeader]); } } @@ -355,6 +364,61 @@ EXPECT_EQ(ExpectedNewCode, Results[Spec.NewCC]); } +TEST(ClangMove, WellFormattedCode) { + const std::string CommonHeader = + "namespace a {\n" + "namespace b {\n" + "namespace c {\n" + "class C;\n" + "\n" + "class A {\npublic:\n void f();\n void f2();\n};\n" + "} // namespace c\n" + "} // namespace b\n" + "\n" + "namespace d {\n" + "namespace e {\n" + "class B {\npublic:\n void f();\n};\n" + "} // namespace e\n" + "} // namespace d\n" + "} // namespace a\n"; + const std::string CommonCode = "\n" + "namespace a {\n" + "namespace b {\n" + "namespace c {\n" + "void A::f() {}\n" + "\n" + "void A::f2() {}\n" + "} // namespace c\n" + "} // namespace b\n" + "\n" + "namespace d {\n" + "namespace e {\n" +
[PATCH] D26493: [clang-move] Make the output code look more pretty.
hokein updated this revision to Diff 77820. hokein marked an inline comment as done. hokein added a comment. Fix a corner case, and add a test. https://reviews.llvm.org/D26493 Files: clang-move/ClangMove.cpp unittests/clang-move/ClangMoveTests.cpp Index: unittests/clang-move/ClangMoveTests.cpp === --- unittests/clang-move/ClangMoveTests.cpp +++ unittests/clang-move/ClangMoveTests.cpp @@ -127,8 +127,10 @@ const char ExpectedNewHeader[] = "#ifndef NEW_FOO_H\n" "#define NEW_FOO_H\n" + "\n" "namespace a {\n" "class C1; // test\n" + "\n" "template class C2;\n" "namespace b {\n" "// This is a Foo class\n" @@ -144,6 +146,7 @@ "}; // abc\n" "} // namespace b\n" "} // namespace a\n" + "\n" "#endif // NEW_FOO_H\n"; const char ExpectedNewCC[] = "namespace a {\n" @@ -154,17 +157,21 @@ "/// comment2.\n" "int kConstInt1 = 0;\n" "} // namespace\n" + "\n" "/* comment 3*/\n" "static int kConstInt2 = 1;\n" + "\n" "/** comment4\n" "*/\n" "static int help() {\n" " int a = 0;\n" " return a;\n" "}\n" + "\n" "// comment5\n" "// comment5\n" "void Foo::f() { f1(); }\n" + "\n" "/\n" "// comment //\n" "/\n" @@ -312,15 +319,17 @@ TEST(ClangMove, DontMoveAll) { const char ExpectedHeader[] = "#ifndef NEW_FOO_H\n" "#define NEW_FOO_H\n" +"\n" "class A {\npublic:\n int f();\n};\n" +"\n" "#endif // NEW_FOO_H\n"; const char Code[] = "#include \"foo.h\"\nint A::f() { return 0; }"; std::vector TestHeaders = { -"typedef int Int;\nclass A {\npublic:\n int f();\n};", -"using Int=int;\nclass A {\npublic:\n int f();\n};", -"class B {};\nclass A {\npublic:\n int f();\n};", -"void f() {};\nclass A {\npublic:\n int f();\n};", -"enum Color { RED };\nclass A {\npublic:\n int f();\n};", +"typedef int Int;\nclass A {\npublic:\n int f();\n};\n", +"using Int=int;\nclass A {\npublic:\n int f();\n};\n", +"class B {};\nclass A {\npublic:\n int f();\n};\n", +"void f() {};\nclass A {\npublic:\n int f();\n};\n", +"enum Color { RED };\nclass A {\npublic:\n int f();\n};\n", }; move::ClangMoveTool::MoveDefinitionSpec Spec; Spec.Names.push_back("A"); @@ -332,7 +341,7 @@ auto Results = runClangMoveOnCode(Spec, Header.c_str(), Code); EXPECT_EQ(ExpectedHeader, Results[Spec.NewHeader]); // The expected old header should not contain class A definition. -std::string ExpectedOldHeader = Header.substr(0, Header.size() - 31); +std::string ExpectedOldHeader = Header.substr(0, Header.size() - 32); EXPECT_EQ(ExpectedOldHeader, Results[Spec.OldHeader]); } } @@ -355,6 +364,62 @@ EXPECT_EQ(ExpectedNewCode, Results[Spec.NewCC]); } +TEST(ClangMove, WellFormattedCode) { + const std::string CommonHeader = + "namespace a {\n" + "namespace b {\n" + "namespace c {\n" + "class C;\n" + "\n" + "class A {\npublic:\n void f();\n void f2();\n};\n" + "} // namespace c\n" + "} // namespace b\n" + "\n" + "namespace d {\n" + "namespace e {\n" + "class B {\npublic:\n void f();\n};\n" + "} // namespace e\n" + "} // namespace d\n" + "} // namespace a\n"; + const std::string CommonCode = "\n" + "namespace a {\n" + "namespace b {\n" + "namespace c {\n" + "void A::f() {}\n" + "\n" + "void A::f2() {}\n" + "} // namespace c\n" + "} // namespace b\n" + "\n" + "namespace d {\n" +
[PATCH] D26271: [PPC] add extract significand/ extract exponent/test data class for vector float and vector double -- clang portion
sfertile closed this revision. sfertile added a comment. committed https://reviews.llvm.org/rL286830 Repository: rL LLVM https://reviews.llvm.org/D26271 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26454: Implement no_sanitize_address for global vars
dougk updated this revision to Diff 77815. dougk marked an inline comment as done. dougk added a comment. add a sentence about the change in AddressSanitizer.rst https://reviews.llvm.org/D26454 Files: docs/AddressSanitizer.rst lib/CodeGen/SanitizerMetadata.cpp lib/Sema/SemaDeclAttr.cpp test/CodeGen/asan-globals.cpp test/SemaCXX/attr-no-sanitize-address.cpp Index: test/SemaCXX/attr-no-sanitize-address.cpp === --- test/SemaCXX/attr-no-sanitize-address.cpp +++ test/SemaCXX/attr-no-sanitize-address.cpp @@ -16,8 +16,11 @@ int noanal_testfn(int y) NO_SANITIZE_ADDRESS; int noanal_testfn(int y) { + // Test the deprecated spelling of no_sanitize("address") int x NO_SANITIZE_ADDRESS = y; // \ -// expected-error {{'no_sanitize_address' attribute only applies to functions}} +// expected-error {{'no_sanitize_address' attribute only applies to functions and global variables}} + int x2 __attribute__((no_sanitize("address"))) = y; // \ +// expected-error {{'no_sanitize' attribute only applies to functions, methods, and global variables}} return x; } Index: test/CodeGen/asan-globals.cpp === --- test/CodeGen/asan-globals.cpp +++ test/CodeGen/asan-globals.cpp @@ -7,7 +7,8 @@ int global; int dyn_init_global = global; -int __attribute__((no_sanitize("address"))) attributed_global; +int __attribute__((no_sanitize("address"))) attributed_global1; +int __attribute__((no_sanitize_address)) attributed_global2; int blacklisted_global; void func() { @@ -15,26 +16,28 @@ const char *literal = "Hello, world!"; } -// CHECK: !llvm.asan.globals = !{![[EXTRA_GLOBAL:[0-9]+]], ![[GLOBAL:[0-9]+]], ![[DYN_INIT_GLOBAL:[0-9]+]], ![[ATTR_GLOBAL:[0-9]+]], ![[BLACKLISTED_GLOBAL:[0-9]+]], ![[STATIC_VAR:[0-9]+]], ![[LITERAL:[0-9]+]]} +// CHECK: !llvm.asan.globals = !{![[EXTRA_GLOBAL:[0-9]+]], ![[GLOBAL:[0-9]+]], ![[DYN_INIT_GLOBAL:[0-9]+]], ![[ATTR_GLOBAL1:[0-9]+]], ![[ATTR_GLOBAL2:[0-9]+]], ![[BLACKLISTED_GLOBAL:[0-9]+]], ![[STATIC_VAR:[0-9]+]], ![[LITERAL:[0-9]+]]} // CHECK: ![[EXTRA_GLOBAL]] = !{{{.*}} ![[EXTRA_GLOBAL_LOC:[0-9]+]], !"extra_global", i1 false, i1 false} // CHECK: ![[EXTRA_GLOBAL_LOC]] = !{!"{{.*}}extra-source.cpp", i32 1, i32 5} // CHECK: ![[GLOBAL]] = !{{{.*}} ![[GLOBAL_LOC:[0-9]+]], !"global", i1 false, i1 false} // CHECK: ![[GLOBAL_LOC]] = !{!"{{.*}}asan-globals.cpp", i32 8, i32 5} // CHECK: ![[DYN_INIT_GLOBAL]] = !{{{.*}} ![[DYN_INIT_LOC:[0-9]+]], !"dyn_init_global", i1 true, i1 false} // CHECK: ![[DYN_INIT_LOC]] = !{!"{{.*}}asan-globals.cpp", i32 9, i32 5} -// CHECK: ![[ATTR_GLOBAL]] = !{{{.*}}, null, null, i1 false, i1 true} +// CHECK: ![[ATTR_GLOBAL1]] = !{{{.*}}, null, null, i1 false, i1 true} +// CHECK: ![[ATTR_GLOBAL2]] = !{{{.*}}, null, null, i1 false, i1 true} // CHECK: ![[BLACKLISTED_GLOBAL]] = !{{{.*}}, null, null, i1 false, i1 true} // CHECK: ![[STATIC_VAR]] = !{{{.*}} ![[STATIC_LOC:[0-9]+]], !"static_var", i1 false, i1 false} -// CHECK: ![[STATIC_LOC]] = !{!"{{.*}}asan-globals.cpp", i32 14, i32 14} +// CHECK: ![[STATIC_LOC]] = !{!"{{.*}}asan-globals.cpp", i32 15, i32 14} // CHECK: ![[LITERAL]] = !{{{.*}} ![[LITERAL_LOC:[0-9]+]], !"", i1 false, i1 false} -// CHECK: ![[LITERAL_LOC]] = !{!"{{.*}}asan-globals.cpp", i32 15, i32 25} +// CHECK: ![[LITERAL_LOC]] = !{!"{{.*}}asan-globals.cpp", i32 16, i32 25} -// BLACKLIST-SRC: !llvm.asan.globals = !{![[EXTRA_GLOBAL:[0-9]+]], ![[GLOBAL:[0-9]+]], ![[DYN_INIT_GLOBAL:[0-9]+]], ![[ATTR_GLOBAL:[0-9]+]], ![[BLACKLISTED_GLOBAL:[0-9]+]], ![[STATIC_VAR:[0-9]+]], ![[LITERAL:[0-9]+]]} +// BLACKLIST-SRC: !llvm.asan.globals = !{![[EXTRA_GLOBAL:[0-9]+]], ![[GLOBAL:[0-9]+]], ![[DYN_INIT_GLOBAL:[0-9]+]], ![[ATTR_GLOBAL1:[0-9]+]], ![[ATTR_GLOBAL2:[0-9]+]], ![[BLACKLISTED_GLOBAL:[0-9]+]], ![[STATIC_VAR:[0-9]+]], ![[LITERAL:[0-9]+]]} // BLACKLIST-SRC: ![[EXTRA_GLOBAL]] = !{{{.*}} ![[EXTRA_GLOBAL_LOC:[0-9]+]], !"extra_global", i1 false, i1 false} // BLACKLIST-SRC: ![[EXTRA_GLOBAL_LOC]] = !{!"{{.*}}extra-source.cpp", i32 1, i32 5} // BLACKLIST-SRC: ![[GLOBAL]] = !{{{.*}} null, null, i1 false, i1 true} // BLACKLIST-SRC: ![[DYN_INIT_GLOBAL]] = !{{{.*}} null, null, i1 true, i1 true} -// BLACKLIST-SRC: ![[ATTR_GLOBAL]] = !{{{.*}}, null, null, i1 false, i1 true} +// BLACKLIST-SRC: ![[ATTR_GLOBAL1]] = !{{{.*}}, null, null, i1 false, i1 true} +// BLACKLIST-SRC: ![[ATTR_GLOBAL2]] = !{{{.*}}, null, null, i1 false, i1 true} // BLACKLIST-SRC: ![[BLACKLISTED_GLOBAL]] = !{{{.*}}, null, null, i1 false, i1 true} // BLACKLIST-SRC: ![[STATIC_VAR]] = !{{{.*}} null, null, i1 false, i1 true} // BLACKLIST-SRC: ![[LITERAL]] = !{{{.*}} null, null, i1 false, i1 true} Index: lib/Sema/SemaDeclAttr.cpp === --- lib/Sema/SemaDeclAttr.cpp +++ lib/Sema/SemaDeclAttr.cpp @@ -5319,9 +5319,9 @@ !(Attr.hasScope() && Attr.getScopeName()->isStr("gnu"))) S.Di
[libclc] r286839 - Fix build since r286752.
Author: tstellar Date: Mon Nov 14 10:06:33 2016 New Revision: 286839 URL: http://llvm.org/viewvc/llvm-project?rev=286839&view=rev Log: Fix build since r286752. Modified: libclc/trunk/utils/prepare-builtins.cpp Modified: libclc/trunk/utils/prepare-builtins.cpp URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/utils/prepare-builtins.cpp?rev=286839&r1=286838&r2=286839&view=diff == --- libclc/trunk/utils/prepare-builtins.cpp (original) +++ libclc/trunk/utils/prepare-builtins.cpp Mon Nov 14 10:06:33 2016 @@ -41,7 +41,8 @@ int main(int argc, char **argv) { ErrorMessage = ec.message(); else { ErrorOr> ModuleOrErr = - parseBitcodeFile(BufferPtr.get()->getMemBufferRef(), Context); + expectedToErrorOrAndEmitErrors(Context, + parseBitcodeFile(BufferPtr.get()->getMemBufferRef(), Context)); if (std::error_code ec = ModuleOrErr.getError()) ErrorMessage = ec.message(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r286815 - Improve handling of floating point literals in OpenCL to only use double precision if the target supports fp64.
Can you add some non-trivial test cases that exercise double-rounding, especially near the overflow boundary? e.g. What is the expected value of x if the target does not support fp64?: float x = 340282356779733661637539395458142568447.0; – Steve > On Nov 14, 2016, at 6:15 AM, Neil Hickey via cfe-commits > wrote: > > Author: neil.hickey > Date: Mon Nov 14 05:15:51 2016 > New Revision: 286815 > > URL: http://llvm.org/viewvc/llvm-project?rev=286815&view=rev > Log: > Improve handling of floating point literals in OpenCL to only use double > precision if the target supports fp64. > > This change makes sure single-precision floating point types are used if the > cl_fp64 extension is not supported by the target. > > Also removed the check to see whether the OpenCL version is >= 1.2, as this > has > been incorporated into the extension setting code. > > Differential Revision: https://reviews.llvm.org/D24235 > > > Modified: > cfe/trunk/lib/Sema/SemaExpr.cpp > cfe/trunk/lib/Sema/SemaType.cpp > cfe/trunk/test/CodeGenOpenCL/fpmath.cl > cfe/trunk/test/SemaOpenCL/extensions.cl > > Modified: cfe/trunk/lib/Sema/SemaExpr.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=286815&r1=286814&r2=286815&view=diff > == > --- cfe/trunk/lib/Sema/SemaExpr.cpp (original) > +++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Nov 14 05:15:51 2016 > @@ -705,9 +705,13 @@ ExprResult Sema::DefaultLvalueConversion > if (getLangOpts().ObjCAutoRefCount && > E->getType().getObjCLifetime() == Qualifiers::OCL_Weak) >Cleanup.setExprNeedsCleanups(true); > + > + ExprResult Res = E; > > - ExprResult Res = ImplicitCastExpr::Create(Context, T, CK_LValueToRValue, E, > -nullptr, VK_RValue); > + if ( T != E->getType()) { > +Res = ImplicitCastExpr::Create(Context, T, CK_LValueToRValue, E, > + nullptr, VK_RValue); > + } > > // C11 6.3.2.1p2: > // ... if the lvalue has atomic type, the value has the non-atomic version > @@ -817,8 +821,16 @@ ExprResult Sema::DefaultArgumentPromotio > // double. > const BuiltinType *BTy = Ty->getAs(); > if (BTy && (BTy->getKind() == BuiltinType::Half || > - BTy->getKind() == BuiltinType::Float)) > -E = ImpCastExprToType(E, Context.DoubleTy, CK_FloatingCast).get(); > + BTy->getKind() == BuiltinType::Float)) { > +if (getLangOpts().OpenCL && > +!(getOpenCLOptions().cl_khr_fp64)) { > +if (BTy->getKind() == BuiltinType::Half) { > +E = ImpCastExprToType(E, Context.FloatTy, CK_FloatingCast).get(); > +} > +} else { > + E = ImpCastExprToType(E, Context.DoubleTy, CK_FloatingCast).get(); > +} > + } > > // C++ performs lvalue-to-rvalue conversion as a default argument > // promotion, even on class types, but note: > @@ -3397,10 +3409,13 @@ ExprResult Sema::ActOnNumericConstant(co > >if (Ty == Context.DoubleTy) { > if (getLangOpts().SinglePrecisionConstants) { > -Res = ImpCastExprToType(Res, Context.FloatTy, CK_FloatingCast).get(); > +const BuiltinType *BTy = Ty->getAs(); > +if (BTy->getKind() != BuiltinType::Float) { > + Res = ImpCastExprToType(Res, Context.FloatTy, > CK_FloatingCast).get(); > +} > } else if (getLangOpts().OpenCL && > - !((getLangOpts().OpenCLVersion >= 120) || > - getOpenCLOptions().cl_khr_fp64)) { > + !(getOpenCLOptions().cl_khr_fp64)) { > +// Impose single-precision float type when cl_khr_fp64 is not > enabled. >Diag(Tok.getLocation(), diag::warn_double_const_requires_fp64); >Res = ImpCastExprToType(Res, Context.FloatTy, CK_FloatingCast).get(); > } > > Modified: cfe/trunk/lib/Sema/SemaType.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=286815&r1=286814&r2=286815&view=diff > == > --- cfe/trunk/lib/Sema/SemaType.cpp (original) > +++ cfe/trunk/lib/Sema/SemaType.cpp Mon Nov 14 05:15:51 2016 > @@ -1402,8 +1402,7 @@ static QualType ConvertDeclSpecToType(Ty > Result = Context.DoubleTy; > >if (S.getLangOpts().OpenCL && > -!((S.getLangOpts().OpenCLVersion >= 120) || > - S.getOpenCLOptions().cl_khr_fp64)) { > +!(S.getOpenCLOptions().cl_khr_fp64)) { > S.Diag(DS.getTypeSpecTypeLoc(), diag::err_type_requires_extension) > << Result << "cl_khr_fp64"; > declarator.setInvalidType(true); > > Modified: cfe/trunk/test/CodeGenOpenCL/fpmath.cl > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/fpmath.cl?rev=286815&r1=286814&r2=286815&view=diff > == > --- cfe/trunk/test/CodeGenOpenCL/fpmath.cl (original) > +++ cfe/trun
Re: [PATCH] D26596: [RFC] Add _LIBCPP_NO_DISCARD and apply it to unique_ptr::release()
On Sun, Nov 13, 2016 at 1:30 PM Eric Fiselier via cfe-commits < cfe-commits@lists.llvm.org> wrote: > EricWF created this revision. > EricWF added reviewers: mclow.lists, chandlerc. > EricWF added a subscriber: cfe-commits. > > The title says it all. > > I just want to check that we agree on the general direction of this patch. > Specifically that libc++ should be free to apply `no_discard` where we feel > appropriate. If we agree then some other candidates are: > > - Containers `empty()` and `size()` methods. > - `try_lock()` functions. > - other `release()` functions. > > Additional suggestions welcome! > What sort of exceptions are there to a broader rule: all const member functions (I suppose there's a few that return discardable results as well as returning useful information via out parameters?) > > This patch fixes PR30898 (https://llvm.org/bugs/show_bug.cgi?id=30898) > > > https://reviews.llvm.org/D26596 > > Files: > include/__config > include/memory > > test/libcxx/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.fail.cpp > > test/libcxx/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/release.fail.cpp > > ___ > 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
[PATCH] D26493: [clang-move] Make the output code look more pretty.
hokein added inline comments. Comment at: clang-move/ClangMove.cpp:280 assert(It < CurrentNamespaces.rend()); - NewCode += "} // namespace " + *It + "\n"; + NewCode += "} // namespace " + *It + "\n\n"; } hokein wrote: > ioeric wrote: > > Wouldn't this create something like: > > ``` > > namespace x { > > namespace y { > > ... > > } // namespace y > >> } // namespace x > > ``` > No. This code is for nested namespace. In your case, there should be a > declaration after `} // namespace y` like: > > ``` > namespace x { > namespace y { > ... > } // namespace y > > int A::f() {} > } // namespace x > ``` Oh, I see your meaning here. This case could be happened if the loop runs multiple times. Looking to it. https://reviews.llvm.org/D26493 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26507: [OpenCL] Change to clk_event parameter in enqueue_kernel
Anastasia closed this revision. Anastasia added a comment. Committed in r286836. https://reviews.llvm.org/D26507 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r286836 - [OpenCL] Change to clk_event parameter in enqueue_kernel.
Author: stulova Date: Mon Nov 14 09:34:01 2016 New Revision: 286836 URL: http://llvm.org/viewvc/llvm-project?rev=286836&view=rev Log: [OpenCL] Change to clk_event parameter in enqueue_kernel. - Accept NULL pointer as a valid parameter value for clk_event. - Generate clk_event_t arguments of internal __enqueue_kernel_XXX function as pointers in generic address space. Review: https://reviews.llvm.org/D26507 Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp cfe/trunk/lib/Sema/SemaChecking.cpp cfe/trunk/test/CodeGenOpenCL/cl20-device-side-enqueue.cl cfe/trunk/test/SemaOpenCL/cl20-device-side-enqueue.cl Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=286836&r1=286835&r2=286836&view=diff == --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original) +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Nov 14 09:34:01 2016 @@ -2538,16 +2538,8 @@ RValue CodeGenFunction::EmitBuiltinExpr( // Any calls now have event arguments passed. if (NumArgs >= 7) { llvm::Type *EventTy = ConvertType(getContext().OCLClkEventTy); - unsigned AS4 = - E->getArg(4)->getType()->isArrayType() - ? E->getArg(4)->getType().getAddressSpace() - : E->getArg(4)->getType()->getPointeeType().getAddressSpace(); - llvm::Type *EventPtrAS4Ty = - EventTy->getPointerTo(CGM.getContext().getTargetAddressSpace(AS4)); - unsigned AS5 = - E->getArg(5)->getType()->getPointeeType().getAddressSpace(); - llvm::Type *EventPtrAS5Ty = - EventTy->getPointerTo(CGM.getContext().getTargetAddressSpace(AS5)); + llvm::Type *EventPtrTy = EventTy->getPointerTo( + CGM.getContext().getTargetAddressSpace(LangAS::opencl_generic)); llvm::Value *NumEvents = EmitScalarExpr(E->getArg(3)); llvm::Value *EventList = @@ -2555,12 +2547,16 @@ RValue CodeGenFunction::EmitBuiltinExpr( ? EmitArrayToPointerDecay(E->getArg(4)).getPointer() : EmitScalarExpr(E->getArg(4)); llvm::Value *ClkEvent = EmitScalarExpr(E->getArg(5)); + // Convert to generic address space. + EventList = Builder.CreatePointerCast(EventList, EventPtrTy); + ClkEvent = Builder.CreatePointerCast(ClkEvent, EventPtrTy); llvm::Value *Block = Builder.CreateBitCast(EmitScalarExpr(E->getArg(6)), Int8PtrTy); - std::vector ArgTys = { - QueueTy, Int32Ty, RangeTy, Int32Ty, - EventPtrAS4Ty, EventPtrAS5Ty, Int8PtrTy}; + std::vector ArgTys = {QueueTy, Int32Ty,RangeTy, + Int32Ty, EventPtrTy, EventPtrTy, + Int8PtrTy}; + std::vector Args = {Queue, Flags,Range, NumEvents, EventList, ClkEvent, Block}; Modified: cfe/trunk/lib/Sema/SemaChecking.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=286836&r1=286835&r2=286836&view=diff == --- cfe/trunk/lib/Sema/SemaChecking.cpp (original) +++ cfe/trunk/lib/Sema/SemaChecking.cpp Mon Nov 14 09:34:01 2016 @@ -451,16 +451,20 @@ static bool SemaOpenCLBuiltinEnqueueKern Expr *Arg4 = TheCall->getArg(4); Expr *Arg5 = TheCall->getArg(5); -// Fith argument is always passed as pointers to clk_event_t. -if (!Arg4->getType()->getPointeeOrArrayElementType()->isClkEventT()) { +// Fifth argument is always passed as a pointer to clk_event_t. +if (!Arg4->isNullPointerConstant(S.Context, + Expr::NPC_ValueDependentIsNotNull) && +!Arg4->getType()->getPointeeOrArrayElementType()->isClkEventT()) { S.Diag(TheCall->getArg(4)->getLocStart(), diag::err_opencl_enqueue_kernel_expected_type) << S.Context.getPointerType(S.Context.OCLClkEventTy); return true; } -// Sixth argument is always passed as pointers to clk_event_t. -if (!(Arg5->getType()->isPointerType() && +// Sixth argument is always passed as a pointer to clk_event_t. +if (!Arg5->isNullPointerConstant(S.Context, + Expr::NPC_ValueDependentIsNotNull) && +!(Arg5->getType()->isPointerType() && Arg5->getType()->getPointeeType()->isClkEventT())) { S.Diag(TheCall->getArg(5)->getLocStart(), diag::err_opencl_enqueue_kernel_expected_type) Modified: cfe/trunk/test/CodeGenOpenCL/cl20-device-side-enqueue.cl URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/cl20-device-side-enqueue.cl?rev=286836&r1=286835&r2=286836&view=diff == --- cfe/trunk/test/CodeGenOpenCL/cl20-device-side-enqueue.cl (original) +++ cfe/trunk/test/CodeGenOpenCL/cl20
[PATCH] D26493: [clang-move] Make the output code look more pretty.
hokein added inline comments. Comment at: clang-move/ClangMove.cpp:280 assert(It < CurrentNamespaces.rend()); - NewCode += "} // namespace " + *It + "\n"; + NewCode += "} // namespace " + *It + "\n\n"; } ioeric wrote: > Wouldn't this create something like: > ``` > namespace x { > namespace y { > ... > } // namespace y >} // namespace x > ``` No. This code is for nested namespace. In your case, there should be a declaration after `} // namespace y` like: ``` namespace x { namespace y { ... } // namespace y int A::f() {} } // namespace x ``` https://reviews.llvm.org/D26493 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26592: [change-namespace] consider typedef/using alias decls in the moved namespace.
ioeric marked an inline comment as done. ioeric added inline comments. Comment at: unittests/change-namespace/ChangeNamespaceTests.cpp:829 "void f() {\n" - " using na::CA;\n" - " CA ca;\n" + " using ::na::C_A;\n" + " C_A ca;\n" hokein wrote: > Any reason to change the existing test case? This was a typo that I found when manually running unit tests (instead of using `check clang-tools-extra`). In the old code, `using na::CA;` does not compile, so I figure I might just fix here as well. https://reviews.llvm.org/D26592 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26592: [change-namespace] consider typedef/using alias decls in the moved namespace.
hokein accepted this revision. hokein added a comment. This revision is now accepted and ready to land. looks good. Comment at: unittests/change-namespace/ChangeNamespaceTests.cpp:829 "void f() {\n" - " using na::CA;\n" - " CA ca;\n" + " using ::na::C_A;\n" + " C_A ca;\n" Any reason to change the existing test case? https://reviews.llvm.org/D26592 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r286835 - Update C++1z status with LWG papers from Issaquah.
Author: marshall Date: Mon Nov 14 09:09:45 2016 New Revision: 286835 URL: http://llvm.org/viewvc/llvm-project?rev=286835&view=rev Log: Update C++1z status with LWG papers from Issaquah. Modified: libcxx/trunk/www/cxx1z_status.html Modified: libcxx/trunk/www/cxx1z_status.html URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=286835&r1=286834&r2=286835&view=diff == --- libcxx/trunk/www/cxx1z_status.html (original) +++ libcxx/trunk/www/cxx1z_status.html Mon Nov 14 09:09:45 2016 @@ -3,7 +3,7 @@ - + libc++ C++1Z Status @@ -97,7 +97,7 @@ http://wg21.link/p0032r3";>p0032r3LWGHomogeneous interface for variant, any and optionalOulu http://wg21.link/p0040r3";>p0040r3LWGExtending memory management toolsOuluComplete4.0 http://wg21.link/p0063r3";>p0063r3LWGC++17 should refer to C11 instead of C99OuluNothing to don/a - http://wg21.link/p0067r3";>p0067r3LWGElementary string conversionsOuluPostponed to Issaquah + http://wg21.link/p0067r3";>p0067r3LWGElementary string conversionsOuluNow http://wg21.link/P0067R5";>P0067R5 http://wg21.link/p0083r3";>p0083r3LWGSplicing Maps and SetsOulu http://wg21.link/p0084r2";>p0084r2LWGEmplace Return TypeOuluComplete4.0 http://wg21.link/p0088r3";>p0088r3LWGVariant: a type-safe union for C++17Oulu @@ -121,6 +121,26 @@ http://wg21.link/p0392r0";>p0392r0LWGAdapting string_view by filesystem pathsOuluComplete4.0 http://wg21.link/p0393r3";>p0393r3LWGMaking Variant Greater EqualOulu http://wg21.link/P0394r4";>P0394r4LWGHotel Parallelifornia: terminate() for Parallel Algorithms Exception HandlingOulu + + http://wg21.link/P0003R5";>P0003R5LWGRemoving Deprecated Exception Specifications from C++17Issaquah + http://wg21.link/P0067R5";>P0067R5LWGElementary string conversions, revision 5Issaquah + http://wg21.link/P0403R1";>P0403R1LWGLiteral suffixes for basic_string_viewIssaquah + http://wg21.link/P0414R2";>P0414R2LWGMerging shared_ptr changes from Library Fundamentals to C++17Issaquah + http://wg21.link/P0418R2";>P0418R2LWGFail or succeed: there is no atomic latticeIssaquah + http://wg21.link/P0426R1";>P0426R1LWGConstexpr for std::char_traitsIssaquah + http://wg21.link/P0435R1";>P0435R1LWGResolving LWG Issues re common_typeIssaquah + http://wg21.link/P0502R0";>P0502R0LWGThrowing out of a parallel algorithm terminates - but how?Issaquah + http://wg21.link/P0503R0";>P0503R0LWGCorrecting library usage of "literal type"Issaquah + http://wg21.link/P0504R0";>P0504R0LWGRevisiting in-place tag types for any/optional/variantIssaquah + http://wg21.link/P0505R0";>P0505R0LWGWording for GB 50 - constexpr for chronoIssaquah + http://wg21.link/P0508R0";>P0508R0LWGWording for GB 58 - structured bindings for node_handlesIssaquah + http://wg21.link/P0509R1";>P0509R1LWGUpdating âRestrictions on exception handlingâIssaquah + http://wg21.link/P0510R0";>P0510R0LWGDisallowing references, incomplete types, arrays, and empty variantsIssaquah + http://wg21.link/P0513R0";>P0513R0LWGPoisoning the HashIssaquah + http://wg21.link/P0516R0";>P0516R0LWGClarify That shared_futureâs Copy Operations have Wide ContractsIssaquah + http://wg21.link/P0517R0";>P0517R0LWGMake future_error ConstructibleIssaquah + http://wg21.link/P0521R0";>P0521R0LWGProposed Resolution for CA 14 (shared_ptr use_count/unique)Issaquah + @@ -378,7 +398,7 @@ http://wg21.link/LWG2749";>2749swappable traits for variantsIssaquah http://wg21.link/LWG2750";>2750[fund.ts.v2] LWG 2451 conversion constructor constraintIssaquah http://wg21.link/LWG2752";>2752"Throws:" clauses of async and packaged_task are unimplementableIssaquah - http://wg21.link/LWG2755";>2755§[string.view.io] uses non-existent basic_string_view::to_string functionIssaquahComplete + http://wg21.link/LWG2755";>2755[string.view.io] uses non-existent basic_string_view::to_string functionIssaquahComplete http://wg21.link/LWG2756";>2756C++ WP optional should 'forward' T's implicit conversionsIssaquahComplete http://wg21.link/LWG2758";>2758std::string{}.assign("ABCDE", 0, 1) is ambiguousComplete http://wg21.link/LWG2759";>2759gcd / lcm and bool for the WPIssaquahPatch ready ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26509: [OpenCL] Fix integer parameters of enqueue_kernel
yaxunl accepted this revision. yaxunl added a comment. This revision is now accepted and ready to land. LGTM with the change for the summary. Thanks! https://reviews.llvm.org/D26509 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26612: Protect std::string tests under libcpp-no-exceptions
rogfer01 created this revision. rogfer01 added reviewers: EricWF, mclow.lists, rmaprath. rogfer01 added a subscriber: cfe-commits. Skip tests that expect an exception be thrown and/or disable unreachable catch handlers. https://reviews.llvm.org/D26612 Files: test/std/strings/basic.string/string.capacity/capacity.pass.cpp test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp Index: test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp === --- test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp +++ test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp @@ -7,7 +7,6 @@ // //===--===// -// XFAIL: libcpp-no-exceptions // // basic_string substr(size_type pos = 0, size_type n = npos) const; @@ -24,19 +23,27 @@ void test(const S& s, typename S::size_type pos, typename S::size_type n) { +#ifndef TEST_HAS_NO_EXCEPTIONS try +#else +if (pos <= s.size()) +#endif { S str = s.substr(pos, n); LIBCPP_ASSERT(str.__invariants()); +#ifndef TEST_HAS_NO_EXCEPTIONS assert(pos <= s.size()); +#endif typename S::size_type rlen = std::min(n, s.size() - pos); assert(str.size() == rlen); assert(S::traits_type::compare(s.data()+pos, str.data(), rlen) == 0); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (std::out_of_range&) { assert(pos > s.size()); } +#endif } int main() Index: test/std/strings/basic.string/string.capacity/capacity.pass.cpp === --- test/std/strings/basic.string/string.capacity/capacity.pass.cpp +++ test/std/strings/basic.string/string.capacity/capacity.pass.cpp @@ -7,7 +7,6 @@ // //===--===// -// XFAIL: libcpp-no-exceptions // // size_type capacity() const; @@ -18,21 +17,27 @@ #include "test_allocator.h" #include "min_allocator.h" +#include "test_macros.h" + template void test(S s) { S::allocator_type::throw_after = 0; +#ifndef TEST_HAS_NO_EXCEPTIONS try +#endif { while (s.size() < s.capacity()) s.push_back(typename S::value_type()); assert(s.size() == s.capacity()); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (...) { assert(false); } +#endif S::allocator_type::throw_after = INT_MAX; } Index: test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp === --- test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp +++ test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp @@ -7,7 +7,6 @@ // //===--===// -// XFAIL: libcpp-no-exceptions // // basic_string substr(size_type pos = 0, size_type n = npos) const; @@ -24,19 +23,27 @@ void test(const S& s, typename S::size_type pos, typename S::size_type n) { +#ifndef TEST_HAS_NO_EXCEPTIONS try +#else +if (pos <= s.size()) +#endif { S str = s.substr(pos, n); LIBCPP_ASSERT(str.__invariants()); +#ifndef TEST_HAS_NO_EXCEPTIONS assert(pos <= s.size()); +#endif typename S::size_type rlen = std::min(n, s.size() - pos); assert(str.size() == rlen); assert(S::traits_type::compare(s.data()+pos, str.data(), rlen) == 0); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (std::out_of_range&) { assert(pos > s.size()); } +#endif } int main() Index: test/std/strings/basic.string/string.capacity/capacity.pass.cpp === --- test/std/strings/basic.string/string.capacity/capacity.pass.cpp +++ test/std/strings/basic.string/string.capacity/capacity.pass.cpp @@ -7,7 +7,6 @@ // //===--===// -// XFAIL: libcpp-no-exceptions // // size_type capacity() const; @@ -18,21 +17,27 @@ #include "test_allocator.h" #include "min_allocator.h" +#include "test_macros.h" + template void test(S s) { S::allocator_type::throw_after = 0; +#ifndef TEST_HAS_NO_EXCEPTIONS try +#endif { while (s.size() < s.capacity()) s.push_back(typename S::value_type()); assert(s.size() == s.capacity()); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (...) { assert(false); } +#endif S::allocator_type::throw_after = INT_MAX; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits