[PATCH] D49718: [CodeGen][ObjC] Make block copy/dispose helper function exception-safe.
ahatanak added a comment. Note that in order to destruct C++ objects, I'm using pushDestroy which pushes a NormalCleanup when exception handling isn't enabled. This is different from PushDestructorCleanup which always pushes a NormalAndEHCleanup, but I think using pushDestroy is more correct since I don't think we need to do a cleanup on the EH path when exception isn't enabled. Repository: rC Clang https://reviews.llvm.org/D49718 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49718: [CodeGen][ObjC] Make block copy/dispose helper function exception-safe.
ahatanak created this revision. ahatanak added a reviewer: rjmccall. Herald added a subscriber: dexonsmith. Block copy/dispose helper functions currently aren’t exception-safe. When an exception is thrown in a copy function, the function exits without destroying or releasing C++ objects, ObjC objects, and `__block` objects that have already been copied. Similarly, dispose functions don't release ObjC objects and `__block objects` that are yet to be released when an exception is thrown. Repository: rC Clang https://reviews.llvm.org/D49718 Files: lib/CodeGen/CGBlocks.cpp test/CodeGenObjCXX/arc-blocks.mm Index: test/CodeGenObjCXX/arc-blocks.mm === --- test/CodeGenObjCXX/arc-blocks.mm +++ test/CodeGenObjCXX/arc-blocks.mm @@ -1,6 +1,9 @@ -// RUN: %clang_cc1 -std=gnu++98 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-runtime-has-weak -fblocks -fobjc-arc -o - %s | FileCheck %s +// RUN: %clang_cc1 -std=gnu++98 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-runtime-has-weak -fblocks -fobjc-arc -fexceptions -fobjc-arc-exceptions -o - %s | FileCheck -check-prefix CHECK %s +// RUN: %clang_cc1 -std=gnu++98 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-runtime-has-weak -fblocks -fobjc-arc -fexceptions -fobjc-arc-exceptions -O1 -o - %s | FileCheck -check-prefix CHECK-O1 %s // CHECK: [[A:.*]] = type { i64, [10 x i8*] } +// CHECK: %[[STRUCT_TEST1_S0:.*]] = type { i32 } +// CHECK: %[[STRUCT_BLOCK_DESCRIPTOR:.*]] = type { i64, i64 } // CHECK: [[LAYOUT0:@.*]] = private unnamed_addr constant [3 x i8] c" 9\00" @@ -47,3 +50,133 @@ // CHECK-NEXT: call void @_ZN5test01AD1Ev([[A]]* [[T1]]) // CHECK-NEXT: ret void } + +namespace test1 { + +// Check that copy/dispose helper functions are exception safe. + +// CHECK-LABEL: define internal void @__copy_helper_block_( +// CHECK: %[[BLOCK_SOURCE:.*]] = bitcast i8* %{{.*}} to <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8*, i8*, %[[STRUCT_TEST1_S0]], %[[STRUCT_TEST1_S0]] }>* +// CHECK: %[[BLOCK_DEST:.*]] = bitcast i8* %{{.*}} to <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8*, i8*, %[[STRUCT_TEST1_S0]], %[[STRUCT_TEST1_S0]] }>* + +// CHECK: %[[V4:.*]] = getelementptr inbounds <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8*, i8*, %[[STRUCT_TEST1_S0]], %[[STRUCT_TEST1_S0]] }>, <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8*, i8*, %[[STRUCT_TEST1_S0]], %[[STRUCT_TEST1_S0]] }>* %[[BLOCK_SOURCE]], i32 0, i32 6 +// CHECK: %[[V5:.*]] = getelementptr inbounds <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8*, i8*, %[[STRUCT_TEST1_S0]], %[[STRUCT_TEST1_S0]] }>, <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8*, i8*, %[[STRUCT_TEST1_S0]], %[[STRUCT_TEST1_S0]] }>* %[[BLOCK_DEST]], i32 0, i32 6 +// CHECK: %[[BLOCKCOPY_SRC:.*]] = load i8*, i8** %[[V4]], align 8 +// CHECK: %[[V6:.*]] = bitcast i8** %[[V5]] to i8* +// CHECK: call void @_Block_object_assign(i8* %[[V6]], i8* %[[BLOCKCOPY_SRC]], i32 8) + +// CHECK: %[[V7:.*]] = getelementptr inbounds <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8*, i8*, %[[STRUCT_TEST1_S0]], %[[STRUCT_TEST1_S0]] }>, <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8*, i8*, %[[STRUCT_TEST1_S0]], %[[STRUCT_TEST1_S0]] }>* %[[BLOCK_SOURCE]], i32 0, i32 7 +// CHECK: %[[V8:.*]] = getelementptr inbounds <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8*, i8*, %[[STRUCT_TEST1_S0]], %[[STRUCT_TEST1_S0]] }>, <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8*, i8*, %[[STRUCT_TEST1_S0]], %[[STRUCT_TEST1_S0]] }>* %[[BLOCK_DEST]], i32 0, i32 7 +// CHECK: call void @objc_copyWeak(i8** %[[V8]], i8** %[[V7]]) + +// CHECK: %[[V9:.*]] = getelementptr inbounds <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8*, i8*, %[[STRUCT_TEST1_S0]], %[[STRUCT_TEST1_S0]] }>, <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8*, i8*, %[[STRUCT_TEST1_S0]], %[[STRUCT_TEST1_S0]] }>* %[[BLOCK_SOURCE]], i32 0, i32 5 +// CHECK: %[[V10:.*]] = getelementptr inbounds <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8*, i8*, %[[STRUCT_TEST1_S0]], %[[STRUCT_TEST1_S0]] }>, <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8*, i8*, %[[STRUCT_TEST1_S0]], %[[STRUCT_TEST1_S0]] }>* %[[BLOCK_DEST]], i32 0, i32 5 +// CHECK: %[[BLOCKCOPY_SRC2:.*]] = load i8*, i8** %[[V9]], align 8 +// CHECK: store i8* null, i8** %[[V10]], align 8 +// CHECK: call void @objc_storeStrong(i8** %[[V10]], i8* %[[BLOCKCOPY_SRC2]]) + +// CHECK: %[[V11:.*]] = getelementptr inbounds <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8*, i8*, %[[STRUCT_TEST1_S0]], %[[STRUCT_TEST1_S0]] }>, <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8*, i8*, %[[STRUCT_TEST1_S0]], %[[STRUCT_TEST1_S0]] }>* %[[BLOCK_SOURCE]], i32 0, i32 8 +// CHECK: %[[V12:.*]] = getelementptr inbounds <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8*, i8*, %[[STRUCT_TEST1_S0]],
[libcxx] r337809 - fix nesting of namespace and standard-version check. Also include <__config>
Author: marshall Date: Mon Jul 23 20:56:38 2018 New Revision: 337809 URL: http://llvm.org/viewvc/llvm-project?rev=337809=rev Log: fix nesting of namespace and standard-version check. Also include <__config> Modified: libcxx/trunk/include/span Modified: libcxx/trunk/include/span URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/span?rev=337809=337808=337809=diff == --- libcxx/trunk/include/span (original) +++ libcxx/trunk/include/span Mon Jul 23 20:56:38 2018 @@ -140,6 +140,7 @@ template */ +#include <__config> #include // for ptrdiff_t #include // for iterators #include // for array @@ -600,7 +601,8 @@ template template span(const _Container&) -> span; +#endif // _LIBCPP_STD_VER > 17 + _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 #endif // _LIBCPP_SPAN ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49711: [CMake] Fix the setting of LIBCXX_HEADER_DIR in standalone build
ldionne added a comment. LGTM. FWIW, I'm really not a huge fan of all these different ways of building libc++. There should be one canonical way of doing it, and it should be simple. However, it seems like this patch is the right thing to do given the changes that have already been made to account for specific use cases. IOW, I don't like this whole trend, but we're already down that road. Repository: rCXX libc++ https://reviews.llvm.org/D49711 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337808 - Disable 'suggest braces' warnings for std::array in tests
Author: marshall Date: Mon Jul 23 20:41:36 2018 New Revision: 337808 URL: http://llvm.org/viewvc/llvm-project?rev=337808=rev Log: Disable 'suggest braces' warnings for std::array in tests Modified: libcxx/trunk/test/std/containers/views/span.cons/deduct.pass.cpp libcxx/trunk/test/std/containers/views/span.cons/stdarray.pass.cpp Modified: libcxx/trunk/test/std/containers/views/span.cons/deduct.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/views/span.cons/deduct.pass.cpp?rev=337808=337807=337808=diff == --- libcxx/trunk/test/std/containers/views/span.cons/deduct.pass.cpp (original) +++ libcxx/trunk/test/std/containers/views/span.cons/deduct.pass.cpp Mon Jul 23 20:41:36 2018 @@ -37,6 +37,10 @@ #include "test_macros.h" +// std::array is explicitly allowed to be initialized with A a = { init-list };. +// Disable the missing braces warning for this reason. +#include "disable_missing_braces_warning.h" + int main () { { Modified: libcxx/trunk/test/std/containers/views/span.cons/stdarray.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/views/span.cons/stdarray.pass.cpp?rev=337808=337807=337808=diff == --- libcxx/trunk/test/std/containers/views/span.cons/stdarray.pass.cpp (original) +++ libcxx/trunk/test/std/containers/views/span.cons/stdarray.pass.cpp Mon Jul 23 20:41:36 2018 @@ -27,6 +27,9 @@ #include #include "test_macros.h" +// std::array is explicitly allowed to be initialized with A a = { init-list };. +// Disable the missing braces warning for this reason. +#include "disable_missing_braces_warning.h" void checkCV() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49715: [analyzer] CallEvent: Add partially working methods for obtaining the callee stack frame.
NoQ created this revision. NoQ added reviewers: dcoughlin, xazax.hun, a.sidorin, george.karpenkov, szepet, rnkovacs. Herald added subscribers: cfe-commits, mikhail.ramalho, baloghadamsoftware. These methods allow reasoning about the stack frame that will be (or was) used when the function will be (or was) inlined, even if it will not be (or was not) inlined. They are implemented in a fairly ugly manner, and while i plan to address some of the issues in follow-up patches (at least, do something about virtual calls), i don't think it'll work perfectly soon. A proper implementation would require a large amount of refactoring for `Call::getDecl()` and `Call::getRuntimeDefinition()` and the logic in `ExprEngine`'s call modeling and i didn't accomplish much in a couple days of working on it, so i'm putting a proper implementation on hold for now, safely returning `nullptr` when the proper `Decl` cannot be reliably obtained. This was ultimately necessary to obtain the parameter regions on the future stack frame for the purposes of https://reviews.llvm.org/D49443. We don't need this function to be perfect because a lot of other things are imperfect and we're fine with falling back to a conservative behavior. Repository: rC Clang https://reviews.llvm.org/D49715 Files: include/clang/Analysis/ConstructionContext.h include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h lib/StaticAnalyzer/Core/CallEvent.cpp Index: lib/StaticAnalyzer/Core/CallEvent.cpp === --- lib/StaticAnalyzer/Core/CallEvent.cpp +++ lib/StaticAnalyzer/Core/CallEvent.cpp @@ -27,6 +27,7 @@ #include "clang/AST/Type.h" #include "clang/Analysis/AnalysisDeclContext.h" #include "clang/Analysis/CFG.h" +#include "clang/Analysis/CFGStmtMap.h" #include "clang/Analysis/ProgramPoint.h" #include "clang/CrossTU/CrossTranslationUnit.h" #include "clang/Basic/IdentifierTable.h" @@ -166,6 +167,67 @@ return CheckerContext::isCLibraryFunction(FD, FunctionName); } +AnalysisDeclContext *CallEvent::getCalleeAnalysisDeclContext() const { + const Decl *D = getDecl(); + + // If the callee is completely unknown, we cannot construct the stack frame. + if (!D) +return nullptr; + + // FIXME: Skip virtual functions for now. There's no easy procedure to foresee + // the exact decl that should be used, especially when it's not a definition. + if (const Decl *RD = getRuntimeDefinition().getDecl()) +if (RD != D) + return nullptr; + + return LCtx->getAnalysisDeclContext()->getManager()->getContext(D); +} + +const StackFrameContext *CallEvent::getCalleeStackFrame() const { + AnalysisDeclContext *ADC = getCalleeAnalysisDeclContext(); + // We cannot construct a stack frame without an ADC. + if (!ADC) +return nullptr; + + const Expr *E = getOriginExpr(); + // We cannot lookup a CFG element without an origin-expression. + if (!E) +return nullptr; + + // Recover CFG block via reverse lookup. Maybe it should just be a part of the + // CallEvent object? That would have been convenient. + CFGStmtMap *Map = LCtx->getAnalysisDeclContext()->getCFGStmtMap(); + const CFGBlock *B = Map->getBlock(E); + assert(B); + + // Also recover CFG index by scanning the CFG block. + unsigned Idx = 0, Sz = B->size(); + for (; Idx < Sz; ++Idx) +if (auto StmtElem = (*B)[Idx].getAs()) + if (StmtElem->getStmt() == E) +break; + assert(Idx < Sz); + + return ADC->getManager()->getStackFrame(ADC, LCtx, E, B, Idx); +} + +const VarRegion *CallEvent::getParameterLocation(unsigned Index) const { + const StackFrameContext *SFC = getCalleeStackFrame(); + // We cannot construct a VarRegion without a stack frame. + if (!SFC) +return nullptr; + + const ParmVarDecl *PVD = parameters()[Index]; + const VarRegion *VR = + State->getStateManager().getRegionManager().getVarRegion(PVD, SFC); + + // This sanity check would fail if our parameter declaration doesn't + // correspond to the stack frame's function declaration. + assert(VR->getStackFrame() == SFC); + + return VR; +} + /// Returns true if a type is a pointer-to-const or reference-to-const /// with no further indirection. static bool isPointerToConst(QualType Ty) { Index: include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h === --- include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h +++ include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h @@ -773,13 +773,15 @@ const ConstructionContextItem , const LocationContext *LC); +public: /// If the given statement corresponds to an object under construction, /// being part of its construciton context, retrieve that object's location. static Optional getObjectUnderConstruction(ProgramStateRef State, const
r337797 - Attempt to fix regression due to r337791
Author: yaxunl Date: Mon Jul 23 19:12:24 2018 New Revision: 337797 URL: http://llvm.org/viewvc/llvm-project?rev=337797=rev Log: Attempt to fix regression due to r337791 Modified: cfe/trunk/test/Driver/hip-toolchain.hip Modified: cfe/trunk/test/Driver/hip-toolchain.hip URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/hip-toolchain.hip?rev=337797=337796=337797=diff == --- cfe/trunk/test/Driver/hip-toolchain.hip (original) +++ cfe/trunk/test/Driver/hip-toolchain.hip Mon Jul 23 19:12:24 2018 @@ -80,5 +80,5 @@ // CHECK-SAME: "-targets={{.*}},hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900" // CHECK-SAME: "-inputs={{.*}},[[IMG_DEV1]],[[IMG_DEV2]]" "-outputs=[[BUNDLE:.*o]]" -// CHECK: [[LD:".*ld.lld"]] {{.*}} [[A_OBJ_HOST]] [[B_OBJ_HOST]] +// CHECK: [[LD:".*ld.*"]] {{.*}} [[A_OBJ_HOST]] [[B_OBJ_HOST]] // CHECK-SAME: {{.*}} "-T" "{{.*}}.lk" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r337796 - Fix unused variable warnings; NFC
Author: gbiv Date: Mon Jul 23 19:10:53 2018 New Revision: 337796 URL: http://llvm.org/viewvc/llvm-project?rev=337796=rev Log: Fix unused variable warnings; NFC Looks like MTE was previously used for its SourceLoc, but we're now using a seperate SourceLocation here. Modified: cfe/trunk/lib/Sema/SemaInit.cpp Modified: cfe/trunk/lib/Sema/SemaInit.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=337796=337795=337796=diff == --- cfe/trunk/lib/Sema/SemaInit.cpp (original) +++ cfe/trunk/lib/Sema/SemaInit.cpp Mon Jul 23 19:10:53 2018 @@ -6774,7 +6774,7 @@ void Sema::checkInitializerLifetime(cons } case LK_MemInitializer: { - if (auto *MTE = dyn_cast(L)) { + if (isa(L)) { // Under C++ DR1696, if a mem-initializer (or a default member // initializer used by the absence of one) would lifetime-extend a // temporary, the program is ill-formed. @@ -6833,7 +6833,7 @@ void Sema::checkInitializerLifetime(cons } case LK_New: - if (auto *MTE = dyn_cast(L)) { + if (isa(L)) { Diag(DiagLoc, RK == RK_ReferenceBinding ? diag::warn_new_dangling_reference : diag::warn_new_dangling_initializer_list) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49711: [CMake] Fix the setting of LIBCXX_HEADER_DIR in standalone build
phosek added a comment. I've tested this on macOS and everything seems to be working, Repository: rCXX libc++ https://reviews.llvm.org/D49711 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r337788 - Borrow visibility from __fundamental_type_info for generated fundamental type infos
Author: thomasanderson Date: Mon Jul 23 17:43:47 2018 New Revision: 337788 URL: http://llvm.org/viewvc/llvm-project?rev=337788=rev Log: Borrow visibility from __fundamental_type_info for generated fundamental type infos This is necessary so the clang gives hidden visibility to fundamental types when -fvisibility=hidden is passed. Fixes https://bugs.llvm.org/show_bug.cgi?id=35066 Differential Revision: https://reviews.llvm.org/D49109 Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp cfe/trunk/test/CodeGenCXX/rtti-fundamental.cpp Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=337788=337787=337788=diff == --- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original) +++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Mon Jul 23 17:43:47 2018 @@ -31,6 +31,7 @@ #include "clang/AST/StmtCXX.h" #include "llvm/IR/CallSite.h" #include "llvm/IR/DataLayout.h" +#include "llvm/IR/GlobalValue.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Intrinsics.h" #include "llvm/IR/Value.h" @@ -181,8 +182,7 @@ public: emitTerminateForUnexpectedException(CodeGenFunction , llvm::Value *Exn) override; - void EmitFundamentalRTTIDescriptor(QualType Type, bool DLLExport); - void EmitFundamentalRTTIDescriptors(bool DLLExport); + void EmitFundamentalRTTIDescriptors(const CXXRecordDecl *RD); llvm::Constant *getAddrOfRTTIDescriptor(QualType Ty) override; CatchTypeInfo getAddrOfCXXCatchHandlerType(QualType Ty, @@ -1613,7 +1613,7 @@ void ItaniumCXXABI::emitVTableDefinition isa(DC) && cast(DC)->getIdentifier() && cast(DC)->getIdentifier()->isStr("__cxxabiv1") && DC->getParent()->isTranslationUnit()) -EmitFundamentalRTTIDescriptors(RD->hasAttr()); +EmitFundamentalRTTIDescriptors(RD); if (!VTable->isDeclarationForLinker()) CGM.EmitVTableTypeMetadata(VTable, VTLayout); @@ -2698,12 +2698,16 @@ public: BCTI_Public = 0x2 }; + /// BuildTypeInfo - Build the RTTI type info struct for the given type, or + /// link to an existing RTTI descriptor if one already exists. + llvm::Constant *BuildTypeInfo(QualType Ty); + /// BuildTypeInfo - Build the RTTI type info struct for the given type. - /// - /// \param Force - true to force the creation of this RTTI value - /// \param DLLExport - true to mark the RTTI value as DLLExport - llvm::Constant *BuildTypeInfo(QualType Ty, bool Force = false, -bool DLLExport = false); + llvm::Constant *BuildTypeInfo( + QualType Ty, + llvm::GlobalVariable::LinkageTypes Linkage, + llvm::GlobalValue::VisibilityTypes Visibility, + llvm::GlobalValue::DLLStorageClassTypes DLLStorageClass); }; } @@ -3172,8 +3176,7 @@ static llvm::GlobalVariable::LinkageType llvm_unreachable("Invalid linkage!"); } -llvm::Constant *ItaniumRTTIBuilder::BuildTypeInfo(QualType Ty, bool Force, - bool DLLExport) { +llvm::Constant *ItaniumRTTIBuilder::BuildTypeInfo(QualType Ty) { // We want to operate on the canonical type. Ty = Ty.getCanonicalType(); @@ -3191,17 +3194,41 @@ llvm::Constant *ItaniumRTTIBuilder::Buil } // Check if there is already an external RTTI descriptor for this type. - bool IsStdLib = IsStandardLibraryRTTIDescriptor(Ty); - if (!Force && (IsStdLib || ShouldUseExternalRTTIDescriptor(CGM, Ty))) + if (IsStandardLibraryRTTIDescriptor(Ty) || + ShouldUseExternalRTTIDescriptor(CGM, Ty)) return GetAddrOfExternalRTTIDescriptor(Ty); // Emit the standard library with external linkage. - llvm::GlobalVariable::LinkageTypes Linkage; - if (IsStdLib) -Linkage = llvm::GlobalValue::ExternalLinkage; + llvm::GlobalVariable::LinkageTypes Linkage = getTypeInfoLinkage(CGM, Ty); + + // Give the type_info object and name the formal visibility of the + // type itself. + llvm::GlobalValue::VisibilityTypes llvmVisibility; + if (llvm::GlobalValue::isLocalLinkage(Linkage)) +// If the linkage is local, only default visibility makes sense. +llvmVisibility = llvm::GlobalValue::DefaultVisibility; + else if (CXXABI.classifyRTTIUniqueness(Ty, Linkage) == + ItaniumCXXABI::RUK_NonUniqueHidden) +llvmVisibility = llvm::GlobalValue::HiddenVisibility; else -Linkage = getTypeInfoLinkage(CGM, Ty); +llvmVisibility = CodeGenModule::GetLLVMVisibility(Ty->getVisibility()); + + llvm::GlobalValue::DLLStorageClassTypes DLLStorageClass = + llvm::GlobalValue::DefaultStorageClass; + if (CGM.getTriple().isWindowsItaniumEnvironment()) { +auto RD = Ty->getAsCXXRecordDecl(); +if (RD && RD->hasAttr()) + DLLStorageClass = llvm::GlobalValue::DLLExportStorageClass; + } + return BuildTypeInfo(Ty, Linkage, llvmVisibility, DLLStorageClass); +} + +llvm::Constant *ItaniumRTTIBuilder::BuildTypeInfo( +
[PATCH] D49643: [HIP] pass `-target-cpu` when running the device-mode compiler
This revision was automatically updated to reflect the committed changes. Closed by commit rC337793: [HIP] pass -target-cpu when running the device-mode compiler (authored by yaxunl, committed by ). Changed prior to commit: https://reviews.llvm.org/D49643?vs=156699=156953#toc Repository: rC Clang https://reviews.llvm.org/D49643 Files: lib/Driver/ToolChains/HIP.cpp test/Driver/hip-toolchain.hip Index: lib/Driver/ToolChains/HIP.cpp === --- lib/Driver/ToolChains/HIP.cpp +++ lib/Driver/ToolChains/HIP.cpp @@ -232,6 +232,8 @@ assert(DeviceOffloadingKind == Action::OFK_HIP && "Only HIP offloading kinds are supported for GPUs."); + CC1Args.push_back("-target-cpu"); + CC1Args.push_back(DriverArgs.MakeArgStringRef(GpuArch)); CC1Args.push_back("-fcuda-is-device"); if (DriverArgs.hasFlag(options::OPT_fcuda_flush_denormals_to_zero, Index: test/Driver/hip-toolchain.hip === --- test/Driver/hip-toolchain.hip +++ test/Driver/hip-toolchain.hip @@ -14,14 +14,14 @@ // CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa" // CHECK-SAME: "-aux-triple" "x86_64--linux-gnu" "-emit-llvm-bc" -// CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-fcuda-is-device" -// CHECK-SAME: {{.*}} "-o" [[A_BC:".*bc"]] "-x" "hip" +// CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803" +// CHECK-SAME: "-fcuda-is-device" {{.*}} "-o" [[A_BC:".*bc"]] "-x" "hip" // CHECK-SAME: {{.*}} [[A_SRC:".*a.cu"]] // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" // CHECK-SAME: "-aux-triple" "x86_64--linux-gnu" "-emit-llvm-bc" -// CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-fcuda-is-device" -// CHECK-SAME: {{.*}} "-o" [[B_BC:".*bc"]] "-x" "hip" +// CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803" +// CHECK-SAME: "-fcuda-is-device" {{.*}} "-o" [[B_BC:".*bc"]] "-x" "hip" // CHECK-SAME: {{.*}} [[B_SRC:".*b.hip"]] // CHECK: [[LLVM_LINK:"*.llvm-link"]] [[A_BC]] [[B_BC]] @@ -40,14 +40,14 @@ // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" // CHECK-SAME: "-aux-triple" "x86_64--linux-gnu" "-emit-llvm-bc" -// CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-fcuda-is-device" -// CHECK-SAME: {{.*}} "-o" [[A_BC:".*bc"]] "-x" "hip" +// CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx900" +// CHECK-SAME: "-fcuda-is-device" {{.*}} "-o" [[A_BC:".*bc"]] "-x" "hip" // CHECK-SAME: {{.*}} [[A_SRC]] // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" // CHECK-SAME: "-aux-triple" "x86_64--linux-gnu" "-emit-llvm-bc" -// CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-fcuda-is-device" -// CHECK-SAME: {{.*}} "-o" [[B_BC:".*bc"]] "-x" "hip" +// CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx900" +// CHECK-SAME: "-fcuda-is-device" {{.*}} "-o" [[B_BC:".*bc"]] "-x" "hip" // CHECK-SAME: {{.*}} [[B_SRC]] // CHECK: [[LLVM_LINK]] [[A_BC]] [[B_BC]] Index: lib/Driver/ToolChains/HIP.cpp === --- lib/Driver/ToolChains/HIP.cpp +++ lib/Driver/ToolChains/HIP.cpp @@ -232,6 +232,8 @@ assert(DeviceOffloadingKind == Action::OFK_HIP && "Only HIP offloading kinds are supported for GPUs."); + CC1Args.push_back("-target-cpu"); + CC1Args.push_back(DriverArgs.MakeArgStringRef(GpuArch)); CC1Args.push_back("-fcuda-is-device"); if (DriverArgs.hasFlag(options::OPT_fcuda_flush_denormals_to_zero, Index: test/Driver/hip-toolchain.hip === --- test/Driver/hip-toolchain.hip +++ test/Driver/hip-toolchain.hip @@ -14,14 +14,14 @@ // CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa" // CHECK-SAME: "-aux-triple" "x86_64--linux-gnu" "-emit-llvm-bc" -// CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-fcuda-is-device" -// CHECK-SAME: {{.*}} "-o" [[A_BC:".*bc"]] "-x" "hip" +// CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803" +// CHECK-SAME: "-fcuda-is-device" {{.*}} "-o" [[A_BC:".*bc"]] "-x" "hip" // CHECK-SAME: {{.*}} [[A_SRC:".*a.cu"]] // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" // CHECK-SAME: "-aux-triple" "x86_64--linux-gnu" "-emit-llvm-bc" -// CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-fcuda-is-device" -// CHECK-SAME: {{.*}} "-o" [[B_BC:".*bc"]] "-x" "hip" +// CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803" +// CHECK-SAME: "-fcuda-is-device" {{.*}} "-o" [[B_BC:".*bc"]] "-x" "hip" // CHECK-SAME: {{.*}} [[B_SRC:".*b.hip"]] // CHECK: [[LLVM_LINK:"*.llvm-link"]] [[A_BC]] [[B_BC]] @@ -40,14 +40,14 @@ // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" // CHECK-SAME: "-aux-triple" "x86_64--linux-gnu" "-emit-llvm-bc" -// CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-fcuda-is-device" -// CHECK-SAME: {{.*}} "-o"
r337793 - [HIP] pass -target-cpu when running the device-mode compiler
Author: yaxunl Date: Mon Jul 23 18:40:44 2018 New Revision: 337793 URL: http://llvm.org/viewvc/llvm-project?rev=337793=rev Log: [HIP] pass -target-cpu when running the device-mode compiler Differential Revision: https://reviews.llvm.org/D49643 Modified: cfe/trunk/lib/Driver/ToolChains/HIP.cpp cfe/trunk/test/Driver/hip-toolchain.hip Modified: cfe/trunk/lib/Driver/ToolChains/HIP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/HIP.cpp?rev=337793=337792=337793=diff == --- cfe/trunk/lib/Driver/ToolChains/HIP.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/HIP.cpp Mon Jul 23 18:40:44 2018 @@ -232,6 +232,8 @@ void HIPToolChain::addClangTargetOptions assert(DeviceOffloadingKind == Action::OFK_HIP && "Only HIP offloading kinds are supported for GPUs."); + CC1Args.push_back("-target-cpu"); + CC1Args.push_back(DriverArgs.MakeArgStringRef(GpuArch)); CC1Args.push_back("-fcuda-is-device"); if (DriverArgs.hasFlag(options::OPT_fcuda_flush_denormals_to_zero, Modified: cfe/trunk/test/Driver/hip-toolchain.hip URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/hip-toolchain.hip?rev=337793=337792=337793=diff == --- cfe/trunk/test/Driver/hip-toolchain.hip (original) +++ cfe/trunk/test/Driver/hip-toolchain.hip Mon Jul 23 18:40:44 2018 @@ -14,14 +14,14 @@ // CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa" // CHECK-SAME: "-aux-triple" "x86_64--linux-gnu" "-emit-llvm-bc" -// CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-fcuda-is-device" -// CHECK-SAME: {{.*}} "-o" [[A_BC:".*bc"]] "-x" "hip" +// CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803" +// CHECK-SAME: "-fcuda-is-device" {{.*}} "-o" [[A_BC:".*bc"]] "-x" "hip" // CHECK-SAME: {{.*}} [[A_SRC:".*a.cu"]] // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" // CHECK-SAME: "-aux-triple" "x86_64--linux-gnu" "-emit-llvm-bc" -// CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-fcuda-is-device" -// CHECK-SAME: {{.*}} "-o" [[B_BC:".*bc"]] "-x" "hip" +// CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803" +// CHECK-SAME: "-fcuda-is-device" {{.*}} "-o" [[B_BC:".*bc"]] "-x" "hip" // CHECK-SAME: {{.*}} [[B_SRC:".*b.hip"]] // CHECK: [[LLVM_LINK:"*.llvm-link"]] [[A_BC]] [[B_BC]] @@ -40,14 +40,14 @@ // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" // CHECK-SAME: "-aux-triple" "x86_64--linux-gnu" "-emit-llvm-bc" -// CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-fcuda-is-device" -// CHECK-SAME: {{.*}} "-o" [[A_BC:".*bc"]] "-x" "hip" +// CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx900" +// CHECK-SAME: "-fcuda-is-device" {{.*}} "-o" [[A_BC:".*bc"]] "-x" "hip" // CHECK-SAME: {{.*}} [[A_SRC]] // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" // CHECK-SAME: "-aux-triple" "x86_64--linux-gnu" "-emit-llvm-bc" -// CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-fcuda-is-device" -// CHECK-SAME: {{.*}} "-o" [[B_BC:".*bc"]] "-x" "hip" +// CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx900" +// CHECK-SAME: "-fcuda-is-device" {{.*}} "-o" [[B_BC:".*bc"]] "-x" "hip" // CHECK-SAME: {{.*}} [[B_SRC]] // CHECK: [[LLVM_LINK]] [[A_BC]] [[B_BC]] ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r337727 - [CMake] Fix the setting of LIBCXX_HEADER_DIR
Sorry, and thanks! On Mon, Jul 23, 2018 at 5:32 PM Alex L wrote: > The revert commit is r337782. > > On 23 July 2018 at 17:32, Alex L wrote: > >> Hi, >> >> I had to revert your commit as it caused a number of failures in our >> public and internal CI. >> When building compiler-rt on Darwin (stage1), after this commit the build >> failed to build X-ray and libfuzzer because the libc++ headers were no >> longer found. The compiler-rt libraries were built using freshly built >> stage1, so it makes sense why this happened (clang expected to find the >> libc++ headers in ../include, but they got moved to >> ../projects/libcxx/include). >> Here are a couple of examples of the failures that we've observed: >> >> http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA/47583/console >> /Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/projects/compiler-rt/lib/xray/xray_utils.h:18:10: >> fatal error: 'cstddef' file not found >> #include >> ^ >> 1 error generated. >> >> >> http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/12202/consoleFull >> /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-expensive/llvm/projects/compiler-rt/lib/fuzzer/FuzzerDefs.h:15:10: >> fatal error: 'cassert' file not found >> #include >> ^ >> 1 error generated. >> >> Let me know if you need help looking at or testing out a potential fix >> for Darwin. >> Thanks, >> Alex >> >> >> On 23 July 2018 at 11:58, Heejin Ahn via cfe-commits < >> cfe-commits@lists.llvm.org> wrote: >> >>> Author: aheejin >>> Date: Mon Jul 23 11:58:12 2018 >>> New Revision: 337727 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=337727=rev >>> Log: >>> [CMake] Fix the setting of LIBCXX_HEADER_DIR >>> >>> Reviewers: phosek >>> >>> Subscribers: mgorny, christof, ldionne, cfe-commits >>> >>> Differential Revision: https://reviews.llvm.org/D49629 >>> >>> Modified: >>> libcxx/trunk/CMakeLists.txt >>> >>> Modified: libcxx/trunk/CMakeLists.txt >>> URL: >>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=337727=337726=337727=diff >>> >>> == >>> --- libcxx/trunk/CMakeLists.txt (original) >>> +++ libcxx/trunk/CMakeLists.txt Mon Jul 23 11:58:12 2018 >>> @@ -378,7 +378,7 @@ endif () >>> set(LIBCXX_COMPILER${CMAKE_CXX_COMPILER}) >>> set(LIBCXX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) >>> set(LIBCXX_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) >>> -set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR}) >>> +set(LIBCXX_HEADER_DIR ${LIBCXX_BINARY_DIR}) >>> set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build") >>> >>> string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION >>> >>> >>> ___ >>> 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] D49711: [CMake] Fix the setting of LIBCXX_HEADER_DIR in standalone build
aheejin added a comment. This fixes our local waterfall build failure. Thank you! Repository: rCXX libc++ https://reviews.llvm.org/D49711 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49114: [clang-tidy] Add a check for "magic numbers"
0x8000- updated this revision to Diff 156950. 0x8000- added a comment. Ignore literals implicitly added by the compiler, such as when using a range-for loop over a constant array. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D49114 Files: clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp clang-tidy/readability/CMakeLists.txt clang-tidy/readability/MagicNumbersCheck.cpp clang-tidy/readability/MagicNumbersCheck.h clang-tidy/readability/ReadabilityTidyModule.cpp docs/ReleaseNotes.rst docs/clang-tidy/checks/cppcoreguidelines-avoid-magic-numbers.rst docs/clang-tidy/checks/list.rst docs/clang-tidy/checks/readability-magic-numbers.rst test/clang-tidy/readability-magic-numbers.cpp Index: test/clang-tidy/readability-magic-numbers.cpp === --- /dev/null +++ test/clang-tidy/readability-magic-numbers.cpp @@ -0,0 +1,190 @@ +// RUN: %check_clang_tidy %s readability-magic-numbers %t \ +// RUN: -config='{CheckOptions: \ +// RUN: [{key: readability-magic-numbers.IgnoredIntegerValues, value: "0;1;2;10;100;"}]}' \ +// RUN: -- + +template +struct ValueBucket { + T value[V]; +}; + +int BadGlobalInt = 5; +// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: 5 is a magic number; consider replacing it with a named constant [readability-magic-numbers] + +int IntSquarer(int param) { + return param * param; +} + +void BuggyFunction() { + int BadLocalInt = 6; + // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: 6 is a magic number; consider replacing it with a named constant [readability-magic-numbers] + + (void)IntSquarer(7); + // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: 7 is a magic number; consider replacing it with a named constant [readability-magic-numbers] + + int LocalArray[8]; + // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: 8 is a magic number; consider replacing it with a named constant [readability-magic-numbers] + + for (int ii = 0; ii < 8; ++ii) + // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: 8 is a magic number; consider replacing it with a named constant [readability-magic-numbers] + { +LocalArray[ii] = 3 * ii; +// CHECK-MESSAGES: :[[@LINE-1]]:22: warning: 3 is a magic number; consider replacing it with a named constant [readability-magic-numbers] + } + + ValueBucket Bucket; + // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: 4 is a magic number; consider replacing it with a named constant [readability-magic-numbers] +} + +class TwoIntContainer { +public: + TwoIntContainer(int val) : anotherMember(val * val), yetAnotherMember(6), anotherConstant(val + val) {} + // CHECK-MESSAGES: :[[@LINE-1]]:73: warning: 6 is a magic number; consider replacing it with a named constant [readability-magic-numbers] + + int getValue() const; + +private: + int oneMember = 9; + // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: 9 is a magic number; consider replacing it with a named constant [readability-magic-numbers] + + int anotherMember; + + int yetAnotherMember; + + const int oneConstant = 2; + + const int anotherConstant; +}; + +int ValueArray[] = {3, 5}; +// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: 3 is a magic number; consider replacing it with a named constant [readability-magic-numbers] +// CHECK-MESSAGES: :[[@LINE-2]]:24: warning: 5 is a magic number; consider replacing it with a named constant [readability-magic-numbers] + +float FloatPiVariable = 3.1415926535f; +// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: 3.1415926535f is a magic number; consider replacing it with a named constant [readability-magic-numbers] +double DoublePiVariable = 6.283185307; +// CHECK-MESSAGES: :[[@LINE-1]]:27: warning: 6.283185307 is a magic number; consider replacing it with a named constant [readability-magic-numbers] + +int getAnswer() { + if (ValueArray[0] < ValueArray[1]) +return ValueArray[1]; + + return -3; // FILENOTFOUND + // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: 3 is a magic number; consider replacing it with a named constant [readability-magic-numbers] +} + +/* + * Clean code + */ + +#define INT_MACRO 5 + +const int GoodGlobalIntConstant = 42; + +constexpr int AlsoGoodGlobalIntConstant = 42; + +void SolidFunction() { + const int GoodLocalIntConstant = 43; + + (void)IntSquarer(GoodLocalIntConstant); + + int LocalArray[INT_MACRO]; + + ValueBucket Bucket; +} + +const int ConstValueArray[] = {7, 9}; + +const int ConstValueArray2D[2][2] = {{7, 9}, {13, 15}}; + +/* + * no warnings for ignored values (specified in the configuration above) + */ +int GrandfatheredValues[] = {0, 1, 2, 10, 100, -1, -10, -100}; + +/* + * no warnings for enums + */ +enum Smorgasbord { + STARTER, + ALPHA = 3, + BETA = 1 << 5, +}; + +const float FloatPiConstant = 3.1415926535f; +const double DoublePiConstant = 6.283185307; + +const float Angles[] = {45.0f, 90.0f, 135.0f}; + +double DoubleZeroIsAccepted = 0.0; +float FloatZeroIsAccepted = 0.0f; + +namespace geometry { + +template +struct Point { + T x; + T y; + +
[PATCH] D49711: [CMake] Fix the setting of LIBCXX_HEADER_DIR in standalone build
phosek created this revision. phosek added reviewers: EricWF, ldionne, aheejin, arphaman. Herald added subscribers: cfe-commits, christof, mgorny. This is an alternative approach to r337727 which broke the build because libc++ headers were copied into the location outside of directories used by Clang. This change sets LIBCXX_HEADER_DIR to different values depending on whether libc++ is being built as part of LLVM w/ per-target multiarch runtime, LLVM or standalone. Repository: rCXX libc++ https://reviews.llvm.org/D49711 Files: libcxx/CMakeLists.txt libcxx/cmake/Modules/HandleLibCXXABI.cmake libcxx/include/CMakeLists.txt Index: libcxx/include/CMakeLists.txt === --- libcxx/include/CMakeLists.txt +++ libcxx/include/CMakeLists.txt @@ -204,7 +204,7 @@ ) endif() -if(NOT LIBCXX_USING_INSTALLED_LLVM AND LLVM_BINARY_DIR) +if(NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR) set(output_dir ${LIBCXX_HEADER_DIR}/include/c++/v1) set(out_files) Index: libcxx/cmake/Modules/HandleLibCXXABI.cmake === --- libcxx/cmake/Modules/HandleLibCXXABI.cmake +++ libcxx/cmake/Modules/HandleLibCXXABI.cmake @@ -48,12 +48,14 @@ COMMENT "Copying C++ ABI header ${fpath}...") list(APPEND abilib_headers "${dst}") -set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}") -add_custom_command(OUTPUT ${dst} -DEPENDS ${src} -COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst} -COMMENT "Copying C++ ABI header ${fpath}...") -list(APPEND abilib_headers "${dst}") +if(NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR) + set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}") + add_custom_command(OUTPUT ${dst} + DEPENDS ${src} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst} + COMMENT "Copying C++ ABI header ${fpath}...") + list(APPEND abilib_headers "${dst}") +endif() if (LIBCXX_INSTALL_HEADERS) install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}" Index: libcxx/CMakeLists.txt === --- libcxx/CMakeLists.txt +++ libcxx/CMakeLists.txt @@ -378,7 +378,6 @@ set(LIBCXX_COMPILER${CMAKE_CXX_COMPILER}) set(LIBCXX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(LIBCXX_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) -set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR}) set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build") string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION @@ -391,8 +390,10 @@ set(LIBCXX_HEADER_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}) elseif(LLVM_LIBRARY_OUTPUT_INTDIR) set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) + set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR}) else() set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX}) + set(LIBCXX_HEADER_DIR ${CMAKE_BINARY_DIR}) endif() file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}") Index: libcxx/include/CMakeLists.txt === --- libcxx/include/CMakeLists.txt +++ libcxx/include/CMakeLists.txt @@ -204,7 +204,7 @@ ) endif() -if(NOT LIBCXX_USING_INSTALLED_LLVM AND LLVM_BINARY_DIR) +if(NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR) set(output_dir ${LIBCXX_HEADER_DIR}/include/c++/v1) set(out_files) Index: libcxx/cmake/Modules/HandleLibCXXABI.cmake === --- libcxx/cmake/Modules/HandleLibCXXABI.cmake +++ libcxx/cmake/Modules/HandleLibCXXABI.cmake @@ -48,12 +48,14 @@ COMMENT "Copying C++ ABI header ${fpath}...") list(APPEND abilib_headers "${dst}") -set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}") -add_custom_command(OUTPUT ${dst} -DEPENDS ${src} -COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst} -COMMENT "Copying C++ ABI header ${fpath}...") -list(APPEND abilib_headers "${dst}") +if(NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR) + set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}") + add_custom_command(OUTPUT ${dst} + DEPENDS ${src} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst} + COMMENT "Copying C++ ABI header ${fpath}...") + list(APPEND abilib_headers "${dst}") +endif() if (LIBCXX_INSTALL_HEADERS) install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}" Index: libcxx/CMakeLists.txt === --- libcxx/CMakeLists.txt +++ libcxx/CMakeLists.txt @@ -378,7 +378,6 @@ set(LIBCXX_COMPILER${CMAKE_CXX_COMPILER}) set(LIBCXX_SOURCE_DIR
r337792 - Add missing testcase update for r337790.
Author: rsmith Date: Mon Jul 23 18:23:36 2018 New Revision: 337792 URL: http://llvm.org/viewvc/llvm-project?rev=337792=rev Log: Add missing testcase update for r337790. Modified: cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp Modified: cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp?rev=337792=337791=337792=diff == --- cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp (original) +++ cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp Mon Jul 23 18:23:36 2018 @@ -1555,13 +1555,13 @@ namespace CompoundLiteral { // Other kinds are not. struct X { int a[2]; }; - constexpr int *n = (X){1, 2}.a; // expected-warning {{C99}} expected-warning {{temporary array}} + constexpr int *n = (X){1, 2}.a; // expected-warning {{C99}} expected-warning {{temporary}} // expected-error@-1 {{constant expression}} // expected-note@-2 {{pointer to subobject of temporary}} // expected-note@-3 {{temporary created here}} void f() { -static constexpr int *p = (int*)(int[1]){3}; // expected-warning {{C99}} +static constexpr int *p = (int*)(int[1]){3}; // expected-warning {{C99}} expected-warning {{temporary}} // expected-error@-1 {{constant expression}} // expected-note@-2 {{pointer to subobject of temporary}} // expected-note@-3 {{temporary created here}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49656: [analyzer] Add support for more pointer invalidating functions in InnerPointerChecker
NoQ added inline comments. Comment at: lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp:207-208 + +for (unsigned I = 0, E = FD->getNumParams(); I != E; ++I) { + QualType ParamTy = FD->getParamDecl(I)->getType(); + if (!ParamTy->isReferenceType() || NoQ wrote: > We need tests for operators here, due to the problem that i recently > encountered in D49627: there's different numbering for arguments and > parameters within in-class operators. Namely, this-argument is counted as an > argument (shifting other argument indices by 1) but not as a parameter. (i.e., tests and most likely some actual code branch) https://reviews.llvm.org/D49656 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49656: [analyzer] Add support for more pointer invalidating functions in InnerPointerChecker
NoQ added inline comments. Comment at: lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp:207-208 + +for (unsigned I = 0, E = FD->getNumParams(); I != E; ++I) { + QualType ParamTy = FD->getParamDecl(I)->getType(); + if (!ParamTy->isReferenceType() || We need tests for operators here, due to the problem that i recently encountered in D49627: there's different numbering for arguments and parameters within in-class operators. Namely, this-argument is counted as an argument (shifting other argument indices by 1) but not as a parameter. https://reviews.llvm.org/D49656 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r337791 - Enable .hip files for test/Driver
Author: yaxunl Date: Mon Jul 23 18:03:44 2018 New Revision: 337791 URL: http://llvm.org/viewvc/llvm-project?rev=337791=rev Log: Enable .hip files for test/Driver Partially revert r334128 due to regressions. Modified: cfe/trunk/lib/Driver/Driver.cpp cfe/trunk/test/Driver/lit.local.cfg Modified: cfe/trunk/lib/Driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=337791=337790=337791=diff == --- cfe/trunk/lib/Driver/Driver.cpp (original) +++ cfe/trunk/lib/Driver/Driver.cpp Mon Jul 23 18:03:44 2018 @@ -2809,7 +2809,7 @@ public: C.MakeAction(HostAction); UnbundlingHostAction->registerDependentActionInfo( C.getSingleOffloadToolChain(), - /*BoundArch=*/"all", Action::OFK_Host); + /*BoundArch=*/StringRef(), Action::OFK_Host); HostAction = UnbundlingHostAction; } @@ -3868,7 +3868,7 @@ InputInfo Driver::BuildJobsForActionNoCa StringRef Arch; if (TargetDeviceOffloadKind == Action::OFK_HIP) { if (UI.DependentOffloadKind == Action::OFK_Host) - Arch = "all"; + Arch = StringRef(); else Arch = UI.DependentBoundArch; } else Modified: cfe/trunk/test/Driver/lit.local.cfg URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/lit.local.cfg?rev=337791=337790=337791=diff == --- cfe/trunk/test/Driver/lit.local.cfg (original) +++ cfe/trunk/test/Driver/lit.local.cfg Mon Jul 23 18:03:44 2018 @@ -1,5 +1,5 @@ config.suffixes = ['.c', '.cpp', '.h', '.m', '.mm', '.S', '.s', '.f90', '.f95', - '.cu', '.rs', '.cl'] + '.cu', '.rs', '.cl', '.hip'] config.substitutions = list(config.substitutions) config.substitutions.insert(0, ('%clang_cc1', ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49656: [analyzer] Add support for more pointer invalidating functions in InnerPointerChecker
NoQ added inline comments. Comment at: test/Analysis/inner-pointer.cpp:41-42 +template< class T > +void func_ref(T& a); + Without a definition for this thing, we won't be able to test much. I suggest you to take a pointer to a function directly, i.e. define a `std::swap(x, y)` somewhere and take a `::swap` directly and call it (hope it actually works this way). https://reviews.llvm.org/D49656 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r337790 - Warn if a local variable's initializer retains a pointer/reference to a
Author: rsmith Date: Mon Jul 23 17:55:08 2018 New Revision: 337790 URL: http://llvm.org/viewvc/llvm-project?rev=337790=rev Log: Warn if a local variable's initializer retains a pointer/reference to a non-lifetime-extended temporary object. Added: cfe/trunk/test/SemaCXX/warn-dangling-local.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/Sema/SemaInit.cpp cfe/trunk/test/CXX/drs/dr16xx.cpp cfe/trunk/test/SemaCXX/address-of-temporary.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=337790=337789=337790=diff == --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Mon Jul 23 17:55:08 2018 @@ -273,6 +273,10 @@ def OverloadedShiftOpParentheses: DiagGr def DanglingElse: DiagGroup<"dangling-else">; def DanglingField : DiagGroup<"dangling-field">; def DanglingInitializerList : DiagGroup<"dangling-initializer-list">; +def ReturnStackAddress : DiagGroup<"return-stack-address">; +def Dangling : DiagGroup<"dangling", [DanglingField, + DanglingInitializerList, + ReturnStackAddress]>; def DistributedObjectModifiers : DiagGroup<"distributed-object-modifiers">; def ExpansionToDefined : DiagGroup<"expansion-to-defined">; def FlagEnum : DiagGroup<"flag-enum">; @@ -407,7 +411,6 @@ def RedeclaredClassMember : DiagGroup<"r def GNURedeclaredEnum : DiagGroup<"gnu-redeclared-enum">; def RedundantMove : DiagGroup<"redundant-move">; def Register : DiagGroup<"register", [DeprecatedRegister]>; -def ReturnStackAddress : DiagGroup<"return-stack-address">; def ReturnTypeCLinkage : DiagGroup<"return-type-c-linkage">; def ReturnType : DiagGroup<"return-type", [ReturnTypeCLinkage]>; def BindToTemporaryCopy : DiagGroup<"bind-to-temporary-copy", Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=337790=337789=337790=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Jul 23 17:55:08 2018 @@ -1845,10 +1845,6 @@ def err_reference_bind_failed : Error< "type $|could not bind to %select{rvalue|lvalue}1 of incompatible type}0,2">; def err_reference_bind_init_list : Error< "reference to type %0 cannot bind to an initializer list">; -def warn_temporary_array_to_pointer_decay : Warning< - "pointer is initialized by a temporary array, which will be destroyed at the " - "end of the full-expression">, - InGroup>; def err_init_list_bad_dest_type : Error< "%select{|non-aggregate }0type %1 cannot be initialized with an initializer " "list">; @@ -7876,15 +7872,31 @@ def warn_init_ptr_member_to_parameter_ad def note_ref_or_ptr_member_declared_here : Note< "%select{reference|pointer}0 member declared here">; -def err_bind_ref_member_to_temporary : Error< +def err_dangling_member : Error< "%select{reference|backing array for 'std::initializer_list'}2 " "%select{|subobject of }1member %0 " "%select{binds to|is}2 a temporary object " - "whose lifetime would be shorter than the constructed object">; + "whose lifetime would be shorter than the lifetime of " + "the constructed object">; +def warn_dangling_member : Warning< + "%select{reference|backing array for 'std::initializer_list'}2 " + "%select{|subobject of }1member %0 " + "%select{binds to|is}2 a temporary object " + "whose lifetime is shorter than the lifetime of the constructed object">, + InGroup; def note_lifetime_extending_member_declared_here : Note< "%select{%select{reference|'std::initializer_list'}0 member|" "member with %select{reference|'std::initializer_list'}0 subobject}1 " "declared here">; +def warn_dangling_variable : Warning< + "%select{temporary %select{whose address is used as value of|bound to}3 " + "%select{%select{|reference }3member of local variable|" + "local %select{variable|reference}3}1|" + "array backing " + "%select{initializer list subobject of local variable|" + "local initializer list}1}0 " + "%2 will be destroyed at the end of the full-expression">, + InGroup; def warn_new_dangling_reference : Warning< "temporary bound to reference member of allocated object " "will be destroyed at the end of the full-expression">, @@ -7895,16 +7907,12 @@ def warn_new_dangling_initializer_list : "the allocated initializer list}0 " "will be destroyed at the end of the full-expression">, InGroup; -def warn_unsupported_temporary_not_extended : Warning< - "sorry, lifetime extension of temporary created " - "by
[PATCH] D49508: [Sema] Mark implicitly-inserted ICE's as being part of explicit cast (PR38166)
rsmith accepted this revision. rsmith added inline comments. This revision is now accepted and ready to land. Comment at: lib/Sema/SemaCast.cpp:94-101 +void updatePartOfExplicitCastFlags(CastExpr *CE) { + // Walk down from the CE to the OrigSrcExpr, and mark all immediate + // ImplicitCastExpr's as being part of ExplicitCastExpr. The original CE + // (which is a ExplicitCastExpr), and the OrigSrcExpr are not touched. + while (OrigSrcExpr.get() != CE->getSubExpr() && + (CE = dyn_cast(CE->getSubExpr( +CE->setIsPartOfExplicitCast(true); lebedev.ri wrote: > rsmith wrote: > > You don't need to track the `OrigSrcExpr` here. You can just recurse down > > through all the `ImplicitCastExpr`s (they're always all notionally part of > > the explicit cast). > We do sometimes have `OrigSrcExpr` being `ImplicitCastExpr`. > https://godbolt.org/g/S5951G <- that `ImplicitCastExpr` would now get marked, > even though it is `OrigSrcExpr`. > Is that expected? Yes, that's expected, the conversion from `int` to `char` there is part of the semantics of the explicit cast from `int` to `vector of char`, and you wouldn't want your UBSan check to warn about that, right? Repository: rC Clang https://reviews.llvm.org/D49508 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49109: Borrow visibility from __fundamental_type_info for generated fundamental type infos
This revision was automatically updated to reflect the committed changes. Closed by commit rC337788: Borrow visibility from __fundamental_type_info for generated fundamental type… (authored by thomasanderson, committed by ). Repository: rC Clang https://reviews.llvm.org/D49109 Files: lib/CodeGen/ItaniumCXXABI.cpp test/CodeGenCXX/rtti-fundamental.cpp Index: test/CodeGenCXX/rtti-fundamental.cpp === --- test/CodeGenCXX/rtti-fundamental.cpp +++ test/CodeGenCXX/rtti-fundamental.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -fvisibility hidden -o - | FileCheck %s -check-prefix=CHECK-HIDDEN #include @@ -16,116 +17,184 @@ // void // CHECK: @_ZTIv = constant +// CHECK-HIDDEN: @_ZTIv = hidden constant // CHECK: @_ZTIPv = constant +// CHECK-HIDDEN: @_ZTIPv = hidden constant // CHECK: @_ZTIPKv = constant +// CHECK-HIDDEN: @_ZTIPKv = hidden constant // std::nullptr_t // CHECK: @_ZTIDn = constant +// CHECK-HIDDEN: @_ZTIDn = hidden constant // CHECK: @_ZTIPDn = constant +// CHECK-HIDDEN: @_ZTIPDn = hidden constant // CHECK: @_ZTIPKDn = constant +// CHECK-HIDDEN: @_ZTIPKDn = hidden constant // bool // CHECK: @_ZTIb = constant +// CHECK-HIDDEN: @_ZTIb = hidden constant // CHECK: @_ZTIPb = constant +// CHECK-HIDDEN: @_ZTIPb = hidden constant // CHECK: @_ZTIPKb = constant +// CHECK-HIDDEN: @_ZTIPKb = hidden constant // wchar_t // CHECK: @_ZTIw = constant +// CHECK-HIDDEN: @_ZTIw = hidden constant // CHECK: @_ZTIPw = constant +// CHECK-HIDDEN: @_ZTIPw = hidden constant // CHECK: @_ZTIPKw = constant +// CHECK-HIDDEN: @_ZTIPKw = hidden constant // char // CHECK: @_ZTIc = constant +// CHECK-HIDDEN: @_ZTIc = hidden constant // CHECK: @_ZTIPc = constant +// CHECK-HIDDEN: @_ZTIPc = hidden constant // CHECK: @_ZTIPKc = constant +// CHECK-HIDDEN: @_ZTIPKc = hidden constant // unsigned char // CHECK: @_ZTIh = constant +// CHECK-HIDDEN: @_ZTIh = hidden constant // CHECK: @_ZTIPh = constant +// CHECK-HIDDEN: @_ZTIPh = hidden constant // CHECK: @_ZTIPKh = constant +// CHECK-HIDDEN: @_ZTIPKh = hidden constant // signed char // CHECK: @_ZTIa = constant +// CHECK-HIDDEN: @_ZTIa = hidden constant // CHECK: @_ZTIPa = constant +// CHECK-HIDDEN: @_ZTIPa = hidden constant // CHECK: @_ZTIPKa = constant +// CHECK-HIDDEN: @_ZTIPKa = hidden constant // short // CHECK: @_ZTIs = constant +// CHECK-HIDDEN: @_ZTIs = hidden constant // CHECK: @_ZTIPs = constant +// CHECK-HIDDEN: @_ZTIPs = hidden constant // CHECK: @_ZTIPKs = constant +// CHECK-HIDDEN: @_ZTIPKs = hidden constant // unsigned short // CHECK: @_ZTIt = constant +// CHECK-HIDDEN: @_ZTIt = hidden constant // CHECK: @_ZTIPt = constant +// CHECK-HIDDEN: @_ZTIPt = hidden constant // CHECK: @_ZTIPKt = constant +// CHECK-HIDDEN: @_ZTIPKt = hidden constant // int // CHECK: @_ZTIi = constant +// CHECK-HIDDEN: @_ZTIi = hidden constant // CHECK: @_ZTIPi = constant +// CHECK-HIDDEN: @_ZTIPi = hidden constant // CHECK: @_ZTIPKi = constant +// CHECK-HIDDEN: @_ZTIPKi = hidden constant // unsigned int // CHECK: @_ZTIj = constant +// CHECK-HIDDEN: @_ZTIj = hidden constant // CHECK: @_ZTIPj = constant +// CHECK-HIDDEN: @_ZTIPj = hidden constant // CHECK: @_ZTIPKj = constant +// CHECK-HIDDEN: @_ZTIPKj = hidden constant // long // CHECK: @_ZTIl = constant +// CHECK-HIDDEN: @_ZTIl = hidden constant // CHECK: @_ZTIPl = constant +// CHECK-HIDDEN: @_ZTIPl = hidden constant // CHECK: @_ZTIPKl = constant +// CHECK-HIDDEN: @_ZTIPKl = hidden constant // unsigned long // CHECK: @_ZTIm = constant +// CHECK-HIDDEN: @_ZTIm = hidden constant // CHECK: @_ZTIPm = constant +// CHECK-HIDDEN: @_ZTIPm = hidden constant // CHECK: @_ZTIPKm = constant +// CHECK-HIDDEN: @_ZTIPKm = hidden constant // long long // CHECK: @_ZTIx = constant +// CHECK-HIDDEN: @_ZTIx = hidden constant // CHECK: @_ZTIPx = constant +// CHECK-HIDDEN: @_ZTIPx = hidden constant // CHECK: @_ZTIPKx = constant +// CHECK-HIDDEN: @_ZTIPKx = hidden constant // unsigned long long // CHECK: @_ZTIy = constant +// CHECK-HIDDEN: @_ZTIy = hidden constant // CHECK: @_ZTIPy = constant +// CHECK-HIDDEN: @_ZTIPy = hidden constant // CHECK: @_ZTIPKy = constant +// CHECK-HIDDEN: @_ZTIPKy = hidden constant // __int128 // CHECK: @_ZTIn = constant +// CHECK-HIDDEN: @_ZTIn = hidden constant // CHECK: @_ZTIPn = constant +// CHECK-HIDDEN: @_ZTIPn = hidden constant // CHECK: @_ZTIPKn = constant +// CHECK-HIDDEN: @_ZTIPKn = hidden constant // unsigned __int128 // CHECK: @_ZTIo = constant +// CHECK-HIDDEN: @_ZTIo = hidden constant // CHECK: @_ZTIPo = constant +// CHECK-HIDDEN: @_ZTIPo = hidden constant // CHECK: @_ZTIPKo = constant +// CHECK-HIDDEN: @_ZTIPKo = hidden constant // half // CHECK: @_ZTIDh = constant +// CHECK-HIDDEN: @_ZTIDh = hidden constant // CHECK: @_ZTIPDh
[PATCH] D49109: Borrow visibility from __fundamental_type_info for generated fundamental type infos
pcc accepted this revision. pcc added a comment. This revision is now accepted and ready to land. LGTM https://reviews.llvm.org/D49109 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48886: VS 2017 clang integration
dtarditi abandoned this revision. dtarditi added a comment. This is not needed after https://reviews.llvm.org/D42762 was committed. The approach there of using a VSIX package is better than the script-based approach here. Repository: rL LLVM https://reviews.llvm.org/D48886 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49109: Borrow visibility from __fundamental_type_info for generated fundamental type infos
thomasanderson updated this revision to Diff 156943. thomasanderson added a comment. Added test. Also verified that all tests in llvm/tools/clang/test pass. https://reviews.llvm.org/D49109 Files: lib/CodeGen/ItaniumCXXABI.cpp test/CodeGenCXX/rtti-fundamental.cpp Index: test/CodeGenCXX/rtti-fundamental.cpp === --- test/CodeGenCXX/rtti-fundamental.cpp +++ test/CodeGenCXX/rtti-fundamental.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -fvisibility hidden -o - | FileCheck %s -check-prefix=CHECK-HIDDEN #include @@ -16,116 +17,184 @@ // void // CHECK: @_ZTIv = constant +// CHECK-HIDDEN: @_ZTIv = hidden constant // CHECK: @_ZTIPv = constant +// CHECK-HIDDEN: @_ZTIPv = hidden constant // CHECK: @_ZTIPKv = constant +// CHECK-HIDDEN: @_ZTIPKv = hidden constant // std::nullptr_t // CHECK: @_ZTIDn = constant +// CHECK-HIDDEN: @_ZTIDn = hidden constant // CHECK: @_ZTIPDn = constant +// CHECK-HIDDEN: @_ZTIPDn = hidden constant // CHECK: @_ZTIPKDn = constant +// CHECK-HIDDEN: @_ZTIPKDn = hidden constant // bool // CHECK: @_ZTIb = constant +// CHECK-HIDDEN: @_ZTIb = hidden constant // CHECK: @_ZTIPb = constant +// CHECK-HIDDEN: @_ZTIPb = hidden constant // CHECK: @_ZTIPKb = constant +// CHECK-HIDDEN: @_ZTIPKb = hidden constant // wchar_t // CHECK: @_ZTIw = constant +// CHECK-HIDDEN: @_ZTIw = hidden constant // CHECK: @_ZTIPw = constant +// CHECK-HIDDEN: @_ZTIPw = hidden constant // CHECK: @_ZTIPKw = constant +// CHECK-HIDDEN: @_ZTIPKw = hidden constant // char // CHECK: @_ZTIc = constant +// CHECK-HIDDEN: @_ZTIc = hidden constant // CHECK: @_ZTIPc = constant +// CHECK-HIDDEN: @_ZTIPc = hidden constant // CHECK: @_ZTIPKc = constant +// CHECK-HIDDEN: @_ZTIPKc = hidden constant // unsigned char // CHECK: @_ZTIh = constant +// CHECK-HIDDEN: @_ZTIh = hidden constant // CHECK: @_ZTIPh = constant +// CHECK-HIDDEN: @_ZTIPh = hidden constant // CHECK: @_ZTIPKh = constant +// CHECK-HIDDEN: @_ZTIPKh = hidden constant // signed char // CHECK: @_ZTIa = constant +// CHECK-HIDDEN: @_ZTIa = hidden constant // CHECK: @_ZTIPa = constant +// CHECK-HIDDEN: @_ZTIPa = hidden constant // CHECK: @_ZTIPKa = constant +// CHECK-HIDDEN: @_ZTIPKa = hidden constant // short // CHECK: @_ZTIs = constant +// CHECK-HIDDEN: @_ZTIs = hidden constant // CHECK: @_ZTIPs = constant +// CHECK-HIDDEN: @_ZTIPs = hidden constant // CHECK: @_ZTIPKs = constant +// CHECK-HIDDEN: @_ZTIPKs = hidden constant // unsigned short // CHECK: @_ZTIt = constant +// CHECK-HIDDEN: @_ZTIt = hidden constant // CHECK: @_ZTIPt = constant +// CHECK-HIDDEN: @_ZTIPt = hidden constant // CHECK: @_ZTIPKt = constant +// CHECK-HIDDEN: @_ZTIPKt = hidden constant // int // CHECK: @_ZTIi = constant +// CHECK-HIDDEN: @_ZTIi = hidden constant // CHECK: @_ZTIPi = constant +// CHECK-HIDDEN: @_ZTIPi = hidden constant // CHECK: @_ZTIPKi = constant +// CHECK-HIDDEN: @_ZTIPKi = hidden constant // unsigned int // CHECK: @_ZTIj = constant +// CHECK-HIDDEN: @_ZTIj = hidden constant // CHECK: @_ZTIPj = constant +// CHECK-HIDDEN: @_ZTIPj = hidden constant // CHECK: @_ZTIPKj = constant +// CHECK-HIDDEN: @_ZTIPKj = hidden constant // long // CHECK: @_ZTIl = constant +// CHECK-HIDDEN: @_ZTIl = hidden constant // CHECK: @_ZTIPl = constant +// CHECK-HIDDEN: @_ZTIPl = hidden constant // CHECK: @_ZTIPKl = constant +// CHECK-HIDDEN: @_ZTIPKl = hidden constant // unsigned long // CHECK: @_ZTIm = constant +// CHECK-HIDDEN: @_ZTIm = hidden constant // CHECK: @_ZTIPm = constant +// CHECK-HIDDEN: @_ZTIPm = hidden constant // CHECK: @_ZTIPKm = constant +// CHECK-HIDDEN: @_ZTIPKm = hidden constant // long long // CHECK: @_ZTIx = constant +// CHECK-HIDDEN: @_ZTIx = hidden constant // CHECK: @_ZTIPx = constant +// CHECK-HIDDEN: @_ZTIPx = hidden constant // CHECK: @_ZTIPKx = constant +// CHECK-HIDDEN: @_ZTIPKx = hidden constant // unsigned long long // CHECK: @_ZTIy = constant +// CHECK-HIDDEN: @_ZTIy = hidden constant // CHECK: @_ZTIPy = constant +// CHECK-HIDDEN: @_ZTIPy = hidden constant // CHECK: @_ZTIPKy = constant +// CHECK-HIDDEN: @_ZTIPKy = hidden constant // __int128 // CHECK: @_ZTIn = constant +// CHECK-HIDDEN: @_ZTIn = hidden constant // CHECK: @_ZTIPn = constant +// CHECK-HIDDEN: @_ZTIPn = hidden constant // CHECK: @_ZTIPKn = constant +// CHECK-HIDDEN: @_ZTIPKn = hidden constant // unsigned __int128 // CHECK: @_ZTIo = constant +// CHECK-HIDDEN: @_ZTIo = hidden constant // CHECK: @_ZTIPo = constant +// CHECK-HIDDEN: @_ZTIPo = hidden constant // CHECK: @_ZTIPKo = constant +// CHECK-HIDDEN: @_ZTIPKo = hidden constant // half // CHECK: @_ZTIDh = constant +// CHECK-HIDDEN: @_ZTIDh = hidden constant // CHECK: @_ZTIPDh = constant +// CHECK-HIDDEN: @_ZTIPDh = hidden constant // CHECK: @_ZTIPKDh = constant
Re: [libcxx] r337727 - [CMake] Fix the setting of LIBCXX_HEADER_DIR
Hi, I had to revert your commit as it caused a number of failures in our public and internal CI. When building compiler-rt on Darwin (stage1), after this commit the build failed to build X-ray and libfuzzer because the libc++ headers were no longer found. The compiler-rt libraries were built using freshly built stage1, so it makes sense why this happened (clang expected to find the libc++ headers in ../include, but they got moved to ../projects/libcxx/include). Here are a couple of examples of the failures that we've observed: http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA/47583/console /Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/projects/compiler-rt/lib/xray/xray_utils.h:18:10: fatal error: 'cstddef' file not found #include ^ 1 error generated. http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/12202/consoleFull /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-expensive/llvm/projects/compiler-rt/lib/fuzzer/FuzzerDefs.h:15:10: fatal error: 'cassert' file not found #include ^ 1 error generated. Let me know if you need help looking at or testing out a potential fix for Darwin. Thanks, Alex On 23 July 2018 at 11:58, Heejin Ahn via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: aheejin > Date: Mon Jul 23 11:58:12 2018 > New Revision: 337727 > > URL: http://llvm.org/viewvc/llvm-project?rev=337727=rev > Log: > [CMake] Fix the setting of LIBCXX_HEADER_DIR > > Reviewers: phosek > > Subscribers: mgorny, christof, ldionne, cfe-commits > > Differential Revision: https://reviews.llvm.org/D49629 > > Modified: > libcxx/trunk/CMakeLists.txt > > Modified: libcxx/trunk/CMakeLists.txt > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/ > CMakeLists.txt?rev=337727=337726=337727=diff > > == > --- libcxx/trunk/CMakeLists.txt (original) > +++ libcxx/trunk/CMakeLists.txt Mon Jul 23 11:58:12 2018 > @@ -378,7 +378,7 @@ endif () > set(LIBCXX_COMPILER${CMAKE_CXX_COMPILER}) > set(LIBCXX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) > set(LIBCXX_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) > -set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR}) > +set(LIBCXX_HEADER_DIR ${LIBCXX_BINARY_DIR}) > set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build") > > string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r337727 - [CMake] Fix the setting of LIBCXX_HEADER_DIR
The revert commit is r337782. On 23 July 2018 at 17:32, Alex L wrote: > Hi, > > I had to revert your commit as it caused a number of failures in our > public and internal CI. > When building compiler-rt on Darwin (stage1), after this commit the build > failed to build X-ray and libfuzzer because the libc++ headers were no > longer found. The compiler-rt libraries were built using freshly built > stage1, so it makes sense why this happened (clang expected to find the > libc++ headers in ../include, but they got moved to > ../projects/libcxx/include). > Here are a couple of examples of the failures that we've observed: > > http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA/47583/console > /Users/buildslave/jenkins/workspace/clang-stage1- > configure-RA/llvm/projects/compiler-rt/lib/xray/xray_utils.h:18:10: fatal > error: 'cstddef' file not found > #include > ^ > 1 error generated. > > http://lab.llvm.org:8080/green/job/clang-stage1-cmake- > RA-expensive/12202/consoleFull > /Users/buildslave/jenkins/workspace/clang-stage1-cmake- > RA-expensive/llvm/projects/compiler-rt/lib/fuzzer/FuzzerDefs.h:15:10: > fatal error: 'cassert' file not found > #include > ^ > 1 error generated. > > Let me know if you need help looking at or testing out a potential fix for > Darwin. > Thanks, > Alex > > > On 23 July 2018 at 11:58, Heejin Ahn via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> Author: aheejin >> Date: Mon Jul 23 11:58:12 2018 >> New Revision: 337727 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=337727=rev >> Log: >> [CMake] Fix the setting of LIBCXX_HEADER_DIR >> >> Reviewers: phosek >> >> Subscribers: mgorny, christof, ldionne, cfe-commits >> >> Differential Revision: https://reviews.llvm.org/D49629 >> >> Modified: >> libcxx/trunk/CMakeLists.txt >> >> Modified: libcxx/trunk/CMakeLists.txt >> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists. >> txt?rev=337727=337726=337727=diff >> >> == >> --- libcxx/trunk/CMakeLists.txt (original) >> +++ libcxx/trunk/CMakeLists.txt Mon Jul 23 11:58:12 2018 >> @@ -378,7 +378,7 @@ endif () >> set(LIBCXX_COMPILER${CMAKE_CXX_COMPILER}) >> set(LIBCXX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) >> set(LIBCXX_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) >> -set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR}) >> +set(LIBCXX_HEADER_DIR ${LIBCXX_BINARY_DIR}) >> set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build") >> >> string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION >> >> >> ___ >> 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] D49656: [analyzer] Add support for more pointer invalidating functions in InnerPointerChecker
NoQ added inline comments. Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:2934 +} else if (const auto *CallE = dyn_cast(S)) { + OS << CallE->getDirectCallee()->getNameAsString(); } rnkovacs wrote: > xazax.hun wrote: > > I think `getDirectCallee` might fail and return `nullptr`. One more reason > > to test function pointers :) > You're right. Also, it needed a bit more effort to dig up the function > pointer's name. Or should I go further and somehow find out the name of the > function it points to? > Also, it needed a bit more effort to dig up the function pointer's name. I think it should work out of the box; `Call.getDecl()` is smart enough to show the right decl when a pointer to a concrete function is being called on the current path. https://reviews.llvm.org/D49656 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r337783 - [WebAssembly] Change size_t to `unsigned long`.
Author: djg Date: Mon Jul 23 17:29:58 2018 New Revision: 337783 URL: http://llvm.org/viewvc/llvm-project?rev=337783=rev Log: [WebAssembly] Change size_t to `unsigned long`. Changing it to unsigned long (which is 32-bit on wasm32) makes it the same type as wasm64 (where unsigned long is 64-bit), which would eliminate the most common cause for mangled names being different between wasm32 and wasm64. For example, export lists containing symbol names could now often be the same between wasm32 and wasm64. Differential Revision: https://reviews.llvm.org/D40526 Modified: cfe/trunk/lib/Basic/Targets/WebAssembly.h cfe/trunk/test/Preprocessor/init.c Modified: cfe/trunk/lib/Basic/Targets/WebAssembly.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/WebAssembly.h?rev=337783=337782=337783=diff == --- cfe/trunk/lib/Basic/Targets/WebAssembly.h (original) +++ cfe/trunk/lib/Basic/Targets/WebAssembly.h Mon Jul 23 17:29:58 2018 @@ -47,9 +47,11 @@ public: LongDoubleWidth = LongDoubleAlign = 128; LongDoubleFormat = ::APFloat::IEEEquad(); MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64; -SizeType = UnsignedInt; -PtrDiffType = SignedInt; -IntPtrType = SignedInt; +// size_t being unsigned long for both wasm32 and wasm64 makes mangled names +// more consistent between the two. +SizeType = UnsignedLong; +PtrDiffType = SignedLong; +IntPtrType = SignedLong; } protected: Modified: cfe/trunk/test/Preprocessor/init.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=337783=337782=337783=diff == --- cfe/trunk/test/Preprocessor/init.c (original) +++ cfe/trunk/test/Preprocessor/init.c Mon Jul 23 17:29:58 2018 @@ -9171,10 +9171,10 @@ // WEBASSEMBLY32-NEXT:#define __INTMAX_MAX__ 9223372036854775807LL // WEBASSEMBLY32-NEXT:#define __INTMAX_TYPE__ long long int // WEBASSEMBLY32-NEXT:#define __INTMAX_WIDTH__ 64 -// WEBASSEMBLY32-NEXT:#define __INTPTR_FMTd__ "d" -// WEBASSEMBLY32-NEXT:#define __INTPTR_FMTi__ "i" -// WEBASSEMBLY32-NEXT:#define __INTPTR_MAX__ 2147483647 -// WEBASSEMBLY32-NEXT:#define __INTPTR_TYPE__ int +// WEBASSEMBLY32-NEXT:#define __INTPTR_FMTd__ "ld" +// WEBASSEMBLY32-NEXT:#define __INTPTR_FMTi__ "li" +// WEBASSEMBLY32-NEXT:#define __INTPTR_MAX__ 2147483647L +// WEBASSEMBLY32-NEXT:#define __INTPTR_TYPE__ long int // WEBASSEMBLY32-NEXT:#define __INTPTR_WIDTH__ 32 // WEBASSEMBLY32-NEXT:#define __INT_FAST16_FMTd__ "hd" // WEBASSEMBLY32-NEXT:#define __INT_FAST16_FMTi__ "hi" @@ -9239,10 +9239,10 @@ // WEBASSEMBLY32-NEXT:#define __ORDER_PDP_ENDIAN__ 3412 // WEBASSEMBLY32-NEXT:#define __POINTER_WIDTH__ 32 // WEBASSEMBLY32-NEXT:#define __PRAGMA_REDEFINE_EXTNAME 1 -// WEBASSEMBLY32-NEXT:#define __PTRDIFF_FMTd__ "d" -// WEBASSEMBLY32-NEXT:#define __PTRDIFF_FMTi__ "i" -// WEBASSEMBLY32-NEXT:#define __PTRDIFF_MAX__ 2147483647 -// WEBASSEMBLY32-NEXT:#define __PTRDIFF_TYPE__ int +// WEBASSEMBLY32-NEXT:#define __PTRDIFF_FMTd__ "ld" +// WEBASSEMBLY32-NEXT:#define __PTRDIFF_FMTi__ "li" +// WEBASSEMBLY32-NEXT:#define __PTRDIFF_MAX__ 2147483647L +// WEBASSEMBLY32-NEXT:#define __PTRDIFF_TYPE__ long int // WEBASSEMBLY32-NEXT:#define __PTRDIFF_WIDTH__ 32 // WEBASSEMBLY32-NOT:#define __REGISTER_PREFIX__ // WEBASSEMBLY32-NEXT:#define __SCHAR_MAX__ 127 @@ -9262,12 +9262,12 @@ // WEBASSEMBLY32-NEXT:#define __SIZEOF_SIZE_T__ 4 // WEBASSEMBLY32-NEXT:#define __SIZEOF_WCHAR_T__ 4 // WEBASSEMBLY32-NEXT:#define __SIZEOF_WINT_T__ 4 -// WEBASSEMBLY32-NEXT:#define __SIZE_FMTX__ "X" -// WEBASSEMBLY32-NEXT:#define __SIZE_FMTo__ "o" -// WEBASSEMBLY32-NEXT:#define __SIZE_FMTu__ "u" -// WEBASSEMBLY32-NEXT:#define __SIZE_FMTx__ "x" -// WEBASSEMBLY32-NEXT:#define __SIZE_MAX__ 4294967295U -// WEBASSEMBLY32-NEXT:#define __SIZE_TYPE__ unsigned int +// WEBASSEMBLY32-NEXT:#define __SIZE_FMTX__ "lX" +// WEBASSEMBLY32-NEXT:#define __SIZE_FMTo__ "lo" +// WEBASSEMBLY32-NEXT:#define __SIZE_FMTu__ "lu" +// WEBASSEMBLY32-NEXT:#define __SIZE_FMTx__ "lx" +// WEBASSEMBLY32-NEXT:#define __SIZE_MAX__ 4294967295UL +// WEBASSEMBLY32-NEXT:#define __SIZE_TYPE__ long unsigned int // WEBASSEMBLY32-NEXT:#define __SIZE_WIDTH__ 32 // WEBASSEMBLY32-NEXT:#define __STDC_HOSTED__ 0 // WEBASSEMBLY32-NOT:#define __STDC_MB_MIGHT_NEQ_WC__ @@ -9315,12 +9315,12 @@ // WEBASSEMBLY32-NEXT:#define __UINTMAX_MAX__ 18446744073709551615ULL // WEBASSEMBLY32-NEXT:#define __UINTMAX_TYPE__ long long unsigned int // WEBASSEMBLY32-NEXT:#define __UINTMAX_WIDTH__ 64 -// WEBASSEMBLY32-NEXT:#define __UINTPTR_FMTX__ "X" -// WEBASSEMBLY32-NEXT:#define __UINTPTR_FMTo__ "o" -// WEBASSEMBLY32-NEXT:#define __UINTPTR_FMTu__ "u" -// WEBASSEMBLY32-NEXT:#define __UINTPTR_FMTx__ "x" -// WEBASSEMBLY32-NEXT:#define __UINTPTR_MAX__ 4294967295U -// WEBASSEMBLY32-NEXT:#define __UINTPTR_TYPE__ unsigned int +// WEBASSEMBLY32-NEXT:#define
[PATCH] D40526: [WebAssembly] Change size_t to `unsigned long`
This revision was automatically updated to reflect the committed changes. Closed by commit rC337783: [WebAssembly] Change size_t to `unsigned long`. (authored by djg, committed by ). Herald added a subscriber: cfe-commits. Repository: rC Clang https://reviews.llvm.org/D40526 Files: lib/Basic/Targets/WebAssembly.h test/Preprocessor/init.c Index: test/Preprocessor/init.c === --- test/Preprocessor/init.c +++ test/Preprocessor/init.c @@ -9171,10 +9171,10 @@ // WEBASSEMBLY32-NEXT:#define __INTMAX_MAX__ 9223372036854775807LL // WEBASSEMBLY32-NEXT:#define __INTMAX_TYPE__ long long int // WEBASSEMBLY32-NEXT:#define __INTMAX_WIDTH__ 64 -// WEBASSEMBLY32-NEXT:#define __INTPTR_FMTd__ "d" -// WEBASSEMBLY32-NEXT:#define __INTPTR_FMTi__ "i" -// WEBASSEMBLY32-NEXT:#define __INTPTR_MAX__ 2147483647 -// WEBASSEMBLY32-NEXT:#define __INTPTR_TYPE__ int +// WEBASSEMBLY32-NEXT:#define __INTPTR_FMTd__ "ld" +// WEBASSEMBLY32-NEXT:#define __INTPTR_FMTi__ "li" +// WEBASSEMBLY32-NEXT:#define __INTPTR_MAX__ 2147483647L +// WEBASSEMBLY32-NEXT:#define __INTPTR_TYPE__ long int // WEBASSEMBLY32-NEXT:#define __INTPTR_WIDTH__ 32 // WEBASSEMBLY32-NEXT:#define __INT_FAST16_FMTd__ "hd" // WEBASSEMBLY32-NEXT:#define __INT_FAST16_FMTi__ "hi" @@ -9239,10 +9239,10 @@ // WEBASSEMBLY32-NEXT:#define __ORDER_PDP_ENDIAN__ 3412 // WEBASSEMBLY32-NEXT:#define __POINTER_WIDTH__ 32 // WEBASSEMBLY32-NEXT:#define __PRAGMA_REDEFINE_EXTNAME 1 -// WEBASSEMBLY32-NEXT:#define __PTRDIFF_FMTd__ "d" -// WEBASSEMBLY32-NEXT:#define __PTRDIFF_FMTi__ "i" -// WEBASSEMBLY32-NEXT:#define __PTRDIFF_MAX__ 2147483647 -// WEBASSEMBLY32-NEXT:#define __PTRDIFF_TYPE__ int +// WEBASSEMBLY32-NEXT:#define __PTRDIFF_FMTd__ "ld" +// WEBASSEMBLY32-NEXT:#define __PTRDIFF_FMTi__ "li" +// WEBASSEMBLY32-NEXT:#define __PTRDIFF_MAX__ 2147483647L +// WEBASSEMBLY32-NEXT:#define __PTRDIFF_TYPE__ long int // WEBASSEMBLY32-NEXT:#define __PTRDIFF_WIDTH__ 32 // WEBASSEMBLY32-NOT:#define __REGISTER_PREFIX__ // WEBASSEMBLY32-NEXT:#define __SCHAR_MAX__ 127 @@ -9262,12 +9262,12 @@ // WEBASSEMBLY32-NEXT:#define __SIZEOF_SIZE_T__ 4 // WEBASSEMBLY32-NEXT:#define __SIZEOF_WCHAR_T__ 4 // WEBASSEMBLY32-NEXT:#define __SIZEOF_WINT_T__ 4 -// WEBASSEMBLY32-NEXT:#define __SIZE_FMTX__ "X" -// WEBASSEMBLY32-NEXT:#define __SIZE_FMTo__ "o" -// WEBASSEMBLY32-NEXT:#define __SIZE_FMTu__ "u" -// WEBASSEMBLY32-NEXT:#define __SIZE_FMTx__ "x" -// WEBASSEMBLY32-NEXT:#define __SIZE_MAX__ 4294967295U -// WEBASSEMBLY32-NEXT:#define __SIZE_TYPE__ unsigned int +// WEBASSEMBLY32-NEXT:#define __SIZE_FMTX__ "lX" +// WEBASSEMBLY32-NEXT:#define __SIZE_FMTo__ "lo" +// WEBASSEMBLY32-NEXT:#define __SIZE_FMTu__ "lu" +// WEBASSEMBLY32-NEXT:#define __SIZE_FMTx__ "lx" +// WEBASSEMBLY32-NEXT:#define __SIZE_MAX__ 4294967295UL +// WEBASSEMBLY32-NEXT:#define __SIZE_TYPE__ long unsigned int // WEBASSEMBLY32-NEXT:#define __SIZE_WIDTH__ 32 // WEBASSEMBLY32-NEXT:#define __STDC_HOSTED__ 0 // WEBASSEMBLY32-NOT:#define __STDC_MB_MIGHT_NEQ_WC__ @@ -9315,12 +9315,12 @@ // WEBASSEMBLY32-NEXT:#define __UINTMAX_MAX__ 18446744073709551615ULL // WEBASSEMBLY32-NEXT:#define __UINTMAX_TYPE__ long long unsigned int // WEBASSEMBLY32-NEXT:#define __UINTMAX_WIDTH__ 64 -// WEBASSEMBLY32-NEXT:#define __UINTPTR_FMTX__ "X" -// WEBASSEMBLY32-NEXT:#define __UINTPTR_FMTo__ "o" -// WEBASSEMBLY32-NEXT:#define __UINTPTR_FMTu__ "u" -// WEBASSEMBLY32-NEXT:#define __UINTPTR_FMTx__ "x" -// WEBASSEMBLY32-NEXT:#define __UINTPTR_MAX__ 4294967295U -// WEBASSEMBLY32-NEXT:#define __UINTPTR_TYPE__ unsigned int +// WEBASSEMBLY32-NEXT:#define __UINTPTR_FMTX__ "lX" +// WEBASSEMBLY32-NEXT:#define __UINTPTR_FMTo__ "lo" +// WEBASSEMBLY32-NEXT:#define __UINTPTR_FMTu__ "lu" +// WEBASSEMBLY32-NEXT:#define __UINTPTR_FMTx__ "lx" +// WEBASSEMBLY32-NEXT:#define __UINTPTR_MAX__ 4294967295UL +// WEBASSEMBLY32-NEXT:#define __UINTPTR_TYPE__ long unsigned int // WEBASSEMBLY32-NEXT:#define __UINTPTR_WIDTH__ 32 // WEBASSEMBLY32-NEXT:#define __UINT_FAST16_FMTX__ "hX" // WEBASSEMBLY32-NEXT:#define __UINT_FAST16_FMTo__ "ho" Index: lib/Basic/Targets/WebAssembly.h === --- lib/Basic/Targets/WebAssembly.h +++ lib/Basic/Targets/WebAssembly.h @@ -47,9 +47,11 @@ LongDoubleWidth = LongDoubleAlign = 128; LongDoubleFormat = ::APFloat::IEEEquad(); MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64; -SizeType = UnsignedInt; -PtrDiffType = SignedInt; -IntPtrType = SignedInt; +// size_t being unsigned long for both wasm32 and wasm64 makes mangled names +// more consistent between the two. +SizeType = UnsignedLong; +PtrDiffType = SignedLong; +IntPtrType = SignedLong; } protected: Index: test/Preprocessor/init.c === --- test/Preprocessor/init.c +++ test/Preprocessor/init.c @@ -9171,10 +9171,10 @@ // WEBASSEMBLY32-NEXT:#define __INTMAX_MAX__
[PATCH] D49656: [analyzer] Add support for more pointer invalidating functions in InnerPointerChecker
rnkovacs added inline comments. Comment at: lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp:213 + if (const auto *FC = dyn_cast()) { +const FunctionDecl *FD = FC->getDecl(); +for (unsigned I = 0, E = FD->getNumParams(); I != E; ++I) { xazax.hun wrote: > I am not sure if we always have a `Decl` here, I am afraid this might return > null sometimes. Please add a test case with a function pointer (received as > an argument in a top level function). Um, yes, I'd already seen a crash here on a project before I saw your comment. Thanks! Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:2934 +} else if (const auto *CallE = dyn_cast(S)) { + OS << CallE->getDirectCallee()->getNameAsString(); } xazax.hun wrote: > I think `getDirectCallee` might fail and return `nullptr`. One more reason to > test function pointers :) You're right. Also, it needed a bit more effort to dig up the function pointer's name. Or should I go further and somehow find out the name of the function it points to? https://reviews.llvm.org/D49656 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49656: [analyzer] Add support for more pointer invalidating functions in InnerPointerChecker
rnkovacs updated this revision to Diff 156938. rnkovacs marked 11 inline comments as done. rnkovacs added a comment. Addressed comments & added two test cases for function pointers. https://reviews.llvm.org/D49656 Files: lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp lib/StaticAnalyzer/Checkers/MallocChecker.cpp test/Analysis/inner-pointer.cpp Index: test/Analysis/inner-pointer.cpp === --- test/Analysis/inner-pointer.cpp +++ test/Analysis/inner-pointer.cpp @@ -38,6 +38,15 @@ typedef basic_string u16string; typedef basic_string u32string; +template< class T > +void func_ref(T& a); + +template< class T > +void func_const_ref(const T& a); + +template< class T > +void func_value(T a); + } // end namespace std void consume(const char *) {} @@ -277,6 +286,49 @@ // expected-note@-1 {{Use of memory after it is freed}} } +void STL_func_ref() { + const char *c; + std::string s; + c = s.c_str();// expected-note {{Dangling inner pointer obtained here}} + std::func_ref(s); // expected-note {{Inner pointer invalidated by call to 'func_ref'}} + consume(c);// expected-warning {{Use of memory after it is freed}} + // expected-note@-1 {{Use of memory after it is freed}} +} + +void STL_func_const_ref() { + const char *c; + std::string s; + c = s.c_str(); + std::func_const_ref(s); + consume(c); // no-warning +} + +void STL_func_value() { + const char *c; + std::string s; + c = s.c_str(); + std::func_value(s); + consume(c); // no-warning +} + +void func_ptr_known() { + const char *c; + std::string s; + void (*func_ptr)(std::string&) = std::func_ref; + c = s.c_str(); // expected-note {{Dangling inner pointer obtained here}} + func_ptr(s); // expected-note {{Inner pointer invalidated by call to 'func_ptr'}} + consume(c);// expected-warning {{Use of memory after it is freed}} + // expected-note@-1 {{Use of memory after it is freed}} +} + +void func_ptr_unknown(void (*func_ptr)(std::string&)) { + const char *c; + std::string s; + c = s.c_str(); + func_ptr(s); + consume(c); // no-warning +} + void deref_after_scope_ok(bool cond) { const char *c, *d; std::string s; Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp === --- lib/StaticAnalyzer/Checkers/MallocChecker.cpp +++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp @@ -2930,6 +2930,9 @@ OS << MemCallE->getMethodDecl()->getNameAsString(); } else if (const auto *OpCallE = dyn_cast(S)) { OS << OpCallE->getDirectCallee()->getNameAsString(); +} else if (const auto *CallE = dyn_cast(S)) { + const auto *D = dyn_cast_or_null(CallE->getCalleeDecl()); + OS << (D ? D->getNameAsString() : "unknown"); } OS << "'"; } Index: lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp === --- lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp +++ lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp @@ -91,37 +91,29 @@ ReserveFn("reserve"), ResizeFn("resize"), ShrinkToFitFn("shrink_to_fit"), SwapFn("swap") {} - /// Check whether the function called on the container object is a - /// member function that potentially invalidates pointers referring - /// to the objects's internal buffer. - bool mayInvalidateBuffer(const CallEvent ) const; - - /// Record the connection between the symbol returned by c_str() and the - /// corresponding string object region in the ProgramState. Mark the symbol - /// released if the string object is destroyed. + /// Check whether the called member function potentially invalidates + /// pointers referring to the container object's inner buffer. + bool isInvalidatingMemberFunction(const CallEvent ) const; + + /// Mark pointer symbols associated with the given memory region released + /// in the program state. + void markPtrSymbolsReleased(const CallEvent , ProgramStateRef State, + const MemRegion *ObjRegion, + CheckerContext ) const; + + /// Record the connection between raw pointers referring to a container + /// object's inner buffer and the object's memory region in the program state. + /// Mark potentially invalidated pointers released. void checkPostCall(const CallEvent , CheckerContext ) const; - /// Clean up the ProgramState map. + /// Clean up the program state map. void checkDeadSymbols(SymbolReaper , CheckerContext ) const; }; } // end anonymous namespace -// [string.require] -// -// "References, pointers, and iterators referring to the elements of a -// basic_string sequence may be invalidated by the following uses of that -// basic_string object: -// -// -- TODO: As an argument to any standard library function taking a reference -// to non-const basic_string as an
[PATCH] D49067: Stop wrapping __has_include in another macro
mclow.lists accepted this revision. mclow.lists added inline comments. This revision is now accepted and ready to land. Comment at: include/__config:153 +#ifndef __has_include +#define __has_include(...) 0 #endif rsmith wrote: > arichardson wrote: > > EricWF wrote: > > > I do prefer not hijacking this name, but if it's needed to make things > > > work, then it's OK with me. > > > > > > @mclow.lists Are you OK if we steal this identifier and `#define` it > > > ourselves. > > This is the correct way of dealing with missing `__has_include()` according > > to @rsmith > If you would prefer to not define this name yourself, the other option would > be to replace all uses of `__has_include(blah)` with > > ``` > #ifdef __has_include > #if __has_include(blah) > //... > #endif > #endif > ``` Agreed with @EricWF in general - we prefer to wrap rather than hijack other people's names. However, we can't wrap here, so I'm ok with the hijack. Repository: rCXX libc++ https://reviews.llvm.org/D49067 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337782 - Revert r337727 as it caused Darwin bot failures
Author: arphaman Date: Mon Jul 23 17:27:31 2018 New Revision: 337782 URL: http://llvm.org/viewvc/llvm-project?rev=337782=rev Log: Revert r337727 as it caused Darwin bot failures Modified: libcxx/trunk/CMakeLists.txt Modified: libcxx/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=337782=337781=337782=diff == --- libcxx/trunk/CMakeLists.txt (original) +++ libcxx/trunk/CMakeLists.txt Mon Jul 23 17:27:31 2018 @@ -378,7 +378,7 @@ endif () set(LIBCXX_COMPILER${CMAKE_CXX_COMPILER}) set(LIBCXX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(LIBCXX_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) -set(LIBCXX_HEADER_DIR ${LIBCXX_BINARY_DIR}) +set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR}) set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build") string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49067: Stop wrapping __has_include in another macro
rsmith added inline comments. Comment at: include/__config:153 +#ifndef __has_include +#define __has_include(...) 0 #endif arichardson wrote: > EricWF wrote: > > I do prefer not hijacking this name, but if it's needed to make things > > work, then it's OK with me. > > > > @mclow.lists Are you OK if we steal this identifier and `#define` it > > ourselves. > This is the correct way of dealing with missing `__has_include()` according > to @rsmith If you would prefer to not define this name yourself, the other option would be to replace all uses of `__has_include(blah)` with ``` #ifdef __has_include #if __has_include(blah) //... #endif #endif ``` Comment at: include/__config:1062-1075 # if defined(__FreeBSD__) || \ defined(__Fuchsia__) || \ defined(__NetBSD__) || \ defined(__linux__) || \ defined(__APPLE__) || \ defined(__CloudABI__) || \ defined(__sun__) || \ Example: ``` #if defined(__MINGW32__) && defined(__has_include) #if __has_include() #define _LIBCPP_MINGW32_HAS_PTHREAD #endif #endif #if defined(__FreeBSD__) || \ // [...] defined(__sun__) || \ defined(_LIBCPP_MINGW32_HAS_PTHREAD) ``` Repository: rCXX libc++ https://reviews.llvm.org/D49067 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49628: [CMake] Link static libunwind and libc++abi into libc++ in Fuchsia toolchain
jakehehrlich accepted this revision. jakehehrlich added a comment. This revision is now accepted and ready to land. LGTM Repository: rC Clang https://reviews.llvm.org/D49628 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r337780 - NFC: Add the emacs c++ mode hint "-*- C++ -*-" to the headers that don't have it
Author: epilk Date: Mon Jul 23 17:07:49 2018 New Revision: 337780 URL: http://llvm.org/viewvc/llvm-project?rev=337780=rev Log: NFC: Add the emacs c++ mode hint "-*- C++ -*-" to the headers that don't have it https://llvm.org/docs/CodingStandards.html#file-headers Modified: cfe/trunk/include/clang/AST/TypeOrdering.h cfe/trunk/include/clang/Basic/CharInfo.h cfe/trunk/include/clang/CodeGen/SwiftCallingConv.h cfe/trunk/include/clang/Frontend/LayoutOverrideSource.h cfe/trunk/include/clang/Frontend/SerializedDiagnosticPrinter.h cfe/trunk/include/clang/Index/IndexDataConsumer.h cfe/trunk/include/clang/Index/IndexSymbol.h cfe/trunk/include/clang/Index/IndexingAction.h cfe/trunk/include/clang/Index/USRGeneration.h cfe/trunk/include/clang/Sema/SemaFixItUtils.h cfe/trunk/lib/Basic/Targets.h cfe/trunk/lib/Basic/Targets/Sparc.h cfe/trunk/lib/Format/BreakableToken.h cfe/trunk/lib/Format/Encoding.h Modified: cfe/trunk/include/clang/AST/TypeOrdering.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TypeOrdering.h?rev=337780=337779=337780=diff == --- cfe/trunk/include/clang/AST/TypeOrdering.h (original) +++ cfe/trunk/include/clang/AST/TypeOrdering.h Mon Jul 23 17:07:49 2018 @@ -1,4 +1,4 @@ -//===-- TypeOrdering.h - Total ordering for types -===// +//===-- TypeOrdering.h - Total ordering for types ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // Modified: cfe/trunk/include/clang/Basic/CharInfo.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/CharInfo.h?rev=337780=337779=337780=diff == --- cfe/trunk/include/clang/Basic/CharInfo.h (original) +++ cfe/trunk/include/clang/Basic/CharInfo.h Mon Jul 23 17:07:49 2018 @@ -1,4 +1,4 @@ -//===--- clang/Basic/CharInfo.h - Classifying ASCII Characters ===// +//===--- clang/Basic/CharInfo.h - Classifying ASCII Characters --*- C++ -*-===// // // The LLVM Compiler Infrastructure // Modified: cfe/trunk/include/clang/CodeGen/SwiftCallingConv.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CodeGen/SwiftCallingConv.h?rev=337780=337779=337780=diff == --- cfe/trunk/include/clang/CodeGen/SwiftCallingConv.h (original) +++ cfe/trunk/include/clang/CodeGen/SwiftCallingConv.h Mon Jul 23 17:07:49 2018 @@ -1,4 +1,4 @@ -//==-- SwiftCallingConv.h - Swift ABI lowering -==// +//==-- SwiftCallingConv.h - Swift ABI lowering --*- C++ -*-===// // // The LLVM Compiler Infrastructure // Modified: cfe/trunk/include/clang/Frontend/LayoutOverrideSource.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/LayoutOverrideSource.h?rev=337780=337779=337780=diff == --- cfe/trunk/include/clang/Frontend/LayoutOverrideSource.h (original) +++ cfe/trunk/include/clang/Frontend/LayoutOverrideSource.h Mon Jul 23 17:07:49 2018 @@ -1,4 +1,4 @@ -//===--- LayoutOverrideSource.h --Override Record Layouts -===// +//===--- LayoutOverrideSource.h --Override Record Layouts ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // Modified: cfe/trunk/include/clang/Frontend/SerializedDiagnosticPrinter.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/SerializedDiagnosticPrinter.h?rev=337780=337779=337780=diff == --- cfe/trunk/include/clang/Frontend/SerializedDiagnosticPrinter.h (original) +++ cfe/trunk/include/clang/Frontend/SerializedDiagnosticPrinter.h Mon Jul 23 17:07:49 2018 @@ -1,4 +1,4 @@ -//===--- SerializedDiagnosticPrinter.h - Serializer for diagnostics ---===// +//===--- SerializedDiagnosticPrinter.h - Diagnostics serializer -*- C++ -*-===// // // The LLVM Compiler Infrastructure // Modified: cfe/trunk/include/clang/Index/IndexDataConsumer.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Index/IndexDataConsumer.h?rev=337780=337779=337780=diff == --- cfe/trunk/include/clang/Index/IndexDataConsumer.h (original) +++ cfe/trunk/include/clang/Index/IndexDataConsumer.h Mon Jul 23 17:07:49 2018 @@ -1,4 +1,4 @@ -//===--- IndexDataConsumer.h - Abstract index data consumer ---===// +//===--- IndexDataConsumer.h - Abstract index data consumer -*- C++ -*-===// // // The LLVM Compiler Infrastructure // Modified: cfe/trunk/include/clang/Index/IndexSymbol.h URL:
[PATCH] D46013: [ARM] Conform to AAPCS when passing overaligned composites as arguments
efriedma added inline comments. Comment at: lib/AST/ASTContext.cpp:2088 + default: +UnadjustedAlign = getTypeAlign(T); + } This "default" isn't right; there are a lot of non-canonical types which need to be handled here (which getTypeAlign handles, but this doesn't). Could you just write something like `if (const auto *RTy = T->getAs()) [...] else return getTypeAlign(T);`? https://reviews.llvm.org/D46013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r337776 - [analyzer] Add a no-crash to a recently added test.
Author: dergachev Date: Mon Jul 23 16:48:13 2018 New Revision: 337776 URL: http://llvm.org/viewvc/llvm-project?rev=337776=rev Log: [analyzer] Add a no-crash to a recently added test. No functional change intended. Modified: cfe/trunk/test/Analysis/casts.c Modified: cfe/trunk/test/Analysis/casts.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/casts.c?rev=337776=337775=337776=diff == --- cfe/trunk/test/Analysis/casts.c (original) +++ cfe/trunk/test/Analysis/casts.c Mon Jul 23 16:48:13 2018 @@ -173,5 +173,5 @@ void testCastVoidPtrToIntPtrThroughUIntT } void testLocNonLocSymbolAssume(int a, int *b) { - if ((int)b < a) {} + if ((int)b < a) {} // no-crash } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49338: Implement - P0122R7
ldionne accepted this revision. ldionne added a comment. This revision is now accepted and ready to land. LGTM, with a suggestion for adding one test. Comment at: include/span:189 +struct __is_span_compatible_container<_Tp, _ElementType, +void_t< +// is not a specialization of span ldionne wrote: > You seem to be missing the following condition from the paper: > `is_array_v is false`. Are you omitting it because the array > overloads would take precedence over this constructor if an array were > passed? If so, I think there's a bug since you could be passing an array of > incorrect size and this constructor would kick in. The overload for > `ElementType(*)[N]` would be discarded because of a mismatched `N`, but this > one wouldn't (I think). > > If I'm right, this would turn what should be a compilation failure into a > runtime error with the `_LIBCPP_ASSERT(_Extent == _VSTD::size(__c))`. Consider adding a test for this. https://reviews.llvm.org/D49338 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49704: Fix typo in test/CodeGen/Mips/dins.ll
This revision was automatically updated to reflect the committed changes. Closed by commit rL337771: Fix typo in test/CodeGen/Mips/dins.ll (authored by thomasanderson, committed by ). Herald added subscribers: llvm-commits, jrtc27. Changed prior to commit: https://reviews.llvm.org/D49704?vs=156907=156917#toc Repository: rL LLVM https://reviews.llvm.org/D49704 Files: llvm/trunk/test/CodeGen/Mips/dins.ll Index: llvm/trunk/test/CodeGen/Mips/dins.ll === --- llvm/trunk/test/CodeGen/Mips/dins.ll +++ llvm/trunk/test/CodeGen/Mips/dins.ll @@ -14,17 +14,17 @@ ; struct { ; unsigned long long addr :37; ; unsigned long long addr1 :15; -; unsigned int lenght:14; +; unsigned int length:14; ; uint64_t total_bytes:16; ; uint64_t segs : 6; ; } s; ; } ; ; unsigned long long foo(volatile struct cvmx_buf_ptr bufptr) { ; bufptr.s.addr = 123; ; bufptr.s.segs = 4; -; bufptr.s.lenght = 5; -; bufptr.s.total_bytes = bufptr.s.lenght; +; bufptr.s.length = 5; +; bufptr.s.total_bytes = bufptr.s.length; ; return bufptr.s.addr; ; } Index: llvm/trunk/test/CodeGen/Mips/dins.ll === --- llvm/trunk/test/CodeGen/Mips/dins.ll +++ llvm/trunk/test/CodeGen/Mips/dins.ll @@ -14,17 +14,17 @@ ; struct { ; unsigned long long addr :37; ; unsigned long long addr1 :15; -; unsigned int lenght:14; +; unsigned int length:14; ; uint64_t total_bytes:16; ; uint64_t segs : 6; ; } s; ; } ; ; unsigned long long foo(volatile struct cvmx_buf_ptr bufptr) { ; bufptr.s.addr = 123; ; bufptr.s.segs = 4; -; bufptr.s.lenght = 5; -; bufptr.s.total_bytes = bufptr.s.lenght; +; bufptr.s.length = 5; +; bufptr.s.total_bytes = bufptr.s.length; ; return bufptr.s.addr; ; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49703: [analyzer] pr38273: Admit that we can't handle the newly produced Loc<>NonLoc comparisons.
This revision was automatically updated to reflect the committed changes. Closed by commit rC337769: [analyzer] pr38273: Legalize LocNonLoc comparison symbols. (authored by dergachev, committed by ). Repository: rC Clang https://reviews.llvm.org/D49703 Files: lib/StaticAnalyzer/Core/RangeConstraintManager.cpp test/Analysis/casts.c Index: lib/StaticAnalyzer/Core/RangeConstraintManager.cpp === --- lib/StaticAnalyzer/Core/RangeConstraintManager.cpp +++ lib/StaticAnalyzer/Core/RangeConstraintManager.cpp @@ -343,9 +343,11 @@ if (BinaryOperator::isEqualityOp(SSE->getOpcode()) || BinaryOperator::isRelationalOp(SSE->getOpcode())) { // We handle Loc <> Loc comparisons, but not (yet) NonLoc <> NonLoc. +// We've recently started producing Loc <> NonLoc comparisons (that +// result from casts of one of the operands between eg. intptr_t and +// void *), but we can't reason about them yet. if (Loc::isLocType(SSE->getLHS()->getType())) { - assert(Loc::isLocType(SSE->getRHS()->getType())); - return true; + return Loc::isLocType(SSE->getRHS()->getType()); } } } Index: test/Analysis/casts.c === --- test/Analysis/casts.c +++ test/Analysis/casts.c @@ -171,3 +171,7 @@ (*((int *)())) = (int)(unsigned *)getVoidPtr(); *x = 1; // no-crash } + +void testLocNonLocSymbolAssume(int a, int *b) { + if ((int)b < a) {} +} Index: lib/StaticAnalyzer/Core/RangeConstraintManager.cpp === --- lib/StaticAnalyzer/Core/RangeConstraintManager.cpp +++ lib/StaticAnalyzer/Core/RangeConstraintManager.cpp @@ -343,9 +343,11 @@ if (BinaryOperator::isEqualityOp(SSE->getOpcode()) || BinaryOperator::isRelationalOp(SSE->getOpcode())) { // We handle Loc <> Loc comparisons, but not (yet) NonLoc <> NonLoc. +// We've recently started producing Loc <> NonLoc comparisons (that +// result from casts of one of the operands between eg. intptr_t and +// void *), but we can't reason about them yet. if (Loc::isLocType(SSE->getLHS()->getType())) { - assert(Loc::isLocType(SSE->getRHS()->getType())); - return true; + return Loc::isLocType(SSE->getRHS()->getType()); } } } Index: test/Analysis/casts.c === --- test/Analysis/casts.c +++ test/Analysis/casts.c @@ -171,3 +171,7 @@ (*((int *)())) = (int)(unsigned *)getVoidPtr(); *x = 1; // no-crash } + +void testLocNonLocSymbolAssume(int a, int *b) { + if ((int)b < a) {} +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48896: [libcxx][c++17] P0083R5: Splicing Maps and Sets Part 2: merge
erik.pilkington updated this revision to Diff 156912. erik.pilkington added a comment. In this new patch: - Rebase on top of changes in https://reviews.llvm.org/D46845 - Move in some forward decls that I accidentally left in https://reviews.llvm.org/D46845 - Add some missing visibility attributes - Add `merge` to header summaries https://reviews.llvm.org/D48896 Files: libcxx/include/__hash_table libcxx/include/__tree libcxx/include/map libcxx/include/set libcxx/include/unordered_map libcxx/include/unordered_set libcxx/test/std/containers/associative/map/map.modifiers/merge.pass.cpp libcxx/test/std/containers/associative/multimap/multimap.modifiers/merge.pass.cpp libcxx/test/std/containers/associative/multiset/merge.pass.cpp libcxx/test/std/containers/associative/set/merge.pass.cpp libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/merge.pass.cpp libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/merge.pass.cpp libcxx/test/std/containers/unord/unord.multiset/merge.pass.cpp libcxx/test/std/containers/unord/unord.set/merge.pass.cpp Index: libcxx/test/std/containers/unord/unord.set/merge.pass.cpp === --- /dev/null +++ libcxx/test/std/containers/unord/unord.set/merge.pass.cpp @@ -0,0 +1,135 @@ +//===--===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===--===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// + +// class unordered_set + +// template +// void merge(unordered_set& source); + +#include +#include "test_macros.h" +#include "Counter.h" + +template +bool set_equal(const Set& set, Set other) +{ +return set == other; +} + +#ifndef TEST_HAS_NO_EXCEPTIONS +template +struct throw_hasher +{ +bool& should_throw_; + +throw_hasher(bool& should_throw) : should_throw_(should_throw) {} + +typedef size_t result_type; +typedef T argument_type; + +size_t operator()(const T& p) const +{ +if (should_throw_) +throw 0; +return std::hash()(p); +} +}; +#endif + +int main() +{ +{ +std::unordered_set src{1, 3, 5}; +std::unordered_set dst{2, 4, 5}; +dst.merge(src); +assert(set_equal(src, {5})); +assert(set_equal(dst, {1, 2, 3, 4, 5})); +} + +#ifndef TEST_HAS_NO_EXCEPTIONS +{ +bool do_throw = false; +typedef std::unordered_set, throw_hasher>> set_type; +set_type src({1, 3, 5}, 0, throw_hasher>(do_throw)); +set_type dst({2, 4, 5}, 0, throw_hasher>(do_throw)); + +assert(Counter_base::gConstructed == 6); + +do_throw = true; +try +{ +dst.merge(src); +} +catch (int) +{ +do_throw = false; +} +assert(!do_throw); +assert(set_equal(src, set_type({1, 3, 5}, 0, throw_hasher>(do_throw; +assert(set_equal(dst, set_type({2, 4, 5}, 0, throw_hasher>(do_throw; +} +#endif +assert(Counter_base::gConstructed == 0); +struct equal +{ +equal() = default; + +bool operator()(const Counter& lhs, const Counter& rhs) const +{ +return lhs == rhs; +} +}; +struct hasher +{ +hasher() = default; +typedef Counter argument_type; +typedef size_t result_type; +size_t operator()(const Counter& p) const { return std::hash>()(p); } +}; +{ +typedef std::unordered_set, std::hash>, std::equal_to>> first_set_type; +typedef std::unordered_set, hasher, equal> second_set_type; +typedef std::unordered_multiset, hasher, equal> third_set_type; + +first_set_type first{1, 2, 3}; +second_set_type second{2, 3, 4}; +third_set_type third{1, 3}; + +assert(Counter_base::gConstructed == 8); + +first.merge(second); +first.merge(std::move(second)); +first.merge(third); +first.merge(std::move(third)); + +assert(set_equal(first, {1, 2, 3, 4})); +assert(set_equal(second, {2, 3})); +assert(set_equal(third, {1, 3})); + +assert(Counter_base::gConstructed == 8); +} +assert(Counter_base::gConstructed == 0); +{ +std::unordered_set first; +{ +std::unordered_set second; +first.merge(second); +first.merge(std::move(second)); +} +{ +std::unordered_multiset second; +first.merge(second); +first.merge(std::move(second)); +} +} +} Index: libcxx/test/std/containers/unord/unord.multiset/merge.pass.cpp
r337769 - [analyzer] pr38273: Legalize Loc<>NonLoc comparison symbols.
Author: dergachev Date: Mon Jul 23 16:09:44 2018 New Revision: 337769 URL: http://llvm.org/viewvc/llvm-project?rev=337769=rev Log: [analyzer] pr38273: Legalize Loc<>NonLoc comparison symbols. Remove an assertion in RangeConstraintManager that expects such symbols to never appear, while admitting that the constraint manager doesn't yet handle them. Differential Revision: https://reviews.llvm.org/D49703 Modified: cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp cfe/trunk/test/Analysis/casts.c Modified: cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp?rev=337769=337768=337769=diff == --- cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp Mon Jul 23 16:09:44 2018 @@ -343,9 +343,11 @@ bool RangeConstraintManager::canReasonAb if (BinaryOperator::isEqualityOp(SSE->getOpcode()) || BinaryOperator::isRelationalOp(SSE->getOpcode())) { // We handle Loc <> Loc comparisons, but not (yet) NonLoc <> NonLoc. +// We've recently started producing Loc <> NonLoc comparisons (that +// result from casts of one of the operands between eg. intptr_t and +// void *), but we can't reason about them yet. if (Loc::isLocType(SSE->getLHS()->getType())) { - assert(Loc::isLocType(SSE->getRHS()->getType())); - return true; + return Loc::isLocType(SSE->getRHS()->getType()); } } } Modified: cfe/trunk/test/Analysis/casts.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/casts.c?rev=337769=337768=337769=diff == --- cfe/trunk/test/Analysis/casts.c (original) +++ cfe/trunk/test/Analysis/casts.c Mon Jul 23 16:09:44 2018 @@ -171,3 +171,7 @@ void testCastVoidPtrToIntPtrThroughUIntT (*((int *)())) = (int)(unsigned *)getVoidPtr(); *x = 1; // no-crash } + +void testLocNonLocSymbolAssume(int a, int *b) { + if ((int)b < a) {} +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48786: [Preprocessor] Stop entering included files after hitting a fatal error.
vsapsai updated this revision to Diff 156911. vsapsai added a comment. - Tweak the comment according to review comments. Undiscussed changes: we don't stop preprocessing entirely, only in included files; not using better-sounding "skip" deliberately as it might be confused with `FileSkipped` API. https://reviews.llvm.org/D48786 Files: clang/lib/Lex/PPDirectives.cpp clang/test/Preprocessor/Inputs/cycle/a.h clang/test/Preprocessor/Inputs/cycle/b.h clang/test/Preprocessor/Inputs/cycle/c.h clang/test/Preprocessor/include-cycle.c Index: clang/test/Preprocessor/include-cycle.c === --- /dev/null +++ clang/test/Preprocessor/include-cycle.c @@ -0,0 +1,5 @@ +// RUN: not %clang_cc1 -E -I%S/Inputs -ferror-limit 20 %s + +// Test that preprocessing terminates even if we have inclusion cycles. + +#include "cycle/a.h" Index: clang/test/Preprocessor/Inputs/cycle/c.h === --- /dev/null +++ clang/test/Preprocessor/Inputs/cycle/c.h @@ -0,0 +1 @@ +#include "a.h" Index: clang/test/Preprocessor/Inputs/cycle/b.h === --- /dev/null +++ clang/test/Preprocessor/Inputs/cycle/b.h @@ -0,0 +1 @@ +#include "a.h" Index: clang/test/Preprocessor/Inputs/cycle/a.h === --- /dev/null +++ clang/test/Preprocessor/Inputs/cycle/a.h @@ -0,0 +1,8 @@ +// Presence of 2 inclusion cycles +//b.h -> a.h -> b.h -> ... +//c.h -> a.h -> c.h -> ... +// makes it unfeasible to reach max inclusion depth in all possible ways. Need +// to stop earlier. + +#include "b.h" +#include "c.h" Index: clang/lib/Lex/PPDirectives.cpp === --- clang/lib/Lex/PPDirectives.cpp +++ clang/lib/Lex/PPDirectives.cpp @@ -1871,6 +1871,12 @@ if (PPOpts->SingleFileParseMode) ShouldEnter = false; + // Any diagnostics after the fatal error will not be visible. As the + // compilation failed already and errors in subsequently included files won't + // be visible, avoid preprocessing those files. + if (ShouldEnter && Diags->hasFatalErrorOccurred()) +ShouldEnter = false; + // Determine whether we should try to import the module for this #include, if // there is one. Don't do so if precompiled module support is disabled or we // are processing this module textually (because we're building the module). Index: clang/test/Preprocessor/include-cycle.c === --- /dev/null +++ clang/test/Preprocessor/include-cycle.c @@ -0,0 +1,5 @@ +// RUN: not %clang_cc1 -E -I%S/Inputs -ferror-limit 20 %s + +// Test that preprocessing terminates even if we have inclusion cycles. + +#include "cycle/a.h" Index: clang/test/Preprocessor/Inputs/cycle/c.h === --- /dev/null +++ clang/test/Preprocessor/Inputs/cycle/c.h @@ -0,0 +1 @@ +#include "a.h" Index: clang/test/Preprocessor/Inputs/cycle/b.h === --- /dev/null +++ clang/test/Preprocessor/Inputs/cycle/b.h @@ -0,0 +1 @@ +#include "a.h" Index: clang/test/Preprocessor/Inputs/cycle/a.h === --- /dev/null +++ clang/test/Preprocessor/Inputs/cycle/a.h @@ -0,0 +1,8 @@ +// Presence of 2 inclusion cycles +//b.h -> a.h -> b.h -> ... +//c.h -> a.h -> c.h -> ... +// makes it unfeasible to reach max inclusion depth in all possible ways. Need +// to stop earlier. + +#include "b.h" +#include "c.h" Index: clang/lib/Lex/PPDirectives.cpp === --- clang/lib/Lex/PPDirectives.cpp +++ clang/lib/Lex/PPDirectives.cpp @@ -1871,6 +1871,12 @@ if (PPOpts->SingleFileParseMode) ShouldEnter = false; + // Any diagnostics after the fatal error will not be visible. As the + // compilation failed already and errors in subsequently included files won't + // be visible, avoid preprocessing those files. + if (ShouldEnter && Diags->hasFatalErrorOccurred()) +ShouldEnter = false; + // Determine whether we should try to import the module for this #include, if // there is one. Don't do so if precompiled module support is disabled or we // are processing this module textually (because we're building the module). ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r337669 - Use possibly cached directory entry values when performing recursive directory iteration.
Sorry for the repeated emails. I did more digging and we were indeed handling DT_UNKNOWN incorrectly. I've fixed that in r337768. /Eric On Mon, Jul 23, 2018 at 4:43 PM Eric Fiselier wrote: > Hi Jonas, > > I believe I fixed the issue, and I've recommitted the change as r337765. > Please let me know if you still see the failures. I think there might be a > lingering issues with how we handle DT_UNKNOWN. > > /Eric > > On Mon, Jul 23, 2018 at 3:53 PM Eric Fiselier wrote: > >> I think I've found the bug, but I need to spend some more time on it. >> >> I've reverted in for now in r337749. >> >> /Eric >> >> On Mon, Jul 23, 2018 at 1:25 PM Eric Fiselier wrote: >> >>> Thanks. I'm looking into this. >>> >>> /Eric >>> >>> On Mon, Jul 23, 2018 at 12:58 PM Jonas Hahnfeld >>> wrote: >>> Hi Eric, this breaks test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp for me: In access_denied_on_recursion_test_case():176 Assertion TEST_CHECK(ec) failed. in file: <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp In access_denied_on_recursion_test_case():177 Assertion TEST_CHECK(it == endIt) failed. in file: <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp In access_denied_on_recursion_test_case():189 Assertion TEST_REQUIRE_THROW(filesystem_error,++it) failed. in file: <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp In test_PR35078():285 Assertion TEST_REQUIRE(it != endIt) failed. in file: <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp In test_PR35078_with_symlink():384 Assertion TEST_CHECK(ec) failed. in file: <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp In test_PR35078_with_symlink():385 Assertion TEST_CHECK(ec == eacess_ec) failed. in file: <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp In test_PR35078_with_symlink_file():461 Assertion TEST_CHECK(*it == symFile) failed. in file: <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp In test_PR35078_with_symlink_file():467 Assertion TEST_REQUIRE(it != EndIt) failed. in file: <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp Summary for testsuite recursive_directory_iterator_increment_tests: 5 of 9 test cases passed. 156 of 164 assertions passed. 0 unsupported test cases. Do you have an idea? I'm on a local XFS mount, the sources are on NFS... Thanks, Jonas On 2018-07-23 06:55, Eric Fiselier via cfe-commits wrote: > Author: ericwf > Date: Sun Jul 22 21:55:57 2018 > New Revision: 337669 > > URL: http://llvm.org/viewvc/llvm-project?rev=337669=rev > Log: > Use possibly cached directory entry values when performing recursive > directory iteration. > > Modified: > libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp > > Modified: > libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp?rev=337669=337668=337669=diff > == > --- libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp > (original) > +++ libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp > Sun Jul 22 21:55:57 2018 > @@ -359,13 +359,13 @@ bool recursive_directory_iterator::__try >bool skip_rec = false; >std::error_code m_ec; >if (!rec_sym) { > -file_status st = curr_it.__entry_.symlink_status(m_ec); > +file_status st(curr_it.__entry_.__get_sym_ft(_ec)); > if (m_ec && status_known(st)) >m_ec.clear(); > if (m_ec || is_symlink(st) || !is_directory(st)) >skip_rec = true; >} else { > -file_status st = curr_it.__entry_.status(m_ec); > +file_status st(curr_it.__entry_.__get_ft(_ec)); > if (m_ec && status_known(st)) >m_ec.clear(); > if (m_ec || !is_directory(st)) > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org >
[libcxx] r337768 - Handle DT_UNKNOWN correctly during directory iteration.
Author: ericwf Date: Mon Jul 23 15:58:46 2018 New Revision: 337768 URL: http://llvm.org/viewvc/llvm-project?rev=337768=rev Log: Handle DT_UNKNOWN correctly during directory iteration. Unlike stat and lstat, where unknown really means we know it's something weird, during directory iteration DT_UNKNOWN simply means that the underlying FS doesn't support the dirent::dt_type field. This patch fixes libc++ to correctly set the cache to empty when DT_UNKNOWN is reported. Modified: libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp Modified: libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp?rev=337768=337767=337768=diff == --- libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp (original) +++ libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp Mon Jul 23 15:58:46 2018 @@ -42,8 +42,11 @@ static file_type get_file_type(DirEntT * return file_type::regular; case DT_SOCK: return file_type::socket; + // Unlike in lstat, hitting "unknown" here simply means that the underlying + // filesystem doesn't support d_type. Report is as 'none' so we correctly + // set the cache to empty. case DT_UNKNOWN: -return file_type::unknown; +break; } return file_type::none; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r337767 - Support lifetime-extension of conditional temporaries.
Author: rsmith Date: Mon Jul 23 15:56:45 2018 New Revision: 337767 URL: http://llvm.org/viewvc/llvm-project?rev=337767=rev Log: Support lifetime-extension of conditional temporaries. Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/CodeGen/CGCleanup.cpp cfe/trunk/lib/CodeGen/CGDecl.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.h cfe/trunk/lib/Sema/SemaInit.cpp cfe/trunk/test/CodeGenCXX/temporaries.cpp cfe/trunk/test/SemaCXX/conditional-expr.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=337767=337766=337767=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Jul 23 15:56:45 2018 @@ -7897,14 +7897,12 @@ def warn_new_dangling_initializer_list : InGroup; def warn_unsupported_temporary_not_extended : Warning< "sorry, lifetime extension of temporary created " - "%select{by aggregate initialization using default member initializer|" - "within conditional expression}0 " + "by aggregate initialization using default member initializer " "is not supported; lifetime of temporary " "will end at the end of the full-expression">, InGroup; def warn_unsupported_init_list_not_extended : Warning< "sorry, lifetime extension of backing array of initializer list created " - "%select{by aggregate initialization using default member initializer|" - "within conditional expression}0 " + "by aggregate initialization using default member initializer " "is not supported; lifetime of backing array will end at the end of the " "full-expression">, InGroup; Modified: cfe/trunk/lib/CodeGen/CGCleanup.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCleanup.cpp?rev=337767=337766=337767=diff == --- cfe/trunk/lib/CodeGen/CGCleanup.cpp (original) +++ cfe/trunk/lib/CodeGen/CGCleanup.cpp Mon Jul 23 15:56:45 2018 @@ -281,7 +281,7 @@ void EHScopeStack::popNullFixups() { BranchFixups.pop_back(); } -void CodeGenFunction::initFullExprCleanup() { +Address CodeGenFunction::createCleanupActiveFlag() { // Create a variable to decide whether the cleanup needs to be run. Address active = CreateTempAllocaWithoutCast( Builder.getInt1Ty(), CharUnits::One(), "cleanup.cond"); @@ -293,10 +293,14 @@ void CodeGenFunction::initFullExprCleanu // Initialize it to true at the current location. Builder.CreateStore(Builder.getTrue(), active); + return active; +} + +void CodeGenFunction::initFullExprCleanupWithFlag(Address ActiveFlag) { // Set that as the active flag in the cleanup. EHCleanupScope = cast(*EHStack.begin()); assert(!cleanup.hasActiveFlag() && "cleanup already has active flag?"); - cleanup.setActiveFlag(active); + cleanup.setActiveFlag(ActiveFlag); if (cleanup.isNormalCleanup()) cleanup.setTestFlagInNormalCleanup(); if (cleanup.isEHCleanup()) cleanup.setTestFlagInEHCleanup(); @@ -494,6 +498,13 @@ void CodeGenFunction::PopCleanupBlocks( [I], Header.getSize()); I += Header.getSize(); + +if (Header.isConditional()) { + Address ActiveFlag = + reinterpret_cast(LifetimeExtendedCleanupStack[I]); + initFullExprCleanupWithFlag(ActiveFlag); + I += sizeof(ActiveFlag); +} } LifetimeExtendedCleanupStack.resize(OldLifetimeExtendedSize); } Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=337767=337766=337767=diff == --- cfe/trunk/lib/CodeGen/CGDecl.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDecl.cpp Mon Jul 23 15:56:45 2018 @@ -1651,9 +1651,6 @@ void CodeGenFunction::pushStackRestore(C void CodeGenFunction::pushLifetimeExtendedDestroy( CleanupKind cleanupKind, Address addr, QualType type, Destroyer *destroyer, bool useEHCleanupForArray) { - assert(!isInConditionalBranch() && - "performing lifetime extension from within conditional"); - // Push an EH-only cleanup for the object now. // FIXME: When popping normal cleanups, we need to keep this EH cleanup // around in case a temporary's destructor throws an exception. Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=337767=337766=337767=diff == --- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original) +++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Mon Jul 23 15:56:45 2018 @@ -138,6 +138,88 @@ enum SanitizerHandler { #undef SANITIZER_CHECK }; +/// Helper class with most of the code
[PATCH] D49704: Fix typo in test/CodeGen/Mips/dins.ll
pcc accepted this revision. pcc added a comment. This revision is now accepted and ready to land. LGTM https://reviews.llvm.org/D49704 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49704: Fix typo in test/CodeGen/Mips/dins.ll
thomasanderson added a comment. pcc ptal I've been granted commit-after-approval, and this is my test CL. https://reviews.llvm.org/D49704 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49704: Fix typo in test/CodeGen/Mips/dins.ll
thomasanderson created this revision. thomasanderson added a reviewer: pcc. Herald added subscribers: atanasyan, arichardson, sdardis. https://reviews.llvm.org/D49704 Files: test/CodeGen/Mips/dins.ll Index: test/CodeGen/Mips/dins.ll === --- test/CodeGen/Mips/dins.ll +++ test/CodeGen/Mips/dins.ll @@ -14,17 +14,17 @@ ; struct { ; unsigned long long addr :37; ; unsigned long long addr1 :15; -; unsigned int lenght:14; +; unsigned int length:14; ; uint64_t total_bytes:16; ; uint64_t segs : 6; ; } s; ; } ; ; unsigned long long foo(volatile struct cvmx_buf_ptr bufptr) { ; bufptr.s.addr = 123; ; bufptr.s.segs = 4; -; bufptr.s.lenght = 5; -; bufptr.s.total_bytes = bufptr.s.lenght; +; bufptr.s.length = 5; +; bufptr.s.total_bytes = bufptr.s.length; ; return bufptr.s.addr; ; } Index: test/CodeGen/Mips/dins.ll === --- test/CodeGen/Mips/dins.ll +++ test/CodeGen/Mips/dins.ll @@ -14,17 +14,17 @@ ; struct { ; unsigned long long addr :37; ; unsigned long long addr1 :15; -; unsigned int lenght:14; +; unsigned int length:14; ; uint64_t total_bytes:16; ; uint64_t segs : 6; ; } s; ; } ; ; unsigned long long foo(volatile struct cvmx_buf_ptr bufptr) { ; bufptr.s.addr = 123; ; bufptr.s.segs = 4; -; bufptr.s.lenght = 5; -; bufptr.s.total_bytes = bufptr.s.lenght; +; bufptr.s.length = 5; +; bufptr.s.total_bytes = bufptr.s.length; ; return bufptr.s.addr; ; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49688: [Sema] Fix a crash when a BlockExpr appears in a default-member-initializer of a class template
This revision was automatically updated to reflect the committed changes. Closed by commit rC337766: [Sema] Fix crash on BlockExprs in a default member initializers (authored by epilk, committed by ). Changed prior to commit: https://reviews.llvm.org/D49688?vs=156848=156906#toc Repository: rC Clang https://reviews.llvm.org/D49688 Files: lib/Sema/SemaTemplateInstantiate.cpp test/SemaCXX/instantiate-blocks.cpp Index: lib/Sema/SemaTemplateInstantiate.cpp === --- lib/Sema/SemaTemplateInstantiate.cpp +++ lib/Sema/SemaTemplateInstantiate.cpp @@ -2083,6 +2083,11 @@ if (Member->getDeclContext() != Pattern) continue; +// BlockDecls can appear in a default-member-initializer. They must be the +// child of a BlockExpr, so we only know how to instantiate them from there. +if (isa(Member)) + continue; + if (Member->isInvalidDecl()) { Instantiation->setInvalidDecl(); continue; Index: test/SemaCXX/instantiate-blocks.cpp === --- test/SemaCXX/instantiate-blocks.cpp +++ test/SemaCXX/instantiate-blocks.cpp @@ -30,3 +30,12 @@ noret((float)0.0, double(0.0)); // expected-note {{in instantiation of function template specialization 'noret' requested here}} } +namespace rdar41200624 { +template +struct S { + int (^p)() = ^{ return 0; }; + T (^t)() = ^{ return T{}; }; + T s = ^{ return T{}; }(); +}; +S x; +} Index: lib/Sema/SemaTemplateInstantiate.cpp === --- lib/Sema/SemaTemplateInstantiate.cpp +++ lib/Sema/SemaTemplateInstantiate.cpp @@ -2083,6 +2083,11 @@ if (Member->getDeclContext() != Pattern) continue; +// BlockDecls can appear in a default-member-initializer. They must be the +// child of a BlockExpr, so we only know how to instantiate them from there. +if (isa(Member)) + continue; + if (Member->isInvalidDecl()) { Instantiation->setInvalidDecl(); continue; Index: test/SemaCXX/instantiate-blocks.cpp === --- test/SemaCXX/instantiate-blocks.cpp +++ test/SemaCXX/instantiate-blocks.cpp @@ -30,3 +30,12 @@ noret((float)0.0, double(0.0)); // expected-note {{in instantiation of function template specialization 'noret' requested here}} } +namespace rdar41200624 { +template +struct S { + int (^p)() = ^{ return 0; }; + T (^t)() = ^{ return T{}; }; + T s = ^{ return T{}; }(); +}; +S x; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r337766 - [Sema] Fix crash on BlockExprs in a default member initializers
Author: epilk Date: Mon Jul 23 15:47:37 2018 New Revision: 337766 URL: http://llvm.org/viewvc/llvm-project?rev=337766=rev Log: [Sema] Fix crash on BlockExprs in a default member initializers Clang would crash when instantiating a BlockDecl that appeared in a default-member-initializer of a class template. Fix this by deferring the instantiation until we instantate the BlockExpr. rdar://41200624 Differential revision: https://reviews.llvm.org/D49688 Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp cfe/trunk/test/SemaCXX/instantiate-blocks.cpp Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=337766=337765=337766=diff == --- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original) +++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Mon Jul 23 15:47:37 2018 @@ -2083,6 +2083,11 @@ Sema::InstantiateClass(SourceLocation Po if (Member->getDeclContext() != Pattern) continue; +// BlockDecls can appear in a default-member-initializer. They must be the +// child of a BlockExpr, so we only know how to instantiate them from there. +if (isa(Member)) + continue; + if (Member->isInvalidDecl()) { Instantiation->setInvalidDecl(); continue; Modified: cfe/trunk/test/SemaCXX/instantiate-blocks.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/instantiate-blocks.cpp?rev=337766=337765=337766=diff == --- cfe/trunk/test/SemaCXX/instantiate-blocks.cpp (original) +++ cfe/trunk/test/SemaCXX/instantiate-blocks.cpp Mon Jul 23 15:47:37 2018 @@ -30,3 +30,12 @@ int main(void) noret((float)0.0, double(0.0)); // expected-note {{in instantiation of function template specialization 'noret' requested here}} } +namespace rdar41200624 { +template +struct S { + int (^p)() = ^{ return 0; }; + T (^t)() = ^{ return T{}; }; + T s = ^{ return T{}; }(); +}; +S x; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r337669 - Use possibly cached directory entry values when performing recursive directory iteration.
Hi Jonas, I believe I fixed the issue, and I've recommitted the change as r337765. Please let me know if you still see the failures. I think there might be a lingering issues with how we handle DT_UNKNOWN. /Eric On Mon, Jul 23, 2018 at 3:53 PM Eric Fiselier wrote: > I think I've found the bug, but I need to spend some more time on it. > > I've reverted in for now in r337749. > > /Eric > > On Mon, Jul 23, 2018 at 1:25 PM Eric Fiselier wrote: > >> Thanks. I'm looking into this. >> >> /Eric >> >> On Mon, Jul 23, 2018 at 12:58 PM Jonas Hahnfeld wrote: >> >>> Hi Eric, >>> >>> this breaks >>> test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>> >>> for me: >>> In access_denied_on_recursion_test_case():176 Assertion TEST_CHECK(ec) >>> failed. >>> in file: >>> >>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>> >>> In access_denied_on_recursion_test_case():177 Assertion TEST_CHECK(it == >>> endIt) failed. >>> in file: >>> >>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>> >>> In access_denied_on_recursion_test_case():189 Assertion >>> TEST_REQUIRE_THROW(filesystem_error,++it) failed. >>> in file: >>> >>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>> >>> In test_PR35078():285 Assertion TEST_REQUIRE(it != endIt) failed. >>> in file: >>> >>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>> >>> In test_PR35078_with_symlink():384 Assertion TEST_CHECK(ec) failed. >>> in file: >>> >>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>> >>> In test_PR35078_with_symlink():385 Assertion TEST_CHECK(ec == eacess_ec) >>> failed. >>> in file: >>> >>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>> >>> In test_PR35078_with_symlink_file():461 Assertion TEST_CHECK(*it == >>> symFile) failed. >>> in file: >>> >>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>> >>> In test_PR35078_with_symlink_file():467 Assertion TEST_REQUIRE(it != >>> EndIt) failed. >>> in file: >>> >>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>> >>> Summary for testsuite recursive_directory_iterator_increment_tests: >>> 5 of 9 test cases passed. >>> 156 of 164 assertions passed. >>> 0 unsupported test cases. >>> >>> Do you have an idea? I'm on a local XFS mount, the sources are on NFS... >>> >>> Thanks, >>> Jonas >>> >>> On 2018-07-23 06:55, Eric Fiselier via cfe-commits wrote: >>> > Author: ericwf >>> > Date: Sun Jul 22 21:55:57 2018 >>> > New Revision: 337669 >>> > >>> > URL: http://llvm.org/viewvc/llvm-project?rev=337669=rev >>> > Log: >>> > Use possibly cached directory entry values when performing recursive >>> > directory iteration. >>> > >>> > Modified: >>> > libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp >>> > >>> > Modified: >>> > libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp >>> > URL: >>> > >>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp?rev=337669=337668=337669=diff >>> > >>> == >>> > --- libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp >>> > (original) >>> > +++ libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp >>> > Sun Jul 22 21:55:57 2018 >>> > @@ -359,13 +359,13 @@ bool recursive_directory_iterator::__try >>> >bool skip_rec = false; >>> >std::error_code m_ec; >>> >if (!rec_sym) { >>> > -file_status st = curr_it.__entry_.symlink_status(m_ec); >>> > +file_status st(curr_it.__entry_.__get_sym_ft(_ec)); >>> > if (m_ec && status_known(st)) >>> >m_ec.clear(); >>> > if (m_ec || is_symlink(st) || !is_directory(st)) >>> >skip_rec = true; >>> >} else { >>> > -file_status st = curr_it.__entry_.status(m_ec); >>> > +file_status st(curr_it.__entry_.__get_ft(_ec)); >>> > if (m_ec && status_known(st)) >>> >m_ec.clear(); >>> > if (m_ec || !is_directory(st)) >>> > >>> > >>> > ___ >>> > 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] D49703: [analyzer] pr38273: Admit that we can't handle the newly produced Loc<>NonLoc comparisons.
NoQ created this revision. NoQ added reviewers: dcoughlin, xazax.hun, a.sidorin, george.karpenkov, szepet, rnkovacs, mikhail.ramalho. Herald added subscribers: cfe-commits, baloghadamsoftware. This patch fixes the crash caused by https://reviews.llvm.org/D48650 and reported as https://bugs.llvm.org/show_bug.cgi?id=38273 by removing the assertion. `SValBuilder` now produces a lot more `SymSymExpr` symbolic expressions, some of which the rest of the Analyzer has never seen before. Moreover, for some of them, we've never made a conscious decision on how exactly do we want them to be represented in our `SVal`/`SymExpr`/`MemRegion` hierarchy. This patch deals with the results of comparing a `nonloc::LocAsInteger` to an integer-type symbol, which through the emergent behavior introduced in https://reviews.llvm.org/D48650 results in a `SymSymExpr` that has its LHS and RHS have different `Loc`-ness. This behavior discards the information contained in both `nonloc::LocAsInteger` and `SymbolicRegion` for the `Loc`-typed side and probably more information if there are wrapper regions around the `SymbolicRegion` (i //hope// it works correctly, but i didn't check). So the bigger problem here is where exactly do we want to move with the `nonloc::LocAsInteger` thing as it repeatedly gets in our way. If we want to keep it, we want to make some sort of `SymLocAsIntegerExpr` (and `LocAsIntegerSymExpr` respectively) that would represent results of such operations, and then the assertion would need to be brought back. If we want to remove `nonloc::LocAsInteger` entirely, it'd simplify our hierarchy of values quite a bit, and i think it's a good thing, but it immediately strikes us with a bigger problem: our symbolic expressions and our region offsets represent the same thing but in completely different manners, so every conversion from `Loc` to `NonLoc` and vice versa would require us to convert one representation to the other (eg., `element{SymRegion{$p}, $i, int}` <=> `$p + ($i * 4)`). The whole idea behind `LocAsInteger` is to kinda hide this problem, but in any case we can't really avoid it. Repository: rC Clang https://reviews.llvm.org/D49703 Files: lib/StaticAnalyzer/Core/RangeConstraintManager.cpp test/Analysis/casts.c Index: test/Analysis/casts.c === --- test/Analysis/casts.c +++ test/Analysis/casts.c @@ -171,3 +171,7 @@ (*((int *)())) = (int)(unsigned *)getVoidPtr(); *x = 1; // no-crash } + +void testLocNonLocSymbolAssume(int a, int *b) { + if ((int)b < a) {} +} Index: lib/StaticAnalyzer/Core/RangeConstraintManager.cpp === --- lib/StaticAnalyzer/Core/RangeConstraintManager.cpp +++ lib/StaticAnalyzer/Core/RangeConstraintManager.cpp @@ -343,9 +343,11 @@ if (BinaryOperator::isEqualityOp(SSE->getOpcode()) || BinaryOperator::isRelationalOp(SSE->getOpcode())) { // We handle Loc <> Loc comparisons, but not (yet) NonLoc <> NonLoc. +// We've recently started producing Loc <> NonLoc comparisons (that +// result from casts of one of the operands between eg. intptr_t and +// void *), but we can't reason about them yet. if (Loc::isLocType(SSE->getLHS()->getType())) { - assert(Loc::isLocType(SSE->getRHS()->getType())); - return true; + return Loc::isLocType(SSE->getRHS()->getType()); } } } Index: test/Analysis/casts.c === --- test/Analysis/casts.c +++ test/Analysis/casts.c @@ -171,3 +171,7 @@ (*((int *)())) = (int)(unsigned *)getVoidPtr(); *x = 1; // no-crash } + +void testLocNonLocSymbolAssume(int a, int *b) { + if ((int)b < a) {} +} Index: lib/StaticAnalyzer/Core/RangeConstraintManager.cpp === --- lib/StaticAnalyzer/Core/RangeConstraintManager.cpp +++ lib/StaticAnalyzer/Core/RangeConstraintManager.cpp @@ -343,9 +343,11 @@ if (BinaryOperator::isEqualityOp(SSE->getOpcode()) || BinaryOperator::isRelationalOp(SSE->getOpcode())) { // We handle Loc <> Loc comparisons, but not (yet) NonLoc <> NonLoc. +// We've recently started producing Loc <> NonLoc comparisons (that +// result from casts of one of the operands between eg. intptr_t and +// void *), but we can't reason about them yet. if (Loc::isLocType(SSE->getLHS()->getType())) { - assert(Loc::isLocType(SSE->getRHS()->getType())); - return true; + return Loc::isLocType(SSE->getRHS()->getType()); } } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337765 - Recommit "Use possibly cached directory entry values when performing recursive directory iteration."
Author: ericwf Date: Mon Jul 23 15:40:41 2018 New Revision: 337765 URL: http://llvm.org/viewvc/llvm-project?rev=337765=rev Log: Recommit "Use possibly cached directory entry values when performing recursive directory iteration." The initial patch didn't correctly handle systems when the dirent struct didn't provide the d_type member. Specifically it set the cache to the incorrect state, and claimed it was partially populated. The updated version of this change correctly handles setting up the cache when the file type is not known (aka file_type::none). Modified: libcxx/trunk/include/experimental/filesystem libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp Modified: libcxx/trunk/include/experimental/filesystem URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/filesystem?rev=337765=337764=337765=diff == --- libcxx/trunk/include/experimental/filesystem (original) +++ libcxx/trunk/include/experimental/filesystem Mon Jul 23 15:40:41 2018 @@ -2200,8 +2200,16 @@ private: static __cached_data __create_iter_result(file_type __ft) { __cached_data __data; __data.__type_ = __ft; - __data.__cache_type_ = - __ft == file_type::symlink ? _IterSymlink : _IterNonSymlink; + __data.__cache_type_ = [&]() { + switch (__ft) { + case file_type::none: +return _Empty; + case file_type::symlink: +return _IterSymlink; + default: +return _IterNonSymlink; + } + }(); return __data; } Modified: libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp?rev=337765=337764=337765=diff == --- libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp (original) +++ libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp Mon Jul 23 15:40:41 2018 @@ -47,9 +47,10 @@ static file_type get_file_type(DirEntT * } return file_type::none; } + template static file_type get_file_type(DirEntT *ent, long) { - return file_type::unknown; + return file_type::none; } static pair @@ -359,13 +360,13 @@ bool recursive_directory_iterator::__try bool skip_rec = false; error_code m_ec; if (!rec_sym) { -file_status st = curr_it.__entry_.symlink_status(m_ec); +file_status st(curr_it.__entry_.__get_sym_ft(_ec)); if (m_ec && status_known(st)) m_ec.clear(); if (m_ec || is_symlink(st) || !is_directory(st)) skip_rec = true; } else { -file_status st = curr_it.__entry_.status(m_ec); +file_status st(curr_it.__entry_.__get_ft(_ec)); if (m_ec && status_known(st)) m_ec.clear(); if (m_ec || !is_directory(st)) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337764 - Fix accidentally removed test.
Author: ericwf Date: Mon Jul 23 15:39:56 2018 New Revision: 337764 URL: http://llvm.org/viewvc/llvm-project?rev=337764=rev Log: Fix accidentally removed test. When adding the new tests for the filesystem_error::what method, I incorrectly removed a test case and replaced it with something else. This patch restores that test case Modified: libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp Modified: libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp?rev=337764=337763=337764=diff == --- libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp (original) +++ libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp Mon Jul 23 15:39:56 2018 @@ -25,8 +25,6 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -#include - using namespace fs; TEST_SUITE(recursive_directory_iterator_increment_tests) @@ -292,6 +290,21 @@ TEST_CASE(test_PR35078) } { bool SeenNestedFile = false; + recursive_directory_iterator it = SetupState(true, SeenNestedFile); + TEST_REQUIRE(it != endIt); + TEST_REQUIRE(*it == nestedDir); + ec = GetTestEC(); + it.increment(ec); + TEST_CHECK(!ec); + if (SeenNestedFile) { +TEST_CHECK(it == endIt); + } else { +TEST_REQUIRE(it != endIt); +TEST_CHECK(*it == nestedFile); + } +} +{ + bool SeenNestedFile = false; recursive_directory_iterator it = SetupState(false, SeenNestedFile); TEST_REQUIRE(it != endIt); TEST_REQUIRE(*it == nestedDir); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48786: [Preprocessor] Stop entering included files after hitting a fatal error.
vsapsai added inline comments. Comment at: clang/lib/Lex/PPDirectives.cpp:1875 + // Stop further preprocessing if a fatal error has occurred. Any diagnostics + // we might have raised will not be visible. + if (ShouldEnter && Diags->hasFatalErrorOccurred()) jkorous wrote: > vsapsai wrote: > > jkorous wrote: > > > I am not sure I understand this - does that mean that we are not > > > displaying diagnostics that were produced before "now"? > > I can see how the wording can cause the confusion. But I'm not entirely > > sure it is misguiding, I've copy-pasted it from > > [Sema::InstantiatingTemplate::InstantiatingTemplate > > ](https://github.com/llvm-mirror/clang/blob/580f7daabc7696d50ad09d9643b2afeadbd387d8/lib/Sema/SemaTemplateInstantiate.cpp#L218-L220). > > Let me explain my reasoning in a different way to see if it makes sense. > > Entering a file is observable if it produces diagnostics or some other > > build artifact (object file in most cases). So when we encounter a fatal > > error, there is no visible indication of entering subsequent files. That's > > why we can skip entering those files: no difference in output and less work > > to do. > Thanks for the explanation! I was not sure whether "only subsequent" OR "both > subsequent and some/all prior" raised diagnostics would be not visible (could > be just my shitty English though). > > Maybe something along this line "any eventual subsequent diagnostics will not > be visible" would be more clear? Curiously, the comment kinda means both. Some prior diagnostics might be invisible but in this case we care about subsequent diagnostics. I'll update the comment to make that more clear. https://reviews.llvm.org/D48786 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49067: Stop wrapping __has_include in another macro
arichardson added a comment. In https://reviews.llvm.org/D49067#1172500, @EricWF wrote: > Where are the special lexing rules specified? In https://bugs.llvm.org/show_bug.cgi?id=37990#c1 @rsmith wrote: > The C++ standard appears to be missing a rule that says that a __has_include > token produced by macro expansion results in undefined behavior (matching the > corresponding rule for a 'defined' token produced by macro expansion), but > that seems to just be a wording oversight. You should not expect this to work. Looks like the special rules are explained in 3.2.2 of https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations#recs.hasinc > In the first form of the has-include-expression, the parenthesized > header-name token is not subject to macro expansion. The second and third > forms are considered only if the first form does not match, and the > preprocessing tokens are processed just as in normal text. While there is no mention of the define to 0 if not present for `__has_include` it is used in the example for `__has_cpp_attribute` in https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations#recs.hasattr. Comment at: include/__config:153 +#ifndef __has_include +#define __has_include(...) 0 #endif EricWF wrote: > I do prefer not hijacking this name, but if it's needed to make things work, > then it's OK with me. > > @mclow.lists Are you OK if we steal this identifier and `#define` it > ourselves. This is the correct way of dealing with missing `__has_include()` according to @rsmith Repository: rCXX libc++ https://reviews.llvm.org/D49067 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49615: [ASTMatchers] Add an isMain() matcher
This revision was automatically updated to reflect the committed changes. Closed by commit rC337761: [ASTMatchers] Add an isMain() matcher (authored by george.karpenkov, committed by ). Herald added a subscriber: cfe-commits. Changed prior to commit: https://reviews.llvm.org/D49615?vs=156599=156899#toc Repository: rC Clang https://reviews.llvm.org/D49615 Files: docs/LibASTMatchersReference.html include/clang/ASTMatchers/ASTMatchers.h lib/ASTMatchers/Dynamic/Registry.cpp unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp Index: lib/ASTMatchers/Dynamic/Registry.cpp === --- lib/ASTMatchers/Dynamic/Registry.cpp +++ lib/ASTMatchers/Dynamic/Registry.cpp @@ -359,6 +359,7 @@ REGISTER_MATCHER(isInTemplateInstantiation); REGISTER_MATCHER(isLambda); REGISTER_MATCHER(isListInitialization); + REGISTER_MATCHER(isMain); REGISTER_MATCHER(isMemberInitializer); REGISTER_MATCHER(isMoveAssignmentOperator); REGISTER_MATCHER(isMoveConstructor); Index: unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp === --- unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp +++ unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp @@ -2158,5 +2158,13 @@ notMatches("void x() { int a; if(a == 0) return; }", BinAsgmtOperator)); } +TEST(Matcher, isMain) { + EXPECT_TRUE( +matches("int main() {}", functionDecl(isMain(; + + EXPECT_TRUE( +notMatches("int main2() {}", functionDecl(isMain(; +} + } // namespace ast_matchers } // namespace clang Index: docs/LibASTMatchersReference.html === --- docs/LibASTMatchersReference.html +++ docs/LibASTMatchersReference.html @@ -2919,6 +2919,12 @@ +Matcherhttp://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html;>FunctionDeclisMain +Determines whether the function is "main", which is the entry point +into an executable program. + + + Matcherhttp://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html;>FunctionDeclisNoReturn Matches FunctionDecls that have a noreturn attribute. Index: include/clang/ASTMatchers/ASTMatchers.h === --- include/clang/ASTMatchers/ASTMatchers.h +++ include/clang/ASTMatchers/ASTMatchers.h @@ -616,6 +616,12 @@ InnerMatcher.matches(*Initializer, Finder, Builder)); } +/// Determines whether the function is "main", which is the entry point +/// into an executable program. +AST_MATCHER(FunctionDecl, isMain) { + return Node.isMain(); +} + /// Matches the specialized template of a specialization declaration. /// /// Given Index: lib/ASTMatchers/Dynamic/Registry.cpp === --- lib/ASTMatchers/Dynamic/Registry.cpp +++ lib/ASTMatchers/Dynamic/Registry.cpp @@ -359,6 +359,7 @@ REGISTER_MATCHER(isInTemplateInstantiation); REGISTER_MATCHER(isLambda); REGISTER_MATCHER(isListInitialization); + REGISTER_MATCHER(isMain); REGISTER_MATCHER(isMemberInitializer); REGISTER_MATCHER(isMoveAssignmentOperator); REGISTER_MATCHER(isMoveConstructor); Index: unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp === --- unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp +++ unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp @@ -2158,5 +2158,13 @@ notMatches("void x() { int a; if(a == 0) return; }", BinAsgmtOperator)); } +TEST(Matcher, isMain) { + EXPECT_TRUE( +matches("int main() {}", functionDecl(isMain(; + + EXPECT_TRUE( +notMatches("int main2() {}", functionDecl(isMain(; +} + } // namespace ast_matchers } // namespace clang Index: docs/LibASTMatchersReference.html === --- docs/LibASTMatchersReference.html +++ docs/LibASTMatchersReference.html @@ -2919,6 +2919,12 @@ +Matcherhttp://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html;>FunctionDeclisMain +Determines whether the function is "main", which is the entry point +into an executable program. + + + Matcherhttp://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html;>FunctionDeclisNoReturn Matches FunctionDecls that have a noreturn attribute. Index: include/clang/ASTMatchers/ASTMatchers.h === --- include/clang/ASTMatchers/ASTMatchers.h +++ include/clang/ASTMatchers/ASTMatchers.h @@ -616,6 +616,12 @@ InnerMatcher.matches(*Initializer, Finder, Builder)); } +/// Determines whether the function is "main", which is the entry point +/// into an executable program. +AST_MATCHER(FunctionDecl, isMain) { + return Node.isMain(); +} + /// Matches the specialized template of a specialization declaration. /// /// Given ___ cfe-commits mailing list
r337761 - [ASTMatchers] Add an isMain() matcher
Author: george.karpenkov Date: Mon Jul 23 15:29:35 2018 New Revision: 337761 URL: http://llvm.org/viewvc/llvm-project?rev=337761=rev Log: [ASTMatchers] Add an isMain() matcher Differential Revision: https://reviews.llvm.org/D49615 Modified: cfe/trunk/docs/LibASTMatchersReference.html cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp cfe/trunk/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp Modified: cfe/trunk/docs/LibASTMatchersReference.html URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=337761=337760=337761=diff == --- cfe/trunk/docs/LibASTMatchersReference.html (original) +++ cfe/trunk/docs/LibASTMatchersReference.html Mon Jul 23 15:29:35 2018 @@ -2919,6 +2919,12 @@ namespaceDecl(isInline()) will match n:: +Matcherhttp://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html;>FunctionDeclisMain +Determines whether the function is "main", which is the entry point +into an executable program. + + + Matcherhttp://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html;>FunctionDeclisNoReturn Matches FunctionDecls that have a noreturn attribute. Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=337761=337760=337761=diff == --- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original) +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Mon Jul 23 15:29:35 2018 @@ -616,6 +616,12 @@ AST_MATCHER_P(FieldDecl, hasInClassIniti InnerMatcher.matches(*Initializer, Finder, Builder)); } +/// Determines whether the function is "main", which is the entry point +/// into an executable program. +AST_MATCHER(FunctionDecl, isMain) { + return Node.isMain(); +} + /// Matches the specialized template of a specialization declaration. /// /// Given Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp?rev=337761=337760=337761=diff == --- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp (original) +++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp Mon Jul 23 15:29:35 2018 @@ -359,6 +359,7 @@ RegistryMaps::RegistryMaps() { REGISTER_MATCHER(isInTemplateInstantiation); REGISTER_MATCHER(isLambda); REGISTER_MATCHER(isListInitialization); + REGISTER_MATCHER(isMain); REGISTER_MATCHER(isMemberInitializer); REGISTER_MATCHER(isMoveAssignmentOperator); REGISTER_MATCHER(isMoveConstructor); Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp?rev=337761=337760=337761=diff == --- cfe/trunk/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp (original) +++ cfe/trunk/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp Mon Jul 23 15:29:35 2018 @@ -2158,5 +2158,13 @@ TEST(IsAssignmentOperator, Basic) { notMatches("void x() { int a; if(a == 0) return; }", BinAsgmtOperator)); } +TEST(Matcher, isMain) { + EXPECT_TRUE( +matches("int main() {}", functionDecl(isMain(; + + EXPECT_TRUE( +notMatches("int main2() {}", functionDecl(isMain(; +} + } // namespace ast_matchers } // namespace clang ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r337760 - [ASTMatchers] [NFC] Regenerate HTML docs.
Author: george.karpenkov Date: Mon Jul 23 15:29:10 2018 New Revision: 337760 URL: http://llvm.org/viewvc/llvm-project?rev=337760=rev Log: [ASTMatchers] [NFC] Regenerate HTML docs. Modified: cfe/trunk/docs/LibASTMatchersReference.html Modified: cfe/trunk/docs/LibASTMatchersReference.html URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=337760=337759=337760=diff == --- cfe/trunk/docs/LibASTMatchersReference.html (original) +++ cfe/trunk/docs/LibASTMatchersReference.html Mon Jul 23 15:29:10 2018 @@ -3275,9 +3275,9 @@ Example matcher = objcMessagaeExpr(isInstanceMessage()) matches NSString *x = @"hello"; - [x containsString:@"h"] + [x containsString:@"h"]; but not - [NSString stringWithFormat:@"format"] + [NSString stringWithFormat:@"format"]; @@ -5894,7 +5894,7 @@ and the inner matcher matches on that in For example the method call in NSString *x = @"hello"; - [x containsString:@"h"] + [x containsString:@"h"]; is matched by objcMessageExpr(hasReceiver(declRefExpr(to(varDecl(hasName("x")) @@ -6564,7 +6564,7 @@ type of the matched node. For example, in: class A {}; using B = A; -The matcher type(hasUnqualifeidDesugaredType(recordType())) matches +The matcher type(hasUnqualifiedDesugaredType(recordType())) matches both B and A. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r337759 - [demangler] call terminate() if allocation failed
Author: epilk Date: Mon Jul 23 15:23:04 2018 New Revision: 337759 URL: http://llvm.org/viewvc/llvm-project?rev=337759=rev Log: [demangler] call terminate() if allocation failed We really should set *status to memory_alloc_failure, but we need to refactor the demangler a bit to properly propagate the failure up the stack. Until then, its better to explicitly terminate then rely on a null dereference crash. rdar://31240372 Modified: libcxxabi/trunk/src/cxa_demangle.cpp libcxxabi/trunk/src/demangle/Utility.h Modified: libcxxabi/trunk/src/cxa_demangle.cpp URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=337759=337758=337759=diff == --- libcxxabi/trunk/src/cxa_demangle.cpp (original) +++ libcxxabi/trunk/src/cxa_demangle.cpp Mon Jul 23 15:23:04 2018 @@ -1771,13 +1771,17 @@ class BumpPointerAllocator { BlockMeta* BlockList = nullptr; void grow() { -char* NewMeta = new char[AllocSize]; +char* NewMeta = static_cast(std::malloc(AllocSize)); +if (NewMeta == nullptr) + std::terminate(); BlockList = new (NewMeta) BlockMeta{BlockList, 0}; } void* allocateMassive(size_t NBytes) { NBytes += sizeof(BlockMeta); -BlockMeta* NewMeta = reinterpret_cast(new char[NBytes]); +BlockMeta* NewMeta = reinterpret_cast(std::malloc(NBytes)); +if (NewMeta == nullptr) + std::terminate(); BlockList->Next = new (NewMeta) BlockMeta{BlockList->Next, 0}; return static_cast(NewMeta + 1); } @@ -1803,7 +1807,7 @@ public: BlockMeta* Tmp = BlockList; BlockList = BlockList->Next; if (reinterpret_cast(Tmp) != InitialBuffer) -delete[] reinterpret_cast(Tmp); +std::free(Tmp); } BlockList = new (InitialBuffer) BlockMeta{nullptr, 0}; } @@ -1833,10 +1837,15 @@ class PODSmallVector { size_t S = size(); if (isInline()) { auto* Tmp = static_cast(std::malloc(NewCap * sizeof(T))); + if (Tmp == nullptr) +std::terminate(); std::copy(First, Last, Tmp); First = Tmp; -} else +} else { First = static_cast(std::realloc(First, NewCap * sizeof(T))); + if (First == nullptr) +std::terminate(); +} Last = First + S; Cap = First + NewCap; } Modified: libcxxabi/trunk/src/demangle/Utility.h URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/demangle/Utility.h?rev=337759=337758=337759=diff == --- libcxxabi/trunk/src/demangle/Utility.h (original) +++ libcxxabi/trunk/src/demangle/Utility.h Mon Jul 23 15:23:04 2018 @@ -35,6 +35,8 @@ class OutputStream { if (BufferCapacity < N + CurrentPosition) BufferCapacity = N + CurrentPosition; Buffer = static_cast(std::realloc(Buffer, BufferCapacity)); + if (Buffer == nullptr) +std::terminate(); } } @@ -76,6 +78,8 @@ public: if (!StartBuf || !Size) { StartBuf = static_cast(std::malloc(AllocSize)); + if (StartBuf == nullptr) +std::terminate(); Size = } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49638: [libcxxabi] Implement a GCC compatible SEH unwinding personality, __gxx_personality_seh0
This revision was automatically updated to reflect the committed changes. Closed by commit rL337754: Implement a GCC compatible SEH unwinding personality, __gxx_personality_seh0 (authored by mstorsjo, committed by ). Herald added subscribers: llvm-commits, christof. Changed prior to commit: https://reviews.llvm.org/D49638?vs=156687=156890#toc Repository: rL LLVM https://reviews.llvm.org/D49638 Files: libcxxabi/trunk/src/cxa_personality.cpp Index: libcxxabi/trunk/src/cxa_personality.cpp === --- libcxxabi/trunk/src/cxa_personality.cpp +++ libcxxabi/trunk/src/cxa_personality.cpp @@ -23,6 +23,16 @@ #include "private_typeinfo.h" #include "unwind.h" +#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) +#include +#include + +extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, + void *, PCONTEXT, + PDISPATCHER_CONTEXT, + _Unwind_Personality_Fn); +#endif + /* Exception Header Layout: @@ -934,12 +944,16 @@ */ #if !defined(_LIBCXXABI_ARM_EHABI) +#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) +static _Unwind_Reason_Code __gxx_personality_imp +#else _LIBCXXABI_FUNC_VIS _Unwind_Reason_Code #ifdef __USING_SJLJ_EXCEPTIONS__ __gxx_personality_sj0 #else __gxx_personality_v0 #endif +#endif (int version, _Unwind_Action actions, uint64_t exceptionClass, _Unwind_Exception* unwind_exception, _Unwind_Context* context) { @@ -1022,6 +1036,17 @@ // We were called improperly: neither a phase 1 or phase 2 search return _URC_FATAL_PHASE1_ERROR; } + +#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) +extern "C" EXCEPTION_DISPOSITION +__gxx_personality_seh0(PEXCEPTION_RECORD ms_exc, void *this_frame, + PCONTEXT ms_orig_context, PDISPATCHER_CONTEXT ms_disp) +{ + return _GCC_specific_handler(ms_exc, this_frame, ms_orig_context, ms_disp, + __gxx_personality_imp); +} +#endif + #else extern "C" _Unwind_Reason_Code __gnu_unwind_frame(_Unwind_Exception*, Index: libcxxabi/trunk/src/cxa_personality.cpp === --- libcxxabi/trunk/src/cxa_personality.cpp +++ libcxxabi/trunk/src/cxa_personality.cpp @@ -23,6 +23,16 @@ #include "private_typeinfo.h" #include "unwind.h" +#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) +#include +#include + +extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, + void *, PCONTEXT, + PDISPATCHER_CONTEXT, + _Unwind_Personality_Fn); +#endif + /* Exception Header Layout: @@ -934,12 +944,16 @@ */ #if !defined(_LIBCXXABI_ARM_EHABI) +#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) +static _Unwind_Reason_Code __gxx_personality_imp +#else _LIBCXXABI_FUNC_VIS _Unwind_Reason_Code #ifdef __USING_SJLJ_EXCEPTIONS__ __gxx_personality_sj0 #else __gxx_personality_v0 #endif +#endif (int version, _Unwind_Action actions, uint64_t exceptionClass, _Unwind_Exception* unwind_exception, _Unwind_Context* context) { @@ -1022,6 +1036,17 @@ // We were called improperly: neither a phase 1 or phase 2 search return _URC_FATAL_PHASE1_ERROR; } + +#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) +extern "C" EXCEPTION_DISPOSITION +__gxx_personality_seh0(PEXCEPTION_RECORD ms_exc, void *this_frame, + PCONTEXT ms_orig_context, PDISPATCHER_CONTEXT ms_disp) +{ + return _GCC_specific_handler(ms_exc, this_frame, ms_orig_context, ms_disp, + __gxx_personality_imp); +} +#endif + #else extern "C" _Unwind_Reason_Code __gnu_unwind_frame(_Unwind_Exception*, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r337754 - Implement a GCC compatible SEH unwinding personality, __gxx_personality_seh0
Author: mstorsjo Date: Mon Jul 23 15:09:23 2018 New Revision: 337754 URL: http://llvm.org/viewvc/llvm-project?rev=337754=rev Log: Implement a GCC compatible SEH unwinding personality, __gxx_personality_seh0 This allows handling SEH based exceptions, with unwind functions provided by libgcc. Differential Revision: https://reviews.llvm.org/D49638 Modified: libcxxabi/trunk/src/cxa_personality.cpp Modified: libcxxabi/trunk/src/cxa_personality.cpp URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_personality.cpp?rev=337754=337753=337754=diff == --- libcxxabi/trunk/src/cxa_personality.cpp (original) +++ libcxxabi/trunk/src/cxa_personality.cpp Mon Jul 23 15:09:23 2018 @@ -23,6 +23,16 @@ #include "private_typeinfo.h" #include "unwind.h" +#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) +#include +#include + +extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, + void *, PCONTEXT, + PDISPATCHER_CONTEXT, + _Unwind_Personality_Fn); +#endif + /* Exception Header Layout: @@ -934,12 +944,16 @@ _UA_CLEANUP_PHASE */ #if !defined(_LIBCXXABI_ARM_EHABI) +#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) +static _Unwind_Reason_Code __gxx_personality_imp +#else _LIBCXXABI_FUNC_VIS _Unwind_Reason_Code #ifdef __USING_SJLJ_EXCEPTIONS__ __gxx_personality_sj0 #else __gxx_personality_v0 #endif +#endif (int version, _Unwind_Action actions, uint64_t exceptionClass, _Unwind_Exception* unwind_exception, _Unwind_Context* context) { @@ -1022,6 +1036,17 @@ __gxx_personality_v0 // We were called improperly: neither a phase 1 or phase 2 search return _URC_FATAL_PHASE1_ERROR; } + +#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) +extern "C" EXCEPTION_DISPOSITION +__gxx_personality_seh0(PEXCEPTION_RECORD ms_exc, void *this_frame, + PCONTEXT ms_orig_context, PDISPATCHER_CONTEXT ms_disp) +{ + return _GCC_specific_handler(ms_exc, this_frame, ms_orig_context, ms_disp, + __gxx_personality_imp); +} +#endif + #else extern "C" _Unwind_Reason_Code __gnu_unwind_frame(_Unwind_Exception*, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49067: Stop wrapping __has_include in another macro
EricWF added a reviewer: mclow.lists. EricWF added a subscriber: mclow.lists. EricWF added a comment. Where are the special lexing rules specified? Comment at: include/__config:153 +#ifndef __has_include +#define __has_include(...) 0 #endif I do prefer not hijacking this name, but if it's needed to make things work, then it's OK with me. @mclow.lists Are you OK if we steal this identifier and `#define` it ourselves. Repository: rCXX libc++ https://reviews.llvm.org/D49067 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49652: Apply -fdebug-prefix-map in reverse of command line order
alxu added a comment. my general theory is that it's better to have tests that test everything at once if possible, but I guess it's unlikely enough that the debug info path will be correct in the IR and then not correct in the generated file and that that won't be caught by LLVM tests. Repository: rC Clang https://reviews.llvm.org/D49652 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49091: Warn about usage of __has_include/__has_include_next in macro expansions
arichardson added a comment. Ping? Repository: rC Clang https://reviews.llvm.org/D49091 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49067: Stop wrapping __has_include in another macro
arichardson added a comment. Ping? Repository: rCXX libc++ https://reviews.llvm.org/D49067 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r337736 - [CodeGen] Record if a C++ record is a trivial type
Author: asmith Date: Mon Jul 23 13:49:07 2018 New Revision: 337736 URL: http://llvm.org/viewvc/llvm-project?rev=337736=rev Log: [CodeGen] Record if a C++ record is a trivial type Summary: This has a dependence on D45122 Reviewers: rnk, zturner, llvm-commits, aleksandr.urakov Reviewed By: rnk Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D45124 Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=337736=337735=337736=diff == --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Jul 23 13:49:07 2018 @@ -2908,6 +2908,10 @@ llvm::DICompositeType *CGDebugInfo::Crea Flags |= llvm::DINode::FlagTypePassByReference; else Flags |= llvm::DINode::FlagTypePassByValue; + +// Record if a C++ record is trivial type. +if (CXXRD->isTrivial()) + Flags |= llvm::DINode::FlagTrivial; } llvm::DICompositeType *RealDecl = DBuilder.createReplaceableCompositeType( ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49573: [CMake] Option to control whether shared/static library is installed
ldionne accepted this revision. ldionne added a comment. This revision is now accepted and ready to land. Ah, so you mean you need it for libc++abi because you want to build them but not install them (so they're linked into libc++)? Then LGTM as-is. I'd like to see what Eric has to say though. Repository: rL LLVM https://reviews.llvm.org/D49573 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r337669 - Use possibly cached directory entry values when performing recursive directory iteration.
I think I've found the bug, but I need to spend some more time on it. I've reverted in for now in r337749. /Eric On Mon, Jul 23, 2018 at 1:25 PM Eric Fiselier wrote: > Thanks. I'm looking into this. > > /Eric > > On Mon, Jul 23, 2018 at 12:58 PM Jonas Hahnfeld wrote: > >> Hi Eric, >> >> this breaks >> test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >> >> for me: >> In access_denied_on_recursion_test_case():176 Assertion TEST_CHECK(ec) >> failed. >> in file: >> >> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >> >> In access_denied_on_recursion_test_case():177 Assertion TEST_CHECK(it == >> endIt) failed. >> in file: >> >> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >> >> In access_denied_on_recursion_test_case():189 Assertion >> TEST_REQUIRE_THROW(filesystem_error,++it) failed. >> in file: >> >> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >> >> In test_PR35078():285 Assertion TEST_REQUIRE(it != endIt) failed. >> in file: >> >> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >> >> In test_PR35078_with_symlink():384 Assertion TEST_CHECK(ec) failed. >> in file: >> >> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >> >> In test_PR35078_with_symlink():385 Assertion TEST_CHECK(ec == eacess_ec) >> failed. >> in file: >> >> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >> >> In test_PR35078_with_symlink_file():461 Assertion TEST_CHECK(*it == >> symFile) failed. >> in file: >> >> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >> >> In test_PR35078_with_symlink_file():467 Assertion TEST_REQUIRE(it != >> EndIt) failed. >> in file: >> >> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >> >> Summary for testsuite recursive_directory_iterator_increment_tests: >> 5 of 9 test cases passed. >> 156 of 164 assertions passed. >> 0 unsupported test cases. >> >> Do you have an idea? I'm on a local XFS mount, the sources are on NFS... >> >> Thanks, >> Jonas >> >> On 2018-07-23 06:55, Eric Fiselier via cfe-commits wrote: >> > Author: ericwf >> > Date: Sun Jul 22 21:55:57 2018 >> > New Revision: 337669 >> > >> > URL: http://llvm.org/viewvc/llvm-project?rev=337669=rev >> > Log: >> > Use possibly cached directory entry values when performing recursive >> > directory iteration. >> > >> > Modified: >> > libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp >> > >> > Modified: >> > libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp >> > URL: >> > >> http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp?rev=337669=337668=337669=diff >> > >> == >> > --- libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp >> > (original) >> > +++ libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp >> > Sun Jul 22 21:55:57 2018 >> > @@ -359,13 +359,13 @@ bool recursive_directory_iterator::__try >> >bool skip_rec = false; >> >std::error_code m_ec; >> >if (!rec_sym) { >> > -file_status st = curr_it.__entry_.symlink_status(m_ec); >> > +file_status st(curr_it.__entry_.__get_sym_ft(_ec)); >> > if (m_ec && status_known(st)) >> >m_ec.clear(); >> > if (m_ec || is_symlink(st) || !is_directory(st)) >> >skip_rec = true; >> >} else { >> > -file_status st = curr_it.__entry_.status(m_ec); >> > +file_status st(curr_it.__entry_.__get_ft(_ec)); >> > if (m_ec && status_known(st)) >> >m_ec.clear(); >> > if (m_ec || !is_directory(st)) >> > >> > >> > ___ >> > 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] D49688: [Sema] Fix a crash when a BlockExpr appears in a default-member-initializer of a class template
rjmccall accepted this revision. rjmccall added a comment. This revision is now accepted and ready to land. It makes sense that the BlockDecl's parent DC is the class, although I think it would be even better if we took a page from Swift and make a special DC for initializer expressions. I don't think it makes sense for it to be listed in the DC's list of declarations. Regardless, it's not something you have to fix. Patch LGTM. Repository: rC Clang https://reviews.llvm.org/D49688 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337749 - Revert "Use possibly cached directory entry values when performing recursive directory iteration."
Author: ericwf Date: Mon Jul 23 14:52:29 2018 New Revision: 337749 URL: http://llvm.org/viewvc/llvm-project?rev=337749=rev Log: Revert "Use possibly cached directory entry values when performing recursive directory iteration." This reverts commit 04ce4aef00d3ee508327f6cf7bf1b1d200ab6238. Modified: libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp Modified: libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp?rev=337749=337748=337749=diff == --- libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp (original) +++ libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp Mon Jul 23 14:52:29 2018 @@ -359,13 +359,13 @@ bool recursive_directory_iterator::__try bool skip_rec = false; error_code m_ec; if (!rec_sym) { -file_status st(curr_it.__entry_.__get_sym_ft(_ec)); +file_status st = curr_it.__entry_.symlink_status(m_ec); if (m_ec && status_known(st)) m_ec.clear(); if (m_ec || is_symlink(st) || !is_directory(st)) skip_rec = true; } else { -file_status st(curr_it.__entry_.__get_ft(_ec)); +file_status st = curr_it.__entry_.status(m_ec); if (m_ec && status_known(st)) m_ec.clear(); if (m_ec || !is_directory(st)) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49688: [Sema] Fix a crash when a BlockExpr appears in a default-member-initializer of a class template
erik.pilkington added a comment. In https://reviews.llvm.org/D49688#1172269, @rjmccall wrote: > I honestly don't know why the `BlockDecl` is in the members list in the first > place; that seems wrong, for the same reason that we wouldn't (I assume?) > consider a lambda's implicit record to be a member. Looks like we do actually treat a lambda's implicit record as a member. This loop is only iterating over decls that are in the pattern decl's context, and I think it makes sense that the BlockDecl is there, right? Repository: rC Clang https://reviews.llvm.org/D49688 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49338: Implement - P0122R7
ldionne added inline comments. Comment at: include/span:217 +using pointer= _Tp *; +using const_pointer = const _Tp *; // not in standard +using reference = _Tp &; mclow.lists wrote: > ldionne wrote: > > Why are we providing them if they are not in the standard? > Because (a) they're useful (see the definition of `const_iterator` below, and > (b) I (and STL, who wrote the final version of the `span` paper, believe that > not having them was just an oversight. > I sent you a LWG issue email. Comment at: include/span:254 +constexpr span(const _Container& __c, +const enable_if_t<__is_span_compatible_container::value, nullptr_t> = nullptr) +: __data{_VSTD::data(__c)} mclow.lists wrote: > ldionne wrote: > > For both of these `Container` constructors, the paper expresses the SFINAE > > conditions based on `Container`, not on `Container` in one case and > > `Container const` in the other, which is what you're doing. > > > > This is actually a bug in the paper, because this will make code like this > > compile: > > > > ``` > > std::vector const v; > > std::span s(v); > > ``` > > > > Instead, this should be a compiler error because we're clearly not > > const-correct here, initializing a `span`-over-non-const from a const > > `vector`. Example: https://wandbox.org/permlink/kYCui3o0LEGRQ67x > > > > This happens because we're discarding the constness of the `_Container` > > template parameter if we stick 100% to the wording of the paper. Should > > this be a DR? > Yes, this should be an LWG issue. Ugh, actually, I am wrong! The paper is fine and you implemented the paper correctly. The paper says ``` Remarks: These constructors shall not participate in overload resolution unless: — `Container` is not a specialization of span, — `Container` is not a specialization of array, — `is_array_v` is `false`, — `data(cont)` and `size(cont)` are both well-formed, and — `remove_pointer_t(*)[]` is convertible to `ElementType(*)[]`. ``` since `cont` has the right constness, the paper properly describes what should happen. My mistake. Comment at: include/span:275 + +// ~span() noexcept = default; + mclow.lists wrote: > ldionne wrote: > > Why is this commented out? > This is commented out because of a clang bug > https://bugs.llvm.org/show_bug.cgi?id=38143, where copy constructor will > become non-constexpr. Once this fixed, we can un-comment this line (though > it should make no difference if it is present or not). > What! Thanks. Comment at: include/span:351 +{ +pointer __p = __data; +__data = __other.__data; mclow.lists wrote: > ldionne wrote: > > Just curious -- why not use `_VSTD::swap(__data, __other.__data)`? This > > would avoid any potential for a stupid logic error to sneak up. > Not to have to include ``? (It may get included anyway) `` already includes ``. Your choice, I don't mind. Comment at: include/span:356-359 +_LIBCPP_INLINE_VISIBILITY span __as_bytes() const noexcept +{ return {reinterpret_cast(data()), size_bytes()}; } + +_LIBCPP_INLINE_VISIBILITY span __as_writeable_bytes() const noexcept mclow.lists wrote: > ldionne wrote: > > It looks like neither `as_bytes` nor `as_writeable_bytes` is marked `const` > > in the paper. Why are we deviating? > In N4762, they're marked as non-member functions that take `span` > by value. This implementation just turns around and calls a member function > (with an unpronounceable name) to do the work. The standard never mentions > `__as_bytes` or `__as_writeable_bytes`. > > > > > I completely missed the leading underscores on those methods, along with the non-member functions. Thanks, this is not an issue. Comment at: include/span:531 +operator==(const span<_Tp1, _Extent1>& __lhs, const span<_Tp2, _Extent2>& __rhs) +{ return equal(__lhs.begin(), __lhs.end(), __rhs.begin(), __rhs.end()); } + mclow.lists wrote: > ldionne wrote: > > It's kind of crazy those are not constrained in any way, but that's what > > the paper says. I would expect some constraint based on whether we can > > compare `_Tp1` and _Tp2`. > In my prototype implementation, they were constrained. But LEWG decided not > to go there (which is the same approach taken in https://wg21.link/P0805 ). > There needs to be another paper written about constraining container > comparisons. > > It also applies to homogenous comparisons. Consider `vector>` > Two of them can't be compared (less than, etc), because `complex` > doesn't have a `operator<` Thanks for the information. https://reviews.llvm.org/D49338 ___ cfe-commits mailing list cfe-commits@lists.llvm.org
r337746 - [clang-cl] Expose -fblocks and -fno-builtin as driver flags
Author: rnk Date: Mon Jul 23 14:29:43 2018 New Revision: 337746 URL: http://llvm.org/viewvc/llvm-project?rev=337746=rev Log: [clang-cl] Expose -fblocks and -fno-builtin as driver flags Users have requested them. Helps with PR36427. Modified: cfe/trunk/include/clang/Driver/Options.td cfe/trunk/test/Driver/cl-options.c Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=337746=337745=337746=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Mon Jul 23 14:29:43 2018 @@ -762,12 +762,12 @@ def faddrsig : Flag<["-"], "faddrsig">, HelpText<"Emit an address-significance table">; def fno_addrsig : Flag<["-"], "fno-addrsig">, Group, Flags<[CoreOption]>, HelpText<"Don't emit an address-significance table">; -def fblocks : Flag<["-"], "fblocks">, Group, Flags<[CC1Option]>, +def fblocks : Flag<["-"], "fblocks">, Group, Flags<[CoreOption, CC1Option]>, HelpText<"Enable the 'blocks' language feature">; def fbootclasspath_EQ : Joined<["-"], "fbootclasspath=">, Group; def fborland_extensions : Flag<["-"], "fborland-extensions">, Group, Flags<[CC1Option]>, HelpText<"Accept non-standard constructs supported by the Borland compiler">; -def fbuiltin : Flag<["-"], "fbuiltin">, Group; +def fbuiltin : Flag<["-"], "fbuiltin">, Group, Flags<[CoreOption]>; def fbuiltin_module_map : Flag <["-"], "fbuiltin-module-map">, Group, Flags<[DriverOption]>, HelpText<"Load the clang builtins module map file.">; def fcaret_diagnostics : Flag<["-"], "fcaret-diagnostics">, Group; @@ -1320,11 +1320,11 @@ def fno_asynchronous_unwind_tables : Fla def fno_assume_sane_operator_new : Flag<["-"], "fno-assume-sane-operator-new">, Group, HelpText<"Don't assume that C++'s global operator new can't alias any pointer">, Flags<[CC1Option]>; -def fno_blocks : Flag<["-"], "fno-blocks">, Group; +def fno_blocks : Flag<["-"], "fno-blocks">, Group, Flags<[CoreOption]>; def fno_borland_extensions : Flag<["-"], "fno-borland-extensions">, Group; -def fno_builtin : Flag<["-"], "fno-builtin">, Group, Flags<[CC1Option]>, +def fno_builtin : Flag<["-"], "fno-builtin">, Group, Flags<[CC1Option, CoreOption]>, HelpText<"Disable implicit builtin knowledge of functions">; -def fno_builtin_ : Joined<["-"], "fno-builtin-">, Group, Flags<[CC1Option]>, +def fno_builtin_ : Joined<["-"], "fno-builtin-">, Group, Flags<[CC1Option, CoreOption]>, HelpText<"Disable implicit builtin knowledge of a specific function">; def fno_caret_diagnostics : Flag<["-"], "fno-caret-diagnostics">, Group, Flags<[CC1Option]>; Modified: cfe/trunk/test/Driver/cl-options.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=337746=337745=337746=diff == --- cfe/trunk/test/Driver/cl-options.c (original) +++ cfe/trunk/test/Driver/cl-options.c Mon Jul 23 14:29:43 2018 @@ -565,6 +565,11 @@ // (/Zs is for syntax-only, -Werror makes it fail hard on unknown options) // RUN: %clang_cl \ // RUN: --driver-mode=cl \ +// RUN: -fblocks \ +// RUN: -fno-blocks \ +// RUN: -fbuiltin \ +// RUN: -fno-builtin \ +// RUN: -fno-builtin-strcpy \ // RUN: -fcolor-diagnostics \ // RUN: -fno-color-diagnostics \ // RUN: -fcoverage-mapping \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49338: Implement - P0122R7
mclow.lists marked an inline comment as done. mclow.lists added a comment. > I missed the container constructors being `noexcept` Never mind; they're not `noexcept` (and they should not be) https://reviews.llvm.org/D49338 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r337743 - Fold -Wreturn-stack-address into general initialization lifetime
Author: rsmith Date: Mon Jul 23 14:21:22 2018 New Revision: 337743 URL: http://llvm.org/viewvc/llvm-project?rev=337743=rev Log: Fold -Wreturn-stack-address into general initialization lifetime checking. Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/Sema/SemaChecking.cpp cfe/trunk/lib/Sema/SemaInit.cpp cfe/trunk/test/Analysis/stack-addr-ps.c cfe/trunk/test/Analysis/stack-addr-ps.cpp cfe/trunk/test/Analysis/stackaddrleak.c cfe/trunk/test/CXX/drs/dr16xx.cpp cfe/trunk/test/CXX/drs/dr18xx.cpp cfe/trunk/test/CXX/special/class.copy/p11.0x.copy.cpp cfe/trunk/test/CXX/special/class.ctor/p5-0x.cpp cfe/trunk/test/CXX/temp/temp.param/p5.cpp cfe/trunk/test/SemaCXX/constexpr-default-arg.cpp cfe/trunk/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp cfe/trunk/test/SemaCXX/eval-crashes.cpp cfe/trunk/test/SemaCXX/return-stack-addr-2.cpp cfe/trunk/test/SemaCXX/return-stack-addr.cpp cfe/trunk/test/SemaCXX/rval-references.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=337743=337742=337743=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Jul 23 14:21:22 2018 @@ -7849,8 +7849,8 @@ def warn_null_ret : Warning< // CHECK: returning address/reference of stack memory def warn_ret_stack_addr_ref : Warning< - "%select{address of|reference to}0 stack memory associated with local " - "variable %1 returned">, + "%select{address of|reference to}0 stack memory associated with " + "%select{local variable|parameter}2 %1 returned">, InGroup; def warn_ret_local_temp_addr_ref : Warning< "returning %select{address of|reference to}0 local temporary object">, @@ -7860,8 +7860,10 @@ def warn_ret_addr_label : Warning< InGroup; def err_ret_local_block : Error< "returning block that lives on the local stack">; -def note_ref_var_local_bind : Note< - "binding reference variable %0 here">; +def note_local_var_initializer : Note< + "%select{via initialization of|binding reference}0 variable %1 here">; +def note_init_with_default_member_initalizer : Note< + "initializing field %0 with default member initializer">; // Check for initializing a member variable with the address or a reference to // a constructor parameter. @@ -7902,8 +7904,6 @@ def warn_default_member_init_init_list_n "created by aggregate initialization using default member initializer " "is not supported; lifetime of backing array will end at the end of the " "full-expression">, InGroup; -def note_in_default_member_initalizer_here : Note< - "in default member initializer for field %0 used here">; // For non-floating point, expressions of the form x == x or x != x // should result in a warning, since these always evaluate to a constant. Modified: cfe/trunk/lib/Sema/SemaChecking.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=337743=337742=337743=diff == --- cfe/trunk/lib/Sema/SemaChecking.cpp (original) +++ cfe/trunk/lib/Sema/SemaChecking.cpp Mon Jul 23 14:21:22 2018 @@ -9232,421 +9232,12 @@ void Sema::CheckStrncatArguments(const C << FixItHint::CreateReplacement(SR, OS.str()); } -//===--- CHECK: Return Address of Stack Variable --===// - -static const Expr *EvalVal(const Expr *E, - SmallVectorImpl , - const Decl *ParentDecl); -static const Expr *EvalAddr(const Expr *E, -SmallVectorImpl , -const Decl *ParentDecl); - -/// CheckReturnStackAddr - Check if a return statement returns the address -/// of a stack variable. -static void -CheckReturnStackAddr(Sema , Expr *RetValExp, QualType lhsType, - SourceLocation ReturnLoc) { - const Expr *stackE = nullptr; - SmallVector refVars; - - // Perform checking for returned stack addresses, local blocks, - // label addresses or references to temporaries. - if (lhsType->isPointerType() || - (!S.getLangOpts().ObjCAutoRefCount && lhsType->isBlockPointerType())) { -stackE = EvalAddr(RetValExp, refVars, /*ParentDecl=*/nullptr); - } else if (lhsType->isReferenceType()) { -stackE = EvalVal(RetValExp, refVars, /*ParentDecl=*/nullptr); - } - - if (!stackE) -return; // Nothing suspicious was found. - - // Parameters are initialized in the calling scope, so taking the address - // of a parameter reference doesn't need a warning. - for (auto *DRE : refVars) -if (isa(DRE->getDecl())) - return; - - SourceLocation diagLoc; - SourceRange diagRange; - if (refVars.empty()) { -diagLoc = stackE->getLocStart(); -diagRange =
r337744 - Do not try to perform lifetime-extension through conditional
Author: rsmith Date: Mon Jul 23 14:21:24 2018 New Revision: 337744 URL: http://llvm.org/viewvc/llvm-project?rev=337744=rev Log: Do not try to perform lifetime-extension through conditional expressions. CodeGen can't cope with that yet. Instead, produce a "not supported" warning for now and don't extend lifetime. Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/Sema/SemaInit.cpp cfe/trunk/test/SemaCXX/conditional-expr.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=337744=337743=337744=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Jul 23 14:21:24 2018 @@ -7895,13 +7895,16 @@ def warn_new_dangling_initializer_list : "the allocated initializer list}0 " "will be destroyed at the end of the full-expression">, InGroup; -def warn_default_member_init_temporary_not_extended : Warning< - "sorry, lifetime extension of temporary created by aggregate initialization " - "using default member initializer is not supported; lifetime of temporary " +def warn_unsupported_temporary_not_extended : Warning< + "sorry, lifetime extension of temporary created " + "%select{by aggregate initialization using default member initializer|" + "within conditional expression}0 " + "is not supported; lifetime of temporary " "will end at the end of the full-expression">, InGroup; -def warn_default_member_init_init_list_not_extended : Warning< - "sorry, lifetime extension of backing array of initializer list " - "created by aggregate initialization using default member initializer " +def warn_unsupported_init_list_not_extended : Warning< + "sorry, lifetime extension of backing array of initializer list created " + "%select{by aggregate initialization using default member initializer|" + "within conditional expression}0 " "is not supported; lifetime of backing array will end at the end of the " "full-expression">, InGroup; Modified: cfe/trunk/lib/Sema/SemaInit.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=337744=337743=337744=diff == --- cfe/trunk/lib/Sema/SemaInit.cpp (original) +++ cfe/trunk/lib/Sema/SemaInit.cpp Mon Jul 23 14:21:24 2018 @@ -6362,6 +6362,7 @@ using Local = Expr*; struct IndirectLocalPathEntry { enum EntryKind { DefaultInit, +Conditional, AddressOf, VarInit, LValToRVal, @@ -6497,6 +6498,7 @@ static void visitLocalsRetainedByReferen case Stmt::ConditionalOperatorClass: case Stmt::BinaryConditionalOperatorClass: { +Path.push_back({IndirectLocalPathEntry::Conditional, Init}); auto *C = cast(Init); if (!C->getTrueExpr()->getType()->isVoidType()) visitLocalsRetainedByReferenceBinding(Path, C->getTrueExpr(), RK, Visit); @@ -6683,6 +6685,7 @@ static void visitLocalsRetainedByInitial case Stmt::ConditionalOperatorClass: case Stmt::BinaryConditionalOperatorClass: { +Path.push_back({IndirectLocalPathEntry::Conditional, Init}); auto *C = cast(Init); // In C++, we can have a throw-expression operand, which has 'void' type // and isn't interesting from a lifetime perspective. @@ -6714,12 +6717,33 @@ static void visitLocalsRetainedByInitial /// supposed to lifetime-extend along (but don't). static bool shouldLifetimeExtendThroughPath(const IndirectLocalPath ) { for (auto Elem : Path) { -if (Elem.Kind != IndirectLocalPathEntry::DefaultInit) +if (Elem.Kind != IndirectLocalPathEntry::DefaultInit && +Elem.Kind != IndirectLocalPathEntry::Conditional) return false; } return true; } +/// Find the range for the first interesting entry in the path at or after I. +static SourceRange nextPathEntryRange(const IndirectLocalPath , unsigned I, + Expr *E) { + for (unsigned N = Path.size(); I != N; ++I) { +switch (Path[I].Kind) { +case IndirectLocalPathEntry::AddressOf: +case IndirectLocalPathEntry::LValToRVal: +case IndirectLocalPathEntry::Conditional: + // These exist primarily to mark the path as not permitting or + // supporting lifetime extension. + break; + +case IndirectLocalPathEntry::DefaultInit: +case IndirectLocalPathEntry::VarInit: + return Path[I].E->getSourceRange(); +} + } + return E->getSourceRange(); +} + void Sema::checkInitializerLifetime(const InitializedEntity , Expr *Init) { LifetimeResult LR = getEntityLifetime(); @@ -6733,9 +6757,8 @@ void Sema::checkInitializerLifetime(cons auto TemporaryVisitor = [&](IndirectLocalPath , Local L, ReferenceKind RK) -> bool { -Expr *First =
Re: r337627 - Fold dangling-field warning into general initialization lifetime checks.
Thanks, fixed and re-committed in r337726. On Sun, 22 Jul 2018 at 23:33, Ilya Biryukov via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Reverted in r337671 > > On Mon, Jul 23, 2018 at 8:24 AM Ilya Biryukov > wrote: > >> Hi Richard, >> >> this commit seems to cause invalid warning in the following example: >> >> struct foo { >> foo(char *x) : x_([10]) {} // >> private: >> char *x_; >> }; >> >> The warning itself: >> 1.cpp:2:21: warning: initializing pointer member 'x_' with the stack >> address of parameter 'x' [-Wdangling-field] >> >> I'll revert the change to unbreak our integrate. >> >> >> On Sat, Jul 21, 2018 at 12:31 AM Richard Smith via cfe-commits < >> cfe-commits@lists.llvm.org> wrote: >> >>> Author: rsmith >>> Date: Fri Jul 20 15:25:55 2018 >>> New Revision: 337627 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=337627=rev >>> Log: >>> Fold dangling-field warning into general initialization lifetime checks. >>> >>> Modified: >>> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td >>> cfe/trunk/lib/Sema/SemaDeclCXX.cpp >>> cfe/trunk/lib/Sema/SemaInit.cpp >>> cfe/trunk/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp >>> cfe/trunk/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp >>> >>> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td >>> URL: >>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=337627=337626=337627=diff >>> >>> == >>> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) >>> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Jul 20 >>> 15:25:55 2018 >>> @@ -7870,11 +7870,11 @@ def note_ref_var_local_bind : Note< >>> // Check for initializing a member variable with the address or a >>> reference to >>> // a constructor parameter. >>> def warn_bind_ref_member_to_parameter : Warning< >>> - "binding reference member %0 to stack allocated parameter %1">, >>> - InGroup; >>> + "binding reference member %0 to stack allocated " >>> + "%select{variable|parameter}2 %1">, InGroup; >>> def warn_init_ptr_member_to_parameter_addr : Warning< >>> - "initializing pointer member %0 with the stack address of parameter >>> %1">, >>> - InGroup; >>> + "initializing pointer member %0 with the stack address of " >>> + "%select{variable|parameter}2 %1">, InGroup; >>> def note_ref_or_ptr_member_declared_here : Note< >>>"%select{reference|pointer}0 member declared here">; >>> >>> >>> Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp >>> URL: >>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=337627=337626=337627=diff >>> >>> == >>> --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original) >>> +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri Jul 20 15:25:55 2018 >>> @@ -3946,53 +3946,6 @@ Sema::BuildMemInitializer(Decl *Construc >>>return BuildBaseInitializer(BaseType, TInfo, Init, ClassDecl, >>> EllipsisLoc); >>> } >>> >>> -/// Checks a member initializer expression for cases where reference (or >>> -/// pointer) members are bound to by-value parameters (or their >>> addresses). >>> -static void CheckForDanglingReferenceOrPointer(Sema , ValueDecl >>> *Member, >>> - Expr *Init, >>> - SourceLocation IdLoc) { >>> - QualType MemberTy = Member->getType(); >>> - >>> - // We only handle pointers and references currently. >>> - // FIXME: Would this be relevant for ObjC object pointers? Or block >>> pointers? >>> - if (!MemberTy->isReferenceType() && !MemberTy->isPointerType()) >>> -return; >>> - >>> - const bool IsPointer = MemberTy->isPointerType(); >>> - if (IsPointer) { >>> -if (const UnaryOperator *Op >>> - = dyn_cast(Init->IgnoreParenImpCasts())) { >>> - // The only case we're worried about with pointers requires >>> taking the >>> - // address. >>> - if (Op->getOpcode() != UO_AddrOf) >>> -return; >>> - >>> - Init = Op->getSubExpr(); >>> -} else { >>> - // We only handle address-of expression initializers for pointers. >>> - return; >>> -} >>> - } >>> - >>> - if (const DeclRefExpr *DRE = >>> dyn_cast(Init->IgnoreParens())) { >>> -// We only warn when referring to a non-reference parameter >>> declaration. >>> -const ParmVarDecl *Parameter = >>> dyn_cast(DRE->getDecl()); >>> -if (!Parameter || Parameter->getType()->isReferenceType()) >>> - return; >>> - >>> -S.Diag(Init->getExprLoc(), >>> - IsPointer ? diag::warn_init_ptr_member_to_parameter_addr >>> - : diag::warn_bind_ref_member_to_parameter) >>> - << Member << Parameter << Init->getSourceRange(); >>> - } else { >>> -// Other initializers are fine. >>> -return; >>> - } >>> - >>> - S.Diag(Member->getLocation(), >>>
[PATCH] D49338: Implement - P0122R7
mclow.lists marked 13 inline comments as done. mclow.lists added a comment. I missed the container constructors being `noexcept`, and the asserts on `operator[]` and `operator()` are half done (stupid signed indicies). I'll wait for other feedback before doing those bits. Comment at: include/span:320 +constexpr span +inline _LIBCPP_INLINE_VISIBILITY + subspan(index_type __offset, index_type __count = dynamic_extent) const noexcept ldionne wrote: > I think we generally put those annotations before the return type. Consider > doing so here and below for consistency. I'm not sure where you're referring to "and below". We already do so for the other `subspan`. But definitely here. Comment at: include/span:335-336 + +_LIBCPP_INLINE_VISIBILITY constexpr reference operator[](index_type __idx) const noexcept { return __data[__idx]; } +_LIBCPP_INLINE_VISIBILITY constexpr reference operator()(index_type __idx) const noexcept { return __data[__idx]; } +_LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; } ldionne wrote: > Those two could have a `_LIBCPP_ASSERT(__idx >= 0 && __idx < size())`. Is it > a conscious choice not to put one? D'oh! only half done! https://reviews.llvm.org/D49338 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49573: [CMake] Option to control whether shared/static library is installed
phosek added a comment. You're right that we don't need these flags for libc++, we only need them for libc++abi and libunwind for the cases when one of these is linked into libc++ or libc++abi respectively. I added them for consistency, but I'm fine dropping them from libc++, would that be more acceptable? Repository: rL LLVM https://reviews.llvm.org/D49573 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49652: Apply -fdebug-prefix-map in reverse of command line order
probinson added a comment. In https://reviews.llvm.org/D49652#1172352, @alxu wrote: > I was just going to run llvm-dwarfdump. Well, that's one of those quirks I mentioned. This is a Clang change, and Clang tests should exercise as little of LLVM as possible. That means you don't generate assembler or an object file, if you can possibly help it. And in this case, the path renaming should be visible in the debug-info metadata, which makes it easy enough to test by emitting LLVM IR and looking at that. It's by far the most common test idiom for changes to Clang's CodeGen layer. Given that the prefix mapping happens in the LLVM IR, it should be no harder to emit IR and write a pattern-match than it would be for dwarfdump output. Really. Try `clang -g -S -emit-llvm` on some simple test file, then throw a remap option at it and see what's different. Repository: rC Clang https://reviews.llvm.org/D49652 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49466: Initial implementation of -fmacro-prefix-map and -ffile-prefix-map
alxu added a comment. FYI, gcc uses the stupid and bad string prefix matching approach. if clang supports the same option, it should have the same behavior. you could decide that it's a bad idea, but then the option should be called something else, otherwise people will have to go back to testing compiler name and versions again which is :(. Repository: rC Clang https://reviews.llvm.org/D49466 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r337738 - Update to -r337585, allow scoped enum inits in -pedantic
Author: erichkeane Date: Mon Jul 23 14:08:13 2018 New Revision: 337738 URL: http://llvm.org/viewvc/llvm-project?rev=337738=rev Log: Update to -r337585, allow scoped enum inits in -pedantic Modified: cfe/trunk/include/clang/AST/Type.h cfe/trunk/lib/AST/Type.cpp cfe/trunk/lib/Sema/SemaDecl.cpp cfe/trunk/test/SemaCXX/PR38235.cpp Modified: cfe/trunk/include/clang/AST/Type.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=337738=337737=337738=diff == --- cfe/trunk/include/clang/AST/Type.h (original) +++ cfe/trunk/include/clang/AST/Type.h Mon Jul 23 14:08:13 2018 @@ -1784,6 +1784,9 @@ public: /// isComplexIntegerType() can be used to test for complex integers. bool isIntegerType() const; // C99 6.2.5p17 (int, char, bool, enum) bool isEnumeralType() const; + + /// Determine whether this type is a scoped enumeration type. + bool isScopedEnumeralType() const; bool isBooleanType() const; bool isCharType() const; bool isWideCharType() const; Modified: cfe/trunk/lib/AST/Type.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=337738=337737=337738=diff == --- cfe/trunk/lib/AST/Type.cpp (original) +++ cfe/trunk/lib/AST/Type.cpp Mon Jul 23 14:08:13 2018 @@ -481,6 +481,12 @@ bool Type::isComplexIntegerType() const return getAsComplexIntegerType(); } +bool Type::isScopedEnumeralType() const { + if (const auto *ET = getAs()) +return ET->getDecl()->isScoped(); + return false; +} + const ComplexType *Type::getAsComplexIntegerType() const { if (const auto *Complex = getAs()) if (Complex->getElementType()->isIntegerType()) Modified: cfe/trunk/lib/Sema/SemaDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=337738=337737=337738=diff == --- cfe/trunk/lib/Sema/SemaDecl.cpp (original) +++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Jul 23 14:08:13 2018 @@ -11165,6 +11165,9 @@ void Sema::AddInitializerToDecl(Decl *Re ; // Nothing to check. else if (Init->isIntegerConstantExpr(Context, )) ; // Ok, it's an ICE! + else if (Init->getType()->isScopedEnumeralType() && + Init->isCXX11ConstantExpr(Context)) +; // Ok, it is a scoped-enum constant expression. else if (Init->isEvaluatable(Context)) { // If we can constant fold the initializer through heroics, accept it, // but report this as a use of an extension for -pedantic. Modified: cfe/trunk/test/SemaCXX/PR38235.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/PR38235.cpp?rev=337738=337737=337738=diff == --- cfe/trunk/test/SemaCXX/PR38235.cpp (original) +++ cfe/trunk/test/SemaCXX/PR38235.cpp Mon Jul 23 14:08:13 2018 @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s enum class E { Foo, Bar = 97119 }; @@ -12,3 +12,9 @@ void switch_me(E e) { break; } } + +enum class E2; + +struct S { + static const E e = E::Foo; +}; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49403: More aggressively complete RecordTypes with Function Pointers
rjmccall added a comment. Are you sure you shouldn't do it based on some sort of actual annotation based on the frontend's knowledge of types instead of adding semantics for LLVM IR types that were never intended? https://reviews.llvm.org/D49403 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49652: Apply -fdebug-prefix-map in reverse of command line order
alxu added a comment. I was just going to run llvm-dwarfdump. Repository: rC Clang https://reviews.llvm.org/D49652 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D45124: [CodeGen] Record if a C++ record is a trivial type
Test? On Mon, Jul 23, 2018 at 11:49 PM, Aaron Smith via Phabricator via llvm-commits wrote: > This revision was automatically updated to reflect the committed changes. > Closed by commit rC337736: [CodeGen] Record if a C++ record is a trivial type > (authored by asmith, committed by ). > > Repository: > rC Clang > > https://reviews.llvm.org/D45124 > > Files: > lib/CodeGen/CGDebugInfo.cpp > > > Index: lib/CodeGen/CGDebugInfo.cpp > === > --- lib/CodeGen/CGDebugInfo.cpp > +++ lib/CodeGen/CGDebugInfo.cpp > @@ -2908,6 +2908,10 @@ >Flags |= llvm::DINode::FlagTypePassByReference; > else >Flags |= llvm::DINode::FlagTypePassByValue; > + > +// Record if a C++ record is trivial type. > +if (CXXRD->isTrivial()) > + Flags |= llvm::DINode::FlagTrivial; >} > >llvm::DICompositeType *RealDecl = DBuilder.createReplaceableCompositeType( > > > > ___ > llvm-commits mailing list > llvm-comm...@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49403: More aggressively complete RecordTypes with Function Pointers
olga.chupina added a comment. Yes, correct. https://reviews.llvm.org/D49403 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D45124: [CodeGen] Record if a C++ record is a trivial type
This revision was automatically updated to reflect the committed changes. Closed by commit rC337736: [CodeGen] Record if a C++ record is a trivial type (authored by asmith, committed by ). Repository: rC Clang https://reviews.llvm.org/D45124 Files: lib/CodeGen/CGDebugInfo.cpp Index: lib/CodeGen/CGDebugInfo.cpp === --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -2908,6 +2908,10 @@ Flags |= llvm::DINode::FlagTypePassByReference; else Flags |= llvm::DINode::FlagTypePassByValue; + +// Record if a C++ record is trivial type. +if (CXXRD->isTrivial()) + Flags |= llvm::DINode::FlagTrivial; } llvm::DICompositeType *RealDecl = DBuilder.createReplaceableCompositeType( Index: lib/CodeGen/CGDebugInfo.cpp === --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -2908,6 +2908,10 @@ Flags |= llvm::DINode::FlagTypePassByReference; else Flags |= llvm::DINode::FlagTypePassByValue; + +// Record if a C++ record is trivial type. +if (CXXRD->isTrivial()) + Flags |= llvm::DINode::FlagTrivial; } llvm::DICompositeType *RealDecl = DBuilder.createReplaceableCompositeType( ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code
emmettneyman updated this revision to Diff 156862. emmettneyman added a comment. Made fixes to patch, rebased CMake file Repository: rC Clang https://reviews.llvm.org/D49526 Files: clang/tools/clang-fuzzer/handle-llvm/CMakeLists.txt clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp Index: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp === --- clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp +++ clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp @@ -7,33 +7,51 @@ // //===--===// // -// Implements HandleLLVM for use by the Clang fuzzers. Mimics the llc tool to -// compile an LLVM IR file to X86_64 assembly. +// Implements HandleLLVM for use by the Clang fuzzers. First runs an loop +// vectorizer optimization pass over the given IR code. Then mimics lli on both +// versions to JIT the generated code and execute it. Currently, functions are +// executed on dummy inputs. // //===--===// #include "handle_llvm.h" #include "llvm/ADT/Triple.h" #include "llvm/Analysis/TargetLibraryInfo.h" +#include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/CodeGen/CommandFlags.inc" #include "llvm/CodeGen/MachineModuleInfo.h" +#include "llvm/CodeGen/TargetPassConfig.h" +#include "llvm/ExecutionEngine/GenericValue.h" +#include "llvm/ExecutionEngine/JITEventListener.h" +#include "llvm/ExecutionEngine/JITSymbol.h" +#include "llvm/ExecutionEngine/MCJIT.h" +#include "llvm/ExecutionEngine/ObjectCache.h" +#include "llvm/ExecutionEngine/RTDyldMemoryManager.h" +#include "llvm/ExecutionEngine/SectionMemoryManager.h" +#include "llvm/IR/IRPrintingPasses.h" #include "llvm/IR/LegacyPassManager.h" +#include "llvm/IR/LegacyPassNameParser.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" #include "llvm/IR/Verifier.h" #include "llvm/IRReader/IRReader.h" +#include "llvm/Pass.h" #include "llvm/PassRegistry.h" -#include "llvm/Support/InitLLVM.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/TargetRegistry.h" +#include "llvm/Support/TargetSelect.h" #include "llvm/Target/TargetMachine.h" - -#include +#include "llvm/Transforms/IPO/PassManagerBuilder.h" +#include "llvm/Transforms/IPO.h" using namespace llvm; +static cl::list +PassList(cl::desc("Optimizations available:")); + +// Helper function to parse command line args and find the optimization level static void getOptLevel(const std::vector , CodeGenOpt::Level ) { // Find the optimization level from the command line args @@ -53,59 +71,182 @@ } } -void clang_fuzzer::HandleLLVM(const std::string , - const std::vector ) { - // Parse ExtraArgs to set the optimization level - CodeGenOpt::Level OLvl; - getOptLevel(ExtraArgs, OLvl); +// Helper function to call pass initialization functions +void InitEverything() { + PassRegistry = *PassRegistry::getPassRegistry(); + initializeCore(Registry); + initializeScalarOpts(Registry); + initializeVectorization(Registry); + initializeIPO(Registry); + initializeAnalysis(Registry); + initializeTransformUtils(Registry); + initializeInstCombine(Registry); + initializeAggressiveInstCombine(Registry); + initializeInstrumentation(Registry); + initializeTarget(Registry); +} - // Set the Module to include the the IR code to be compiled +// Helper function to add optimization passes to the TargetMachine at the +// specified optimization level, OptLevel +static void AddOptimizationPasses(legacy::PassManagerBase , + legacy::FunctionPassManager , + unsigned OptLevel, unsigned SizeLevel) { + // Verify that input is correct by adding a verifier pass + FPM.add(createVerifierPass()); + + // Create and initializa a PassManagerBuilder + PassManagerBuilder Builder; + Builder.OptLevel = OptLevel; + Builder.SizeLevel = SizeLevel; + Builder.Inliner = createFunctionInliningPass(OptLevel, SizeLevel, false); + Builder.LoopVectorize = true; + Builder.populateFunctionPassManager(FPM); + Builder.populateModulePassManager(MPM); +} + +// Mimics the opt tool to run an optimization pass over the provided IR +std::string OptLLVM(const std::string IR, CodeGenOpt::Level ) { + InitEverything(); + + // Mimic argc and argv and pass them to ParseCommandLineOptions to initilize + // PassList, ie which optimizations we want to run on the IR + // TODO: Find a better way of doing this + char *args[2]; + char t[18] = "llvm-proto-fuzzer"; + char s[16] = "-loop-vectorize"; + args[0] = t; + args[1] = s; + cl::ParseCommandLineOptions(2, args, ""); + + // Create a module that will run the optimization passes SMDiagnostic Err; + LLVMContext Context; + std::unique_ptr M = parseIR(MemoryBufferRef(IR, "IR"), Err,
[PATCH] D49338: Implement - P0122R7
mclow.lists marked 5 inline comments as done. mclow.lists added a comment. I think I've answered all of Louis' questions that don't require code changes. New patch will be coming soon. Comment at: include/span:217 +using pointer= _Tp *; +using const_pointer = const _Tp *; // not in standard +using reference = _Tp &; ldionne wrote: > Why are we providing them if they are not in the standard? Because (a) they're useful (see the definition of `const_iterator` below, and (b) I (and STL, who wrote the final version of the `span` paper, believe that not having them was just an oversight. Comment at: include/span:235 + +_LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, index_type __count) : __data{__ptr} +{ (void)__count; _LIBCPP_ASSERT(_Extent == __count, "size mismatch in span's constructor (ptr, len)"); } ldionne wrote: > Those functions are specified to throw nothing in the standard. Do we want to > add `noexcept` as a QOI thing? What's our usual stance on this? Yes. The standard follows the "Lakos rule", which says that narrow contract functions should not be marked `noexcept`, because goodness knows what might happen if you fail to fulfill the preconditions. Library implementors have the freedom to mark things as `noexcept` (and libc++ does - see `vector::operator[]` for example). Comment at: include/span:254 +constexpr span(const _Container& __c, +const enable_if_t<__is_span_compatible_container::value, nullptr_t> = nullptr) +: __data{_VSTD::data(__c)} ldionne wrote: > For both of these `Container` constructors, the paper expresses the SFINAE > conditions based on `Container`, not on `Container` in one case and > `Container const` in the other, which is what you're doing. > > This is actually a bug in the paper, because this will make code like this > compile: > > ``` > std::vector const v; > std::span s(v); > ``` > > Instead, this should be a compiler error because we're clearly not > const-correct here, initializing a `span`-over-non-const from a const > `vector`. Example: https://wandbox.org/permlink/kYCui3o0LEGRQ67x > > This happens because we're discarding the constness of the `_Container` > template parameter if we stick 100% to the wording of the paper. Should this > be a DR? Yes, this should be an LWG issue. Comment at: include/span:275 + +// ~span() noexcept = default; + ldionne wrote: > Why is this commented out? This is commented out because of a clang bug https://bugs.llvm.org/show_bug.cgi?id=38143, where copy constructor will become non-constexpr. Once this fixed, we can un-comment this line (though it should make no difference if it is present or not). Comment at: include/span:351 +{ +pointer __p = __data; +__data = __other.__data; ldionne wrote: > Just curious -- why not use `_VSTD::swap(__data, __other.__data)`? This would > avoid any potential for a stupid logic error to sneak up. Not to have to include ``? (It may get included anyway) Comment at: include/span:356-359 +_LIBCPP_INLINE_VISIBILITY span __as_bytes() const noexcept +{ return {reinterpret_cast(data()), size_bytes()}; } + +_LIBCPP_INLINE_VISIBILITY span __as_writeable_bytes() const noexcept ldionne wrote: > It looks like neither `as_bytes` nor `as_writeable_bytes` is marked `const` > in the paper. Why are we deviating? In N4762, they're marked as non-member functions that take `span` by value. This implementation just turns around and calls a member function (with an unpronounceable name) to do the work. The standard never mentions `__as_bytes` or `__as_writeable_bytes`. Comment at: include/span:531 +operator==(const span<_Tp1, _Extent1>& __lhs, const span<_Tp2, _Extent2>& __rhs) +{ return equal(__lhs.begin(), __lhs.end(), __rhs.begin(), __rhs.end()); } + ldionne wrote: > It's kind of crazy those are not constrained in any way, but that's what the > paper says. I would expect some constraint based on whether we can compare > `_Tp1` and _Tp2`. In my prototype implementation, they were constrained. But LEWG decided not to go there (which is the same approach taken in https://wg21.link/P0805 ). There needs to be another paper written about constraining container comparisons. It also applies to homogenous comparisons. Consider `vector>` Two of them can't be compared (less than, etc), because `complex` doesn't have a `operator<` https://reviews.llvm.org/D49338 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49652: Apply -fdebug-prefix-map in reverse of command line order
probinson added a comment. Re. SmallVector versus std::vector, they are functionally similar but have different memory-allocation behaviors. SmallVector includes a vector of N elements (where N is the template parameter) so does no dynamic allocation until you have more than N elements; but it takes up that much more space as a member of a class. It's mainly intended for stack variables. Given that this particular option is used rarely, I would probably go with std::vector. The code change otherwise is pretty simple and looks fine. As for testing, it has its quirks for sure. But I'm happy to help sort out any issues. There should be plenty of CodeGen examples with debug info in the test tree to imitate. You'll want to start with C/C++ source and use `-emit-llvm` to get textual IR, then use FileCheck (our fancy-pants grep) to look for the new pathname patterns. Repository: rC Clang https://reviews.llvm.org/D49652 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49688: [Sema] Fix a crash when a BlockExpr appears in a default-member-initializer of a class template
rjmccall added a comment. I honestly don't know why the `BlockDecl` is in the members list in the first place; that seems wrong, for the same reason that we wouldn't (I assume?) consider a lambda's implicit record to be a member. Repository: rC Clang https://reviews.llvm.org/D49688 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r337433 - [clang]: Add support for "-fno-delete-null-pointer-checks"
Agree, will try to add separate testcase soon. Thanks, Manoj On Mon, Jul 23, 2018 at 12:39 PM Richard Smith wrote: > Hi Manoj, > > Please can you add better test coverage that we don't emit 'nonnull' > annotations for reference parameters / return values? At the moment, the > only such test coverage has been added to test files that are testing > unrelated things, which seems inappropriate. A separate test file that > tests that we don't emit 'nonnull' annotations when null pointers are > assumed valid would seem best to me. > > Thanks! > > On Wed, 18 Jul 2018 at 17:49, Manoj Gupta via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> Author: manojgupta >> Date: Wed Jul 18 17:44:52 2018 >> New Revision: 337433 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=337433=rev >> Log: >> [clang]: Add support for "-fno-delete-null-pointer-checks" >> >> Summary: >> Support for this option is needed for building Linux kernel. >> This is a very frequently requested feature by kernel developers. >> >> More details : https://lkml.org/lkml/2018/4/4/601 >> >> GCC option description for -fdelete-null-pointer-checks: >> This Assume that programs cannot safely dereference null pointers, >> and that no code or data element resides at address zero. >> >> -fno-delete-null-pointer-checks is the inverse of this implying that >> null pointer dereferencing is not undefined. >> >> This feature is implemented in as the function attribute >> "null-pointer-is-valid"="true". >> This CL only adds the attribute on the function. >> It also strips "nonnull" attributes from function arguments but >> keeps the related warnings unchanged. >> >> Corresponding LLVM change rL336613 already updated the >> optimizations to not treat null pointer dereferencing >> as undefined if the attribute is present. >> >> Reviewers: t.p.northover, efriedma, jyknight, chandlerc, rnk, srhines, >> void, george.burgess.iv >> >> Reviewed By: jyknight >> >> Subscribers: drinkcat, xbolva00, cfe-commits >> >> Differential Revision: https://reviews.llvm.org/D47894 >> >> Added: >> cfe/trunk/test/CodeGen/delete-null-pointer-checks.c >> Modified: >> cfe/trunk/docs/ClangCommandLineReference.rst >> cfe/trunk/include/clang/Driver/Options.td >> cfe/trunk/include/clang/Frontend/CodeGenOptions.def >> cfe/trunk/lib/CodeGen/CGCall.cpp >> cfe/trunk/lib/Driver/ToolChains/Clang.cpp >> cfe/trunk/lib/Frontend/CompilerInvocation.cpp >> cfe/trunk/test/CodeGen/nonnull.c >> cfe/trunk/test/CodeGen/vla.c >> cfe/trunk/test/CodeGenCXX/address-space-ref.cpp >> cfe/trunk/test/CodeGenCXX/constructors.cpp >> cfe/trunk/test/CodeGenCXX/temporaries.cpp >> cfe/trunk/test/Driver/clang_f_opts.c >> cfe/trunk/test/Sema/nonnull.c >> >> Modified: cfe/trunk/docs/ClangCommandLineReference.rst >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCommandLineReference.rst?rev=337433=337432=337433=diff >> >> == >> --- cfe/trunk/docs/ClangCommandLineReference.rst (original) >> +++ cfe/trunk/docs/ClangCommandLineReference.rst Wed Jul 18 17:44:52 2018 >> @@ -1543,6 +1543,14 @@ Specifies the largest alignment guarante >> >> Disable implicit builtin knowledge of a specific function >> >> +.. option:: -fdelete-null-pointer-checks, -fno-delete-null-pointer-checks >> + >> +When enabled, treat null pointer dereference, creation of a reference to >> null, >> +or passing a null pointer to a function parameter annotated with the >> "nonnull" >> +attribute as undefined behavior. (And, thus the optimizer may assume >> that any >> +pointer used in such a way must not have been null and optimize away the >> +branches accordingly.) On by default. >> + >> .. option:: -fno-elide-type >> >> Do not elide types when printing diagnostics >> >> Modified: cfe/trunk/include/clang/Driver/Options.td >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=337433=337432=337433=diff >> >> == >> --- cfe/trunk/include/clang/Driver/Options.td (original) >> +++ cfe/trunk/include/clang/Driver/Options.td Wed Jul 18 17:44:52 2018 >> @@ -1080,6 +1080,13 @@ def frewrite_imports : Flag<["-"], "frew >>Flags<[CC1Option]>; >> def fno_rewrite_imports : Flag<["-"], "fno-rewrite-imports">, >> Group; >> >> +def fdelete_null_pointer_checks : Flag<["-"], >> + "fdelete-null-pointer-checks">, Group, >> + HelpText<"Treat usage of null pointers as undefined behavior.">; >> +def fno_delete_null_pointer_checks : Flag<["-"], >> + "fno-delete-null-pointer-checks">, Group, Flags<[CC1Option]>, >> + HelpText<"Do not treat usage of null pointers as undefined behavior.">; >> + >> def frewrite_map_file : Separate<["-"], "frewrite-map-file">, >> Group, >> Flags<[ DriverOption, CC1Option ]>; >> @@ -2855,8 +2862,6 @@ defm reorder_blocks :
[PATCH] D49403: More aggressively complete RecordTypes with Function Pointers
rjmccall added a comment. Sorry, I'm not following you. Are you doing some sort of type-based security analysis based on LLVM IR types? https://reviews.llvm.org/D49403 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49597: [ms] Fix mangling of vector types in QMM_Result contexts.
thakis closed this revision. thakis added a comment. r337732, thanks! https://reviews.llvm.org/D49597 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits