[clang] 3fbac79 - [AArch64] Don't write to source directory in test
Author: Benjamin Kramer Date: 2024-03-20T14:54:39+01:00 New Revision: 3fbac79064e405a54388d11370ab5a8f0f23914d URL: https://github.com/llvm/llvm-project/commit/3fbac79064e405a54388d11370ab5a8f0f23914d DIFF: https://github.com/llvm/llvm-project/commit/3fbac79064e405a54388d11370ab5a8f0f23914d.diff LOG: [AArch64] Don't write to source directory in test Added: Modified: clang/test/CodeGen/aarch64-soft-float-abi-errors.c Removed: diff --git a/clang/test/CodeGen/aarch64-soft-float-abi-errors.c b/clang/test/CodeGen/aarch64-soft-float-abi-errors.c index 3e5ab9e92a1d8c..551e53bcd63d8a 100644 --- a/clang/test/CodeGen/aarch64-soft-float-abi-errors.c +++ b/clang/test/CodeGen/aarch64-soft-float-abi-errors.c @@ -1,9 +1,9 @@ // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +fp-armv8 -S -target-abi aapcs -verify=fp-hard %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature -fp-armv8 -S -target-abi aapcs-soft -verify=nofp-soft %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature -fp-armv8 -S -target-abi aapcs -verify=nofp-hard %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature -fp-armv8 -S -target-abi aapcs -O1 -verify=nofp-hard,nofp-hard-opt -emit-llvm %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +fp-armv8 -S -o /dev/null -target-abi aapcs -verify=fp-hard %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature -fp-armv8 -S -o /dev/null -target-abi aapcs-soft -verify=nofp-soft %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature -fp-armv8 -S -o /dev/null -target-abi aapcs -verify=nofp-hard %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature -fp-armv8 -S -o /dev/null -target-abi aapcs -O1 -verify=nofp-hard,nofp-hard-opt -emit-llvm %s // No run line needed for soft-float ABI with an FPU because that is rejected by the driver // With the hard-float ABI and a target with an FPU, FP arguments are passed in ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-format][NFC] Eliminate the IsCpp parameter in all functions (PR #84599)
d0k wrote: It calls `clang::format::cleanupAroundReplacements` from multiple threads. Now there's a race condition on IsCpp. If this was supposed to be a cleanup please revert it. https://github.com/llvm/llvm-project/pull/84599 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-format][NFC] Eliminate the IsCpp parameter in all functions (PR #84599)
d0k wrote: This is now breaking multithreaded IDE use cases, can you explain why this change is necessary? https://github.com/llvm/llvm-project/pull/84599 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] f362e12 - [clang-format] Make header self-contained
Author: Benjamin Kramer Date: 2024-03-18T11:23:38+01:00 New Revision: f362e12aab9ce07b836a2622fc987cda8b6ab6f8 URL: https://github.com/llvm/llvm-project/commit/f362e12aab9ce07b836a2622fc987cda8b6ab6f8 DIFF: https://github.com/llvm/llvm-project/commit/f362e12aab9ce07b836a2622fc987cda8b6ab6f8.diff LOG: [clang-format] Make header self-contained These includes were removed in 426e6945897afbec01c042bec4771522a2aac176 Added: Modified: clang/lib/Format/FormatInternal.h Removed: diff --git a/clang/lib/Format/FormatInternal.h b/clang/lib/Format/FormatInternal.h index 87974a853365c6..60c5bf6b786b04 100644 --- a/clang/lib/Format/FormatInternal.h +++ b/clang/lib/Format/FormatInternal.h @@ -15,6 +15,11 @@ #ifndef LLVM_CLANG_LIB_FORMAT_FORMATINTERNAL_H #define LLVM_CLANG_LIB_FORMAT_FORMATINTERNAL_H +#include "clang/Basic/LLVM.h" +#include "clang/Format/Format.h" +#include "clang/Tooling/Core/Replacement.h" +#include + namespace clang { namespace format { namespace internal { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] clang serialization unittests: fix some leaks (PR #82773)
https://github.com/d0k approved this pull request. https://github.com/llvm/llvm-project/pull/82773 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 242f98c - [Clang][SME] Skip writing output files to the source directory
Author: Benjamin Kramer Date: 2024-02-22T20:22:00+01:00 New Revision: 242f98c7ab7c100d76cac29b555db20205619b38 URL: https://github.com/llvm/llvm-project/commit/242f98c7ab7c100d76cac29b555db20205619b38 DIFF: https://github.com/llvm/llvm-project/commit/242f98c7ab7c100d76cac29b555db20205619b38.diff LOG: [Clang][SME] Skip writing output files to the source directory Added: Modified: clang/test/CodeGen/aarch64-sme-inline-streaming-attrs.c Removed: diff --git a/clang/test/CodeGen/aarch64-sme-inline-streaming-attrs.c b/clang/test/CodeGen/aarch64-sme-inline-streaming-attrs.c index 7eb74f28a1c85a..25aebeced9379c 100644 --- a/clang/test/CodeGen/aarch64-sme-inline-streaming-attrs.c +++ b/clang/test/CodeGen/aarch64-sme-inline-streaming-attrs.c @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -target-feature +sme -verify -DTEST_NONE %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -target-feature +sme -verify -DTEST_COMPATIBLE %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -target-feature +sme -verify -DTEST_STREAMING %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -target-feature +sme -verify -DTEST_LOCALLY %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -o /dev/null -target-feature +sme -verify -DTEST_NONE %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -o /dev/null -target-feature +sme -verify -DTEST_COMPATIBLE %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -o /dev/null -target-feature +sme -verify -DTEST_STREAMING %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -o /dev/null -target-feature +sme -verify -DTEST_LOCALLY %s #define __ai __attribute__((always_inline)) __ai void inlined_fn(void) {} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] [AArch64] Use parseArchExtension function. NFC (PR #78158)
https://github.com/d0k approved this pull request. https://github.com/llvm/llvm-project/pull/78158 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] [clang-tools-extra] [mlir] [emacs] Fix Emacs library formatting (PR #76110)
https://github.com/d0k closed https://github.com/llvm/llvm-project/pull/76110 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] [clang-tools-extra] [mlir] [emacs] Fix Emacs library formatting (PR #76110)
https://github.com/d0k approved this pull request. I don't know anything about Emacs, but if the version field is required I see no harm in adding it. https://github.com/llvm/llvm-project/pull/76110 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Tooling/Inclusion] Avoid narrowing conversions in macro expansion (PR #72664)
https://github.com/d0k approved this pull request. https://github.com/llvm/llvm-project/pull/72664 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 8dfac29 - [CodeGen] [riscv] Remove no-op ptr-to-ptr bitcasts (NFC)
Author: Benjamin Kramer Date: 2023-11-15T01:09:23+01:00 New Revision: 8dfac290a441de21a24faccca6110bc738ebf1b7 URL: https://github.com/llvm/llvm-project/commit/8dfac290a441de21a24faccca6110bc738ebf1b7 DIFF: https://github.com/llvm/llvm-project/commit/8dfac290a441de21a24faccca6110bc738ebf1b7.diff LOG: [CodeGen] [riscv] Remove no-op ptr-to-ptr bitcasts (NFC) Added: Modified: clang/lib/CodeGen/CodeGenFunction.cpp Removed: diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 0f2b9055b88eb04..64521ce7182eee6 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -2486,10 +2486,8 @@ llvm::Value *CodeGenFunction::EmitAnnotationCall(llvm::Function *AnnotationFn, const AnnotateAttr *Attr) { SmallVector Args = { AnnotatedVal, - Builder.CreateBitCast(CGM.EmitAnnotationString(AnnotationStr), -ConstGlobalsPtrTy), - Builder.CreateBitCast(CGM.EmitAnnotationUnit(Location), -ConstGlobalsPtrTy), + CGM.EmitAnnotationString(AnnotationStr), + CGM.EmitAnnotationUnit(Location), CGM.EmitAnnotationLineNo(Location), }; if (Attr) @@ -2499,15 +2497,10 @@ llvm::Value *CodeGenFunction::EmitAnnotationCall(llvm::Function *AnnotationFn, void CodeGenFunction::EmitVarAnnotations(const VarDecl *D, llvm::Value *V) { assert(D->hasAttr() && "no annotate attribute"); - // FIXME We create a new bitcast for every annotation because that's what - // llvm-gcc was doing. - unsigned AS = V->getType()->getPointerAddressSpace(); - llvm::Type *I8PtrTy = Builder.getPtrTy(AS); for (const auto *I : D->specific_attrs()) EmitAnnotationCall(CGM.getIntrinsic(llvm::Intrinsic::var_annotation, -{I8PtrTy, CGM.ConstGlobalsPtrTy}), - Builder.CreateBitCast(V, I8PtrTy, V->getName()), - I->getAnnotation(), D->getLocation(), I); +{V->getType(), CGM.ConstGlobalsPtrTy}), + V, I->getAnnotation(), D->getLocation(), I); } Address CodeGenFunction::EmitFieldAnnotations(const FieldDecl *D, ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] c66844d - [CodeGenOpenCL] Remove pointer type caching
Author: Benjamin Kramer Date: 2023-11-15T00:37:44+01:00 New Revision: c66844d629d8317ed9bbd7d4049d52d56597adcc URL: https://github.com/llvm/llvm-project/commit/c66844d629d8317ed9bbd7d4049d52d56597adcc DIFF: https://github.com/llvm/llvm-project/commit/c66844d629d8317ed9bbd7d4049d52d56597adcc.diff LOG: [CodeGenOpenCL] Remove pointer type caching This was important when typed LLVM pointers wanted a struct definition for every type, but that's no longer necessary with opaque pointers. NFCI. Added: Modified: clang/lib/CodeGen/CGOpenCLRuntime.cpp clang/lib/CodeGen/CGOpenCLRuntime.h Removed: diff --git a/clang/lib/CodeGen/CGOpenCLRuntime.cpp b/clang/lib/CodeGen/CGOpenCLRuntime.cpp index 33838a6552c8d70..115b618056a445e 100644 --- a/clang/lib/CodeGen/CGOpenCLRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenCLRuntime.cpp @@ -37,43 +37,16 @@ llvm::Type *CGOpenCLRuntime::convertOpenCLSpecificType(const Type *T) { if (llvm::Type *TransTy = CGM.getTargetCodeGenInfo().getOpenCLType(CGM, T)) return TransTy; - switch (cast(T)->getKind()) { - default: -llvm_unreachable("Unexpected opencl builtin type!"); -return nullptr; -#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ - case BuiltinType::Id: \ -return getPointerType(T, "opencl." #ImgType "_" #Suffix "_t"); -#include "clang/Basic/OpenCLImageTypes.def" - case BuiltinType::OCLSampler: + if (T->isSamplerT()) return getSamplerType(T); - case BuiltinType::OCLEvent: -return getPointerType(T, "opencl.event_t"); - case BuiltinType::OCLClkEvent: -return getPointerType(T, "opencl.clk_event_t"); - case BuiltinType::OCLQueue: -return getPointerType(T, "opencl.queue_t"); - case BuiltinType::OCLReserveID: -return getPointerType(T, "opencl.reserve_id_t"); -#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ - case BuiltinType::Id: \ -return getPointerType(T, "opencl." #ExtType); -#include "clang/Basic/OpenCLExtensionTypes.def" - } -} -llvm::PointerType *CGOpenCLRuntime::getPointerType(const Type *T, - StringRef Name) { - auto I = CachedTys.find(Name); - if (I != CachedTys.end()) -return I->second; + return getPointerType(T); +} - llvm::LLVMContext = CGM.getLLVMContext(); +llvm::PointerType *CGOpenCLRuntime::getPointerType(const Type *T) { uint32_t AddrSpc = CGM.getContext().getTargetAddressSpace( CGM.getContext().getOpenCLTypeAddrSpace(T)); - auto *PTy = llvm::PointerType::get(Ctx, AddrSpc); - CachedTys[Name] = PTy; - return PTy; + return llvm::PointerType::get(CGM.getLLVMContext(), AddrSpc); } llvm::Type *CGOpenCLRuntime::getPipeType(const PipeType *T) { @@ -89,9 +62,7 @@ llvm::Type *CGOpenCLRuntime::getPipeType(const PipeType *T) { llvm::Type *CGOpenCLRuntime::getPipeType(const PipeType *T, StringRef Name, llvm::Type *) { if (!PipeTy) -PipeTy = llvm::PointerType::get( -CGM.getLLVMContext(), CGM.getContext().getTargetAddressSpace( - CGM.getContext().getOpenCLTypeAddrSpace(T))); +PipeTy = getPointerType(T); return PipeTy; } @@ -103,10 +74,7 @@ llvm::Type *CGOpenCLRuntime::getSamplerType(const Type *T) { CGM, CGM.getContext().OCLSamplerTy.getTypePtr())) SamplerTy = TransTy; else -// struct opencl.sampler_t* -SamplerTy = llvm::PointerType::get( -CGM.getLLVMContext(), CGM.getContext().getTargetAddressSpace( - CGM.getContext().getOpenCLTypeAddrSpace(T))); +SamplerTy = getPointerType(T); return SamplerTy; } diff --git a/clang/lib/CodeGen/CGOpenCLRuntime.h b/clang/lib/CodeGen/CGOpenCLRuntime.h index df8084d6008be94..34613c3516f3745 100644 --- a/clang/lib/CodeGen/CGOpenCLRuntime.h +++ b/clang/lib/CodeGen/CGOpenCLRuntime.h @@ -39,7 +39,6 @@ class CGOpenCLRuntime { llvm::Type *PipeROTy; llvm::Type *PipeWOTy; llvm::Type *SamplerTy; - llvm::StringMap CachedTys; /// Structure for enqueued block information. struct EnqueuedBlockInfo { @@ -53,7 +52,7 @@ class CGOpenCLRuntime { virtual llvm::Type *getPipeType(const PipeType *T, StringRef Name, llvm::Type *); - llvm::PointerType *getPointerType(const Type *T, StringRef Name); + llvm::PointerType *getPointerType(const Type *T); public: CGOpenCLRuntime(CodeGenModule ) : CGM(CGM), ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fffbea3 - [riscv] Remove no-op ptr-to-ptr bitcasts (NFC)
Author: Benjamin Kramer Date: 2023-11-14T19:04:40+01:00 New Revision: fffbea33d76950156d4a7a5eec44751da0b06562 URL: https://github.com/llvm/llvm-project/commit/fffbea33d76950156d4a7a5eec44751da0b06562 DIFF: https://github.com/llvm/llvm-project/commit/fffbea33d76950156d4a7a5eec44751da0b06562.diff LOG: [riscv] Remove no-op ptr-to-ptr bitcasts (NFC) Added: Modified: clang/include/clang/Basic/riscv_vector.td Removed: diff --git a/clang/include/clang/Basic/riscv_vector.td b/clang/include/clang/Basic/riscv_vector.td index 1d24b4e75f9dd5f..682f1d5c8af68c0 100644 --- a/clang/include/clang/Basic/riscv_vector.td +++ b/clang/include/clang/Basic/riscv_vector.td @@ -69,7 +69,6 @@ multiclass RVVVLEFFBuiltin types> { Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType)); IntrinsicTypes = {ResultType, Ops[3]->getType()}; } -Ops[1] = Builder.CreateBitCast(Ops[1], ResultType->getPointerTo()); Value *NewVL = Ops[2]; Ops.erase(Ops.begin() + 2); llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes); @@ -150,7 +149,6 @@ let HasMaskedOffOperand = false, // Builtin: (ptr, value, vl). Intrinsic: (value, ptr, vl) std::swap(Ops[0], Ops[1]); } - Ops[1] = Builder.CreateBitCast(Ops[1], Ops[0]->getType()->getPointerTo()); if (IsMasked) IntrinsicTypes = {Ops[0]->getType(), Ops[3]->getType()}; else @@ -189,7 +187,6 @@ multiclass RVVVSSEBuiltin types> { // Builtin: (ptr, stride, value, vl). Intrinsic: (value, ptr, stride, vl) std::rotate(Ops.begin(), Ops.begin() + 2, Ops.begin() + 3); } -Ops[1] = Builder.CreateBitCast(Ops[1], Ops[0]->getType()->getPointerTo()); if (IsMasked) IntrinsicTypes = {Ops[0]->getType(), Ops[4]->getType()}; else @@ -215,7 +212,6 @@ multiclass RVVIndexedStore { // Builtin: (ptr, index, value, vl). Intrinsic: (value, ptr, index, vl) std::rotate(Ops.begin(), Ops.begin() + 2, Ops.begin() + 3); } -Ops[1] = Builder.CreateBitCast(Ops[1], Ops[0]->getType()->getPointerTo()); if (IsMasked) IntrinsicTypes = {Ops[0]->getType(), Ops[2]->getType(), Ops[4]->getType()}; else ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 24f068b - [Tooling/Inclusion] Fix MSVC build
Author: Benjamin Kramer Date: 2023-10-24T13:32:21+02:00 New Revision: 24f068b0f77e5de1980b71f036f6b83c4d506904 URL: https://github.com/llvm/llvm-project/commit/24f068b0f77e5de1980b71f036f6b83c4d506904 DIFF: https://github.com/llvm/llvm-project/commit/24f068b0f77e5de1980b71f036f6b83c4d506904.diff LOG: [Tooling/Inclusion] Fix MSVC build Added: Modified: clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp Removed: diff --git a/clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp b/clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp index e409b8481e5fc9c..03f61d33e1f26e7 100644 --- a/clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp +++ b/clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp @@ -58,13 +58,14 @@ static int countSymbols(Lang Language) { ArrayRef Symbols; #define SYMBOL(Name, NS, Header) #NS #Name, switch (Language) { - case Lang::C: + case Lang::C: { static constexpr const char *CSymbols[] = { #include "CSymbolMap.inc" }; Symbols = CSymbols; break; - case Lang::CXX: + } + case Lang::CXX: { static constexpr const char *CXXSymbols[] = { #include "StdSpecialSymbolMap.inc" #include "StdSymbolMap.inc" @@ -73,6 +74,7 @@ static int countSymbols(Lang Language) { Symbols = CXXSymbols; break; } + } #undef SYMBOL return llvm::DenseSet(Symbols.begin(), Symbols.end()).size(); } @@ -141,14 +143,15 @@ static int initialize(Lang Language) { }; #define SYMBOL(Name, NS, Header) {#NS #Name, StringRef(#NS).size(), #Header}, switch (Language) { - case Lang::C: + case Lang::C: { static constexpr Symbol CSymbols[] = { #include "CSymbolMap.inc" }; for (const Symbol : CSymbols) Add(S.QName, S.NSLen, S.HeaderName); break; - case Lang::CXX: + } + case Lang::CXX: { static constexpr Symbol CXXSymbols[] = { #include "StdSpecialSymbolMap.inc" #include "StdSymbolMap.inc" @@ -158,6 +161,7 @@ static int initialize(Lang Language) { Add(S.QName, S.NSLen, S.HeaderName); break; } + } #undef SYMBOL Mapping->HeaderNames = new llvm::StringRef[Mapping->HeaderIDs->size()]; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 4674e30 - [Tooling/Inclusion] Refactor to use tables for compile time
Author: Benjamin Kramer Date: 2023-10-24T13:15:02+02:00 New Revision: 4674e303d2603f5d3c8faba2de676ed6ad0299a0 URL: https://github.com/llvm/llvm-project/commit/4674e303d2603f5d3c8faba2de676ed6ad0299a0 DIFF: https://github.com/llvm/llvm-project/commit/4674e303d2603f5d3c8faba2de676ed6ad0299a0.diff LOG: [Tooling/Inclusion] Refactor to use tables for compile time The macro expansion takes 13s and generates an 1.5M obj file, table uses 2s and 680k .o file. Sanitizers take multiple minutes to compile the old version, while having negligible overhead on the new version. No change in functionality. Added: Modified: clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp Removed: diff --git a/clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp b/clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp index 664f3b76f661281..e409b8481e5fc9c 100644 --- a/clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp +++ b/clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp @@ -55,20 +55,26 @@ static const SymbolHeaderMapping *getMappingPerLang(Lang L) { } static int countSymbols(Lang Language) { - llvm::DenseSet Set; -#define SYMBOL(Name, NS, Header) Set.insert(#NS #Name); + ArrayRef Symbols; +#define SYMBOL(Name, NS, Header) #NS #Name, switch (Language) { case Lang::C: +static constexpr const char *CSymbols[] = { #include "CSymbolMap.inc" +}; +Symbols = CSymbols; break; case Lang::CXX: +static constexpr const char *CXXSymbols[] = { #include "StdSpecialSymbolMap.inc" #include "StdSymbolMap.inc" #include "StdTsSymbolMap.inc" +}; +Symbols = CXXSymbols; break; } #undef SYMBOL - return Set.size(); + return llvm::DenseSet(Symbols.begin(), Symbols.end()).size(); } static int initialize(Lang Language) { @@ -127,15 +133,29 @@ static int initialize(Lang Language) { NSSymbolMap = AddNS(QName.take_front(NSLen)); NSSymbols.try_emplace(QName.drop_front(NSLen), SymIndex); }; -#define SYMBOL(Name, NS, Header) Add(#NS #Name, strlen(#NS), #Header); + + struct Symbol { +const char *QName; +unsigned NSLen; +const char *HeaderName; + }; +#define SYMBOL(Name, NS, Header) {#NS #Name, StringRef(#NS).size(), #Header}, switch (Language) { case Lang::C: +static constexpr Symbol CSymbols[] = { #include "CSymbolMap.inc" +}; +for (const Symbol : CSymbols) + Add(S.QName, S.NSLen, S.HeaderName); break; case Lang::CXX: +static constexpr Symbol CXXSymbols[] = { #include "StdSpecialSymbolMap.inc" #include "StdSymbolMap.inc" #include "StdTsSymbolMap.inc" +}; +for (const Symbol : CXXSymbols) + Add(S.QName, S.NSLen, S.HeaderName); break; } #undef SYMBOL ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [NVPTX] Improve lowering of v4i8 (PR #67866)
https://github.com/d0k approved this pull request. https://github.com/llvm/llvm-project/pull/67866 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NVPTX] Improve lowering of v4i8 (PR #67866)
https://github.com/d0k approved this pull request. https://github.com/llvm/llvm-project/pull/67866 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 7af24c7 - Disable writing an output file to the source directory in Driver test
Author: Benjamin Kramer Date: 2023-09-15T13:19:13+02:00 New Revision: 7af24c765d0255e6fa4a9f564e0d3699e0cfa107 URL: https://github.com/llvm/llvm-project/commit/7af24c765d0255e6fa4a9f564e0d3699e0cfa107 DIFF: https://github.com/llvm/llvm-project/commit/7af24c765d0255e6fa4a9f564e0d3699e0cfa107.diff LOG: Disable writing an output file to the source directory in Driver test Added: Modified: clang/test/Driver/omit-rtti-component-without-no-rtti.cpp Removed: diff --git a/clang/test/Driver/omit-rtti-component-without-no-rtti.cpp b/clang/test/Driver/omit-rtti-component-without-no-rtti.cpp index 2108c7dea7f3386..87e5bba08368ad7 100644 --- a/clang/test/Driver/omit-rtti-component-without-no-rtti.cpp +++ b/clang/test/Driver/omit-rtti-component-without-no-rtti.cpp @@ -1,12 +1,12 @@ /// Ensure that -fexperimental-omit-vtable-rtti is only allowed if rtti is /// disabled. -// RUN: not %clang -c -Xclang -fexperimental-omit-vtable-rtti -frtti %s 2>&1 | FileCheck -check-prefix=ERROR %s -// RUN: not %clang -c -Xclang -fexperimental-omit-vtable-rtti -fno-rtti -frtti %s 2>&1 | FileCheck -check-prefix=ERROR %s +// RUN: not %clang -fsyntax-only -Xclang -fexperimental-omit-vtable-rtti -frtti %s 2>&1 | FileCheck -check-prefix=ERROR %s +// RUN: not %clang -fsyntax-only -Xclang -fexperimental-omit-vtable-rtti -fno-rtti -frtti %s 2>&1 | FileCheck -check-prefix=ERROR %s -// RUN: %clang -c -Xclang -fexperimental-omit-vtable-rtti -fno-rtti %s 2>&1 | FileCheck -check-prefix=NO-ERROR %s --allow-empty -// RUN: %clang -c -Xclang -fno-experimental-omit-vtable-rtti -frtti %s 2>&1 | FileCheck -check-prefix=NO-ERROR %s --allow-empty -// RUN: %clang -c -Xclang -fexperimental-omit-vtable-rtti -Xclang -fno-experimental-omit-vtable-rtti -frtti %s 2>&1 | FileCheck -check-prefix=NO-ERROR %s --allow-empty +// RUN: %clang -fsyntax-only -Xclang -fexperimental-omit-vtable-rtti -fno-rtti %s 2>&1 | FileCheck -check-prefix=NO-ERROR %s --allow-empty +// RUN: %clang -fsyntax-only -Xclang -fno-experimental-omit-vtable-rtti -frtti %s 2>&1 | FileCheck -check-prefix=NO-ERROR %s --allow-empty +// RUN: %clang -fsyntax-only -Xclang -fexperimental-omit-vtable-rtti -Xclang -fno-experimental-omit-vtable-rtti -frtti %s 2>&1 | FileCheck -check-prefix=NO-ERROR %s --allow-empty // ERROR: -fexperimental-omit-vtable-rtti call only be used with -fno-rtti // NO-ERROR-NOT: -fexperimental-omit-vtable-rtti call only be used with -fno-rtti ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 263fc4c - Turn off memory leaks in unit test
Author: Benjamin Kramer Date: 2023-09-14T13:16:22+02:00 New Revision: 263fc4c79a2b41a57dd1bf3a17873002c5d69265 URL: https://github.com/llvm/llvm-project/commit/263fc4c79a2b41a57dd1bf3a17873002c5d69265 DIFF: https://github.com/llvm/llvm-project/commit/263fc4c79a2b41a57dd1bf3a17873002c5d69265.diff LOG: Turn off memory leaks in unit test Added: Modified: clang/unittests/Serialization/ForceCheckFileInputTest.cpp Removed: diff --git a/clang/unittests/Serialization/ForceCheckFileInputTest.cpp b/clang/unittests/Serialization/ForceCheckFileInputTest.cpp index c1f6d40767751e4..ed0daa43436eb6d 100644 --- a/clang/unittests/Serialization/ForceCheckFileInputTest.cpp +++ b/clang/unittests/Serialization/ForceCheckFileInputTest.cpp @@ -75,6 +75,7 @@ export int aa = 43; std::shared_ptr Invocation = createInvocation(Args, CIOpts); EXPECT_TRUE(Invocation); +Invocation->getFrontendOpts().DisableFree = false; auto Buf = CIOpts.VFS->getBufferForFile("a.cppm"); EXPECT_TRUE(Buf); @@ -113,6 +114,7 @@ export int aa = 43; std::shared_ptr Invocation = createInvocation(Args, CIOpts); EXPECT_TRUE(Invocation); +Invocation->getFrontendOpts().DisableFree = false; CompilerInstance Clang; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 88b7e06 - Revert "[clang][CodeGen] Emit annotations for function declarations."
Author: Benjamin Kramer Date: 2023-09-13T13:22:57+02:00 New Revision: 88b7e06dcf9723d0869b0c6bee030b4140e4366d URL: https://github.com/llvm/llvm-project/commit/88b7e06dcf9723d0869b0c6bee030b4140e4366d DIFF: https://github.com/llvm/llvm-project/commit/88b7e06dcf9723d0869b0c6bee030b4140e4366d.diff LOG: Revert "[clang][CodeGen] Emit annotations for function declarations." This reverts commit c6a33ff49dfb3498dae15c718820ea3d9c19f3cb. Makes clang segfault. // clang t.cc class a; class c { public: [[clang::annotate("")]] c(const c *) {} }; class d { d(const c *, a *, a *); c e; }; d::d(const c *f, a *, a *) : e(f) {} Added: Modified: clang/lib/CodeGen/CodeGenModule.cpp clang/lib/CodeGen/CodeGenModule.h clang/test/CodeGen/annotations-global.c clang/test/CodeGenCXX/attr-annotate.cpp Removed: clang/test/CodeGen/annotations-decl-use-decl.c clang/test/CodeGen/annotations-decl-use-define.c clang/test/CodeGen/annotations-declaration.c clang/test/CodeGenCXX/attr-annotate-destructor.cpp diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 0ee9c4a9e0be4c9..8b0c9340775cbe9 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -697,7 +697,6 @@ void CodeGenModule::checkAliases() { void CodeGenModule::clear() { DeferredDeclsToEmit.clear(); EmittedDeferredDecls.clear(); - DeferredAnnotations.clear(); if (OpenMPRuntime) OpenMPRuntime->clear(); } @@ -3094,10 +3093,6 @@ void CodeGenModule::EmitVTablesOpportunistically() { } void CodeGenModule::EmitGlobalAnnotations() { - for (const auto& [MangledName, VD] : DeferredAnnotations) -AddGlobalAnnotations(VD, GetGlobalValue(MangledName)); - DeferredAnnotations.clear(); - if (Annotations.empty()) return; @@ -3602,14 +3597,6 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) { // Ignore declarations, they will be emitted on their first use. if (const auto *FD = dyn_cast(Global)) { -// Update deferred annotations with the latest declaration if the function -// function was already used or defined. -if (FD->hasAttr()) { - StringRef MangledName = getMangledName(GD); - if (GetGlobalValue(MangledName)) -DeferredAnnotations[MangledName] = FD; -} - // Forward declarations are emitted lazily on first use. if (!FD->doesThisDeclarationHaveABody()) { if (!FD->doesDeclarationForceExternallyVisibleDefinition()) @@ -4383,11 +4370,6 @@ llvm::Constant *CodeGenModule::GetOrCreateLLVMFunction( llvm::Function::Create(FTy, llvm::Function::ExternalLinkage, Entry ? StringRef() : MangledName, ()); - // Store the declaration associated with this function so it is potentially - // updated by further declarations or definitions and emitted at the end. - if (D && D->hasAttr()) -DeferredAnnotations[MangledName] = cast(D); - // If we already created a function with the same mangled name (but diff erent // type) before, take its name and add it to the list of functions to be // replaced with F at the end of CodeGen. @@ -5682,6 +5664,8 @@ void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD, AddGlobalCtor(Fn, CA->getPriority()); if (const DestructorAttr *DA = D->getAttr()) AddGlobalDtor(Fn, DA->getPriority(), true); + if (D->hasAttr()) +AddGlobalAnnotations(D, Fn); if (getLangOpts().OpenMP && D->hasAttr()) getOpenMPRuntime().emitDeclareTargetFunction(D, GV); } diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 8b0d68afbd0ecd2..073b471c6e3cc11 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -431,10 +431,6 @@ class CodeGenModule : public CodeGenTypeCache { /// Global annotations. std::vector Annotations; - // Store deferred function annotations so they can be emitted at the end with - // most up to date ValueDecl that will have all the inherited annotations. - llvm::DenseMap DeferredAnnotations; - /// Map used to get unique annotation strings. llvm::StringMap AnnotationStrings; diff --git a/clang/test/CodeGen/annotations-decl-use-decl.c b/clang/test/CodeGen/annotations-decl-use-decl.c deleted file mode 100644 index f43ba91a34d876f..000 --- a/clang/test/CodeGen/annotations-decl-use-decl.c +++ /dev/null @@ -1,16 +0,0 @@ -// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s - -// Test annotation attributes are still emitted when the function is used before -// it is defined with annotations. - -void foo(void); -void *xxx = (void*)foo; -void __attribute__((annotate("bar"))) foo(); - -// CHECK: target triple -// CHECK-DAG: private unnamed_addr constant [4 x i8] c"bar\00", section "llvm.metadata" - -// CHECK: @llvm.global.annotations = appending global [1 x { ptr, ptr, ptr, i32, ptr }] [{ -// CHECK-SAME:
[clang] c1796be - Don't rely in llvm::Bitset CTAD. NFC.
Author: Benjamin Kramer Date: 2023-09-12T17:04:03+02:00 New Revision: c1796be93fe5e7a5fd672def6f36d6d5062ee559 URL: https://github.com/llvm/llvm-project/commit/c1796be93fe5e7a5fd672def6f36d6d5062ee559 DIFF: https://github.com/llvm/llvm-project/commit/c1796be93fe5e7a5fd672def6f36d6d5062ee559.diff LOG: Don't rely in llvm::Bitset CTAD. NFC. This triggers a lot of -Wctad-maybe-unsupported Added: Modified: clang/lib/Basic/Targets/AArch64.cpp clang/lib/Driver/ToolChains/Arch/AArch64.cpp llvm/include/llvm/TargetParser/AArch64TargetParser.h llvm/unittests/TargetParser/TargetParserTest.cpp Removed: diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp index cccdf0e3861d0da..fe5a7af97b7753c 100644 --- a/clang/lib/Basic/Targets/AArch64.cpp +++ b/clang/lib/Basic/Targets/AArch64.cpp @@ -979,7 +979,7 @@ bool AArch64TargetInfo::initFeatureMap( // Parse the CPU and add any implied features. std::optional CpuInfo = llvm::AArch64::parseCpu(CPU); if (CpuInfo) { -llvm::Bitset Exts = CpuInfo->getImpliedExtensions(); +auto Exts = CpuInfo->getImpliedExtensions(); std::vector CPUFeats; llvm::AArch64::getExtensionFeatures(Exts, CPUFeats); for (auto F : CPUFeats) { diff --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp index 19d454dd8bf3643..276984f96d57a51 100644 --- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp +++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp @@ -158,7 +158,7 @@ static bool DecodeAArch64Mcpu(const Driver , StringRef Mcpu, StringRef , Features.push_back(ArchInfo->ArchFeature); -llvm::Bitset Extension = CpuInfo->getImpliedExtensions(); +auto Extension = CpuInfo->getImpliedExtensions(); if (!llvm::AArch64::getExtensionFeatures(Extension, Features)) return false; } diff --git a/llvm/include/llvm/TargetParser/AArch64TargetParser.h b/llvm/include/llvm/TargetParser/AArch64TargetParser.h index 44987da8276a371..190f482044083c0 100644 --- a/llvm/include/llvm/TargetParser/AArch64TargetParser.h +++ b/llvm/include/llvm/TargetParser/AArch64TargetParser.h @@ -347,7 +347,7 @@ inline constexpr ArchInfo ARMV9_3A = { VersionTuple{9, 3}, AProfile, "armv9.3-a inline constexpr ArchInfo ARMV9_4A = { VersionTuple{9, 4}, AProfile, "armv9.4-a", "+v9.4a", (ARMV9_3A.DefaultExts | AArch64::ExtensionBitset({AArch64::AEK_SPECRES2, AArch64::AEK_CSSC, AArch64::AEK_RASv2}))}; // For v8-R, we do not enable crypto and align with GCC that enables a more minimal set of optional architecture extensions. -inline constexpr ArchInfo ARMV8R= { VersionTuple{8, 0}, RProfile, "armv8-r", "+v8r", (Bitset(ARMV8_5A.DefaultExts) | +inline constexpr ArchInfo ARMV8R= { VersionTuple{8, 0}, RProfile, "armv8-r", "+v8r", (ARMV8_5A.DefaultExts | AArch64::ExtensionBitset({AArch64::AEK_SSBS, AArch64::AEK_FP16, AArch64::AEK_FP16FML, AArch64::AEK_SB}).flip(AArch64::AEK_LSE))}; // clang-format on diff --git a/llvm/unittests/TargetParser/TargetParserTest.cpp b/llvm/unittests/TargetParser/TargetParserTest.cpp index 0c114d1b85a6935..d551eb985d37380 100644 --- a/llvm/unittests/TargetParser/TargetParserTest.cpp +++ b/llvm/unittests/TargetParser/TargetParserTest.cpp @@ -216,7 +216,7 @@ INSTANTIATE_TEST_SUITE_P( ARMCPUTestParams("arm1020t", "armv5t", "none", ARM::AEK_NONE, "5T"), ARMCPUTestParams("arm9e", "armv5te", "none", ARM::AEK_NONE | ARM::AEK_DSP, "5TE"), -ARMCPUTestParams("arm946e-s", "armv5te", "none", +ARMCPUTestParams("arm946e-s", "armv5te", "none", ARM::AEK_NONE | ARM::AEK_DSP, "5TE"), ARMCPUTestParams("arm966e-s", "armv5te", "none", ARM::AEK_NONE | ARM::AEK_DSP, "5TE"), @@ -1015,7 +1015,7 @@ class AArch64CPUTestFixture ARMCPUTestParams> {}; TEST_P(AArch64CPUTestFixture, testAArch64CPU) { - ARMCPUTestParams params = GetParam(); + auto params = GetParam(); const std::optional Cpu = AArch64::parseCpu(params.CPUName); EXPECT_TRUE(Cpu); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] e68ffa3 - [Driver] Make test work on targets that have no OpenMP library configured
Author: Benjamin Kramer Date: 2023-08-03T09:59:49+02:00 New Revision: e68ffa373f7f3e61de4e030d126f9968679cdfdc URL: https://github.com/llvm/llvm-project/commit/e68ffa373f7f3e61de4e030d126f9968679cdfdc DIFF: https://github.com/llvm/llvm-project/commit/e68ffa373f7f3e61de4e030d126f9968679cdfdc.diff LOG: [Driver] Make test work on targets that have no OpenMP library configured Added: Modified: clang/test/Driver/openmp-offload-infer.c Removed: diff --git a/clang/test/Driver/openmp-offload-infer.c b/clang/test/Driver/openmp-offload-infer.c index d7c37716cd3029..9a949f52e2e97d 100644 --- a/clang/test/Driver/openmp-offload-infer.c +++ b/clang/test/Driver/openmp-offload-infer.c @@ -39,7 +39,7 @@ // CHECK-ARCH-BINDINGS: "x86_64-unknown-linux-gnu" - "clang", inputs: ["[[HOST_BC]]", "[[BINARY]]"], output: "[[HOST_OBJ:.*]]" // CHECK-ARCH-BINDINGS: "x86_64-unknown-linux-gnu" - "Offload::Linker", inputs: ["[[HOST_OBJ]]"], output: "a.out" -// RUN: not %clang -### --target=x86_64-unknown-linux-gnu -ccc-print-bindings -fopenmp \ +// RUN: not %clang -### --target=x86_64-unknown-linux-gnu -ccc-print-bindings -fopenmp=libomp \ // RUN: --offload-arch=sm_70 --offload-arch=gfx908 --offload-arch=skylake \ // RUN: -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-FAILED ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] d526e2e - Add -no-canonical-prefixes to test that matches the binary name
Author: Benjamin Kramer Date: 2023-05-10T13:17:35+02:00 New Revision: d526e2ec957fc7bc31d7be3670cd1673c2b4389b URL: https://github.com/llvm/llvm-project/commit/d526e2ec957fc7bc31d7be3670cd1673c2b4389b DIFF: https://github.com/llvm/llvm-project/commit/d526e2ec957fc7bc31d7be3670cd1673c2b4389b.diff LOG: Add -no-canonical-prefixes to test that matches the binary name Added: Modified: clang/test/Driver/ftime-trace.cpp Removed: diff --git a/clang/test/Driver/ftime-trace.cpp b/clang/test/Driver/ftime-trace.cpp index 42a969059101..16c7ad53c69e 100644 --- a/clang/test/Driver/ftime-trace.cpp +++ b/clang/test/Driver/ftime-trace.cpp @@ -1,18 +1,18 @@ // RUN: rm -rf %t && mkdir -p %t && cd %t -// RUN: %clangxx -S -ftime-trace -ftime-trace-granularity=0 -o out %s +// RUN: %clangxx -S -no-canonical-prefixes -ftime-trace -ftime-trace-granularity=0 -o out %s // RUN: cat out.json \ // RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \ // RUN: | FileCheck %s -// RUN: %clangxx -S -ftime-trace=new-name.json -ftime-trace-granularity=0 -o out %s +// RUN: %clangxx -S -no-canonical-prefixes -ftime-trace=new-name.json -ftime-trace-granularity=0 -o out %s // RUN: cat new-name.json \ // RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \ // RUN: | FileCheck %s // RUN: mkdir dir1 dir2 -// RUN: %clangxx -S -ftime-trace=dir1 -ftime-trace-granularity=0 -o out %s +// RUN: %clangxx -S -no-canonical-prefixes -ftime-trace=dir1 -ftime-trace-granularity=0 -o out %s // RUN: cat dir1/out.json \ // RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \ // RUN: | FileCheck %s -// RUN: %clangxx -S -ftime-trace=dir2/ -ftime-trace-granularity=0 -o out %s +// RUN: %clangxx -S -no-canonical-prefixes -ftime-trace=dir2/ -ftime-trace-granularity=0 -o out %s // RUN: cat dir2/out.json \ // RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \ // RUN: | FileCheck %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 8c7c1f1 - Silence unused variable warning in NDEBUG builds
Author: Benjamin Kramer Date: 2023-03-23T14:41:03+01:00 New Revision: 8c7c1f11ffaacf762e612c65440fd2cbb58ee426 URL: https://github.com/llvm/llvm-project/commit/8c7c1f11ffaacf762e612c65440fd2cbb58ee426 DIFF: https://github.com/llvm/llvm-project/commit/8c7c1f11ffaacf762e612c65440fd2cbb58ee426.diff LOG: Silence unused variable warning in NDEBUG builds I usually would fold this into the assert, but the comment there suggests side effects. NFC. ModuleMap.cpp:938:9: error: unused variable 'MainFile' [-Werror,-Wunused-variable] auto *MainFile = SourceMgr.getFileEntryForID(SourceMgr.getMainFileID()); Added: Modified: clang/lib/Lex/ModuleMap.cpp Removed: diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index f2b2d0b8c69f1..44c872336ce9c 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -936,6 +936,7 @@ Module *ModuleMap::createModuleForImplementationUnit(SourceLocation Loc, // Mark the main source file as being within the newly-created module so that // declarations and macros are properly visibility-restricted to it. auto *MainFile = SourceMgr.getFileEntryForID(SourceMgr.getMainFileID()); + (void)MainFile; assert(MainFile && "no input file for module implementation"); return Result; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 7ac658a - [WebAssembly] assert(false) -> llvm_unreachable
Author: Benjamin Kramer Date: 2023-02-18T09:38:18+01:00 New Revision: 7ac658a07b9a2937f1a9319a47a9cec6afae2370 URL: https://github.com/llvm/llvm-project/commit/7ac658a07b9a2937f1a9319a47a9cec6afae2370 DIFF: https://github.com/llvm/llvm-project/commit/7ac658a07b9a2937f1a9319a47a9cec6afae2370.diff LOG: [WebAssembly] assert(false) -> llvm_unreachable Avoids warnings in -asserts builds. ASTContext.cpp:4098:1: error: non-void function does not return a value in all control paths [-Werror,-Wreturn-type] } ^ Added: Modified: clang/lib/AST/ASTContext.cpp Removed: diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index a22c21779e1c..9b0d7b2b4b5a 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -4093,8 +4093,8 @@ QualType ASTContext::getWebAssemblyExternrefType() const { return SingletonId; #include "clang/Basic/WebAssemblyReferenceTypes.def" } - assert(false && - "shouldn't try to generate type externref outside WebAssembly target"); + llvm_unreachable( + "shouldn't try to generate type externref outside WebAssembly target"); } /// getScalableVectorType - Return the unique reference to a scalable vector ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 1f818f6 - [clang-format] assert(false) -> llvm_unreachable
Author: Benjamin Kramer Date: 2023-02-15T14:10:09+01:00 New Revision: 1f818f63b829f3038a9fd605bf90348ba58cd981 URL: https://github.com/llvm/llvm-project/commit/1f818f63b829f3038a9fd605bf90348ba58cd981 DIFF: https://github.com/llvm/llvm-project/commit/1f818f63b829f3038a9fd605bf90348ba58cd981.diff LOG: [clang-format] assert(false) -> llvm_unreachable Avoids warnings in -asserts builds. FormatTokenSource.h:240:3: error: non-void function does not return a value [-Werror,-Wreturn-type] } ^ Added: Modified: clang/lib/Format/FormatTokenSource.h Removed: diff --git a/clang/lib/Format/FormatTokenSource.h b/clang/lib/Format/FormatTokenSource.h index 8bf7e6932c89..0be46287f6b7 100644 --- a/clang/lib/Format/FormatTokenSource.h +++ b/clang/lib/Format/FormatTokenSource.h @@ -236,7 +236,7 @@ class ScopedMacroState : public FormatTokenSource { } FormatToken *insertTokens(ArrayRef Tokens) override { -assert(false && "Cannot insert tokens while parsing a macro."); +llvm_unreachable("Cannot insert tokens while parsing a macro."); } private: ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] d8982f7 - [AST] assert(false) -> llvm_unreachable
Author: Benjamin Kramer Date: 2023-01-31T18:57:01+01:00 New Revision: d8982f72282bb88da6a3793f9d55fccd5621c825 URL: https://github.com/llvm/llvm-project/commit/d8982f72282bb88da6a3793f9d55fccd5621c825 DIFF: https://github.com/llvm/llvm-project/commit/d8982f72282bb88da6a3793f9d55fccd5621c825.diff LOG: [AST] assert(false) -> llvm_unreachable Has the advantage of not triggering missing return warnings even in NDEBUG builds. Added: Modified: clang/lib/AST/ASTContext.cpp Removed: diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 438c224f0a2c..a6dfbd48d0d4 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -4093,7 +4093,8 @@ QualType ASTContext::getWebAssemblyExternrefType() const { return SingletonId; #include "clang/Basic/WebAssemblyReferenceTypes.def" } - assert(false && "shouldn't try to generate type externref outside WebAssembly target"); + llvm_unreachable( + "shouldn't try to generate type externref outside WebAssembly target"); } /// getScalableVectorType - Return the unique reference to a scalable vector ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 931d04b - [ADT] Make StringRef::compare like std::string_view::compare
Author: Benjamin Kramer Date: 2023-01-15T20:59:21+01:00 New Revision: 931d04be2fc8f3f0505b43e64297f75d526cb42a URL: https://github.com/llvm/llvm-project/commit/931d04be2fc8f3f0505b43e64297f75d526cb42a DIFF: https://github.com/llvm/llvm-project/commit/931d04be2fc8f3f0505b43e64297f75d526cb42a.diff LOG: [ADT] Make StringRef::compare like std::string_view::compare string_view has a slightly weaker contract, which only specifies whether the value is bigger or smaller than 0. Adapt users accordingly and just forward to the standard function (that also compiles down to memcmp) Added: Modified: clang/lib/AST/DeclarationName.cpp clang/lib/Analysis/PathDiagnostic.cpp clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp lld/COFF/Writer.cpp llvm/include/llvm/ADT/SmallString.h llvm/include/llvm/ADT/StringRef.h llvm/include/llvm/ProfileData/SampleProf.h llvm/lib/Transforms/IPO/MergeFunctions.cpp llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp llvm/unittests/ADT/SmallStringTest.cpp llvm/unittests/ADT/StringRefTest.cpp Removed: diff --git a/clang/lib/AST/DeclarationName.cpp b/clang/lib/AST/DeclarationName.cpp index b2232ddfced32..c1219041a466b 100644 --- a/clang/lib/AST/DeclarationName.cpp +++ b/clang/lib/AST/DeclarationName.cpp @@ -72,15 +72,9 @@ int DeclarationName::compare(DeclarationName LHS, DeclarationName RHS) { } unsigned LN = LHSSelector.getNumArgs(), RN = RHSSelector.getNumArgs(); for (unsigned I = 0, N = std::min(LN, RN); I != N; ++I) { - switch (LHSSelector.getNameForSlot(I).compare( - RHSSelector.getNameForSlot(I))) { - case -1: -return -1; - case 1: -return 1; - default: -break; - } + if (int Compare = LHSSelector.getNameForSlot(I).compare( + RHSSelector.getNameForSlot(I))) +return Compare; } return compareInt(LN, RN); diff --git a/clang/lib/Analysis/PathDiagnostic.cpp b/clang/lib/Analysis/PathDiagnostic.cpp index 9e1215fe3d01d..ac1306fd80711 100644 --- a/clang/lib/Analysis/PathDiagnostic.cpp +++ b/clang/lib/Analysis/PathDiagnostic.cpp @@ -342,7 +342,7 @@ static bool compareCrossTUSourceLocs(FullSourceLoc XL, FullSourceLoc YL) { return XFE && !YFE; int NameCmp = XFE->getName().compare(YFE->getName()); if (NameCmp != 0) -return NameCmp == -1; +return NameCmp < 0; // Last resort: Compare raw file IDs that are possibly expansions. return XL.getFileID() < YL.getFileID(); } diff --git a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp index b38d18d3691d9..12b948a65261f 100644 --- a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp @@ -2146,7 +2146,7 @@ void CStringChecker::evalStrcmpCommon(CheckerContext , const CallExpr *CE, DefinedSVal zeroVal = svalBuilder.makeIntVal(0, CE->getType()); // Constrain strcmp's result range based on the result of StringRef's // comparison methods. -BinaryOperatorKind op = (compareRes == 1) ? BO_GT : BO_LT; +BinaryOperatorKind op = (compareRes > 0) ? BO_GT : BO_LT; SVal compareWithZero = svalBuilder.evalBinOp(state, op, resultVal, zeroVal, svalBuilder.getConditionType()); diff --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp index 1fb4c83052c4a..1daa58f20fd5b 100644 --- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp +++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp @@ -1272,8 +1272,8 @@ linkAndWrapDeviceFiles(SmallVectorImpl , // We sort the entries before bundling so they appear in a deterministic // order in the final binary. llvm::sort(Input, [](OffloadingImage , OffloadingImage ) { - return A.StringData["triple"].compare(B.StringData["triple"]) == 1 || - A.StringData["arch"].compare(B.StringData["arch"]) == 1 || + return A.StringData["triple"] > B.StringData["triple"] || + A.StringData["arch"] > B.StringData["arch"] || A.TheOffloadKind < B.TheOffloadKind; }); auto BundledImagesOrErr = bundleLinkedOutput(Input, Args, Kind); diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp index 09cca5667a470..b02ad01bdef74 100644 --- a/lld/COFF/Writer.cpp +++ b/lld/COFF/Writer.cpp @@ -188,7 +188,7 @@ class PartialSectionKey { bool operator<(const PartialSectionKey ) const { int c = name.compare(other.name); -if (c == 1) +if (c > 0) return false; if (c == 0) return characteristics < other.characteristics; diff --git a/llvm/include/llvm/ADT/SmallString.h b/llvm/include/llvm/ADT/SmallString.h index 874968f0a13f3..0052c86fb37b8 100644
[clang] 18b0d2c - [analyzer] Fix a FIXME. NFCI
Author: Benjamin Kramer Date: 2023-01-13T16:15:16+01:00 New Revision: 18b0d2c5d9762070f7c579f2e7ecaa105db7 URL: https://github.com/llvm/llvm-project/commit/18b0d2c5d9762070f7c579f2e7ecaa105db7 DIFF: https://github.com/llvm/llvm-project/commit/18b0d2c5d9762070f7c579f2e7ecaa105db7.diff LOG: [analyzer] Fix a FIXME. NFCI Added: Modified: clang/lib/StaticAnalyzer/Core/CheckerManager.cpp Removed: diff --git a/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp b/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp index 94287b7992dd9..5227766a4a405 100644 --- a/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp +++ b/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp @@ -35,10 +35,7 @@ using namespace ento; bool CheckerManager::hasPathSensitiveCheckers() const { const auto IfAnyAreNonEmpty = [](const auto &... Callbacks) -> bool { -bool Result = false; -// FIXME: Use fold expressions in C++17. -LLVM_ATTRIBUTE_UNUSED int Unused[]{0, (Result |= !Callbacks.empty())...}; -return Result; +return (!Callbacks.empty() || ...); }; return IfAnyAreNonEmpty( StmtCheckers, PreObjCMessageCheckers, ObjCMessageNilCheckers, ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] e68fc86 - [NFCI][Offload Bundler] Replace hand-rolled endian conversion with llvm::support
Author: Benjamin Kramer Date: 2023-01-08T17:37:02+01:00 New Revision: e68fc86b22fd92f15c464b69e8d98a76f139cebd URL: https://github.com/llvm/llvm-project/commit/e68fc86b22fd92f15c464b69e8d98a76f139cebd DIFF: https://github.com/llvm/llvm-project/commit/e68fc86b22fd92f15c464b69e8d98a76f139cebd.diff LOG: [NFCI][Offload Bundler] Replace hand-rolled endian conversion with llvm::support Added: Modified: clang/lib/Driver/OffloadBundler.cpp Removed: diff --git a/clang/lib/Driver/OffloadBundler.cpp b/clang/lib/Driver/OffloadBundler.cpp index 86fc4df5914a..7cffe4008b8e 100644 --- a/clang/lib/Driver/OffloadBundler.cpp +++ b/clang/lib/Driver/OffloadBundler.cpp @@ -29,8 +29,8 @@ #include "llvm/Object/Binary.h" #include "llvm/Object/ObjectFile.h" #include "llvm/Support/Casting.h" -#include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/EndianStream.h" #include "llvm/Support/Errc.h" #include "llvm/Support/Error.h" #include "llvm/Support/ErrorOr.h" @@ -297,24 +297,12 @@ class FileHandler { /// Read 8-byte integers from a buffer in little-endian format. static uint64_t Read8byteIntegerFromBuffer(StringRef Buffer, size_t pos) { - uint64_t Res = 0; - const char *Data = Buffer.data(); - - for (unsigned i = 0; i < 8; ++i) { -Res <<= 8; -uint64_t Char = (uint64_t)Data[pos + 7 - i]; -Res |= 0xffu & Char; - } - return Res; + return llvm::support::endian::read64le(Buffer.data() + pos); } /// Write 8-byte integers to a buffer in little-endian format. static void Write8byteIntegerToBuffer(raw_fd_ostream , uint64_t Val) { - for (unsigned i = 0; i < 8; ++i) { -char Char = (char)(Val & 0xffu); -OS.write(, 1); -Val >>= 8; - } + llvm::support::endian::write(OS, Val, llvm::support::little); } class BinaryFileHandler final : public FileHandler { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] b6942a2 - [NFC] Hide implementation details in anonymous namespaces
Author: Benjamin Kramer Date: 2023-01-08T17:37:02+01:00 New Revision: b6942a2880c578d2eab89ecb75e637aac41c5e51 URL: https://github.com/llvm/llvm-project/commit/b6942a2880c578d2eab89ecb75e637aac41c5e51 DIFF: https://github.com/llvm/llvm-project/commit/b6942a2880c578d2eab89ecb75e637aac41c5e51.diff LOG: [NFC] Hide implementation details in anonymous namespaces Added: Modified: clang/lib/AST/ASTImporter.cpp clang/lib/Driver/OffloadBundler.cpp clang/lib/Sema/AnalysisBasedWarnings.cpp clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp llvm/lib/CodeGen/ExpandLargeDivRem.cpp llvm/lib/CodeGen/ExpandLargeFpConvert.cpp llvm/lib/CodeGen/MachineCycleAnalysis.cpp llvm/lib/CodeGen/SanitizerBinaryMetadata.cpp llvm/lib/MC/SPIRVObjectWriter.cpp llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp llvm/lib/Target/AMDGPU/GCNVOPDUtils.cpp llvm/lib/Target/AMDGPU/R600ISelDAGToDAG.cpp llvm/lib/Target/AMDGPU/R600MCInstLower.cpp llvm/lib/Target/AMDGPU/R600TargetMachine.cpp llvm/lib/Target/RISCV/RISCVISelLowering.cpp llvm/lib/Target/VE/VERegisterInfo.cpp llvm/lib/Target/VE/VETargetMachine.cpp llvm/lib/Target/X86/X86ReturnThunks.cpp llvm/lib/Transforms/Scalar/LoopFlatten.cpp llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp llvm/lib/Transforms/Vectorize/LoopVectorize.cpp llvm/lib/Transforms/Vectorize/VectorCombine.cpp Removed: diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index e77f57008d82f..329718c99dc65 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -8683,6 +8683,7 @@ Expected ASTImporter::Import(TypeSourceInfo *FromTSI) { return ToContext.getTrivialTypeSourceInfo(*TOrErr, *BeginLocOrErr); } +namespace { // To use this object, it should be created before the new attribute is created, // and destructed after it is created. The construction already performs the // import of the data. @@ -8813,6 +8814,7 @@ class AttrImporter { return ToAttr; } }; +} // namespace Expected ASTImporter::Import(const Attr *FromAttr) { AttrImporter AI(*this); diff --git a/clang/lib/Driver/OffloadBundler.cpp b/clang/lib/Driver/OffloadBundler.cpp index bcc0c320fa476..86fc4df5914a2 100644 --- a/clang/lib/Driver/OffloadBundler.cpp +++ b/clang/lib/Driver/OffloadBundler.cpp @@ -184,6 +184,7 @@ bool isCodeObjectCompatible(const OffloadTargetInfo , return true; } +namespace { /// Generic file handler interface. class FileHandler { public: @@ -491,8 +492,6 @@ class BinaryFileHandler final : public FileHandler { } }; -namespace { - // This class implements a list of temporary files that are removed upon // object destruction. class TempFileHandlerRAII { @@ -524,8 +523,6 @@ class TempFileHandlerRAII { std::forward_list> Files; }; -} // end anonymous namespace - /// Handler for object files. The bundles are organized by sections with a /// designated name. /// @@ -827,6 +824,7 @@ class TextFileHandler final : public FileHandler { return Error::success(); } }; +} // namespace /// Return an appropriate object file handler. We use the specific object /// handler if we know how to deal with that format, otherwise we use a default diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp index bde2036ec65c6..7f0677f3376f1 100644 --- a/clang/lib/Sema/AnalysisBasedWarnings.cpp +++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp @@ -2143,6 +2143,7 @@ class ConsumedWarningsHandler : public ConsumedWarningsHandlerBase { // Unsafe buffer usage analysis. //===--===// +namespace { class UnsafeBufferUsageReporter : public UnsafeBufferUsageHandler { Sema @@ -2163,7 +2164,7 @@ class UnsafeBufferUsageReporter : public UnsafeBufferUsageHandler { D << F; } }; - +} // namespace //===--===// // AnalysisBasedWarnings - Worker object used by Sema to execute analysis-based diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp index 4583b2191bf2b..afacf735bdd43 100644 --- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp @@ -613,6 +613,7 @@ static std::optional describeRegion(const MemRegion *MR) { using Bindings = llvm::SmallVector, 4>; +namespace { class VarBindingsCollector : public StoreManager::BindingsHandler { SymbolRef
[clang] e632938 - [Sema] Avoid double hash lookup. NFCI
Author: Benjamin Kramer Date: 2022-12-30T19:25:38+01:00 New Revision: e6329388c39d18c428afdbbfd0f1330e782bc348 URL: https://github.com/llvm/llvm-project/commit/e6329388c39d18c428afdbbfd0f1330e782bc348 DIFF: https://github.com/llvm/llvm-project/commit/e6329388c39d18c428afdbbfd0f1330e782bc348.diff LOG: [Sema] Avoid double hash lookup. NFCI Added: Modified: clang/lib/Sema/SemaLookup.cpp Removed: diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index c73acf1619930..97b3c97a9e51e 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -1623,10 +1623,8 @@ hasAcceptableDefaultArgument(Sema , const ParmDecl *D, if (!D->hasDefaultArgument()) return false; - llvm::SmallDenseSet Visited; - while (D && !Visited.count(D)) { -Visited.insert(D); - + llvm::SmallPtrSet Visited; + while (D && Visited.insert(D).second) { auto = D->getDefaultArgStorage(); if (!DefaultArg.isInherited() && S.isAcceptable(D, Kind)) return true; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 2916b99 - [ADT] Alias llvm::Optional to std::optional
Author: Benjamin Kramer Date: 2022-12-20T01:01:46+01:00 New Revision: 2916b99182752b1aece8cc4479d8d6a20b5e02da URL: https://github.com/llvm/llvm-project/commit/2916b99182752b1aece8cc4479d8d6a20b5e02da DIFF: https://github.com/llvm/llvm-project/commit/2916b99182752b1aece8cc4479d8d6a20b5e02da.diff LOG: [ADT] Alias llvm::Optional to std::optional This avoids the continuous API churn when upgrading things to use std::optional and makes trivial string replace upgrades possible. I tested this with GCC 7.5, the oldest supported GCC I had around. Differential Revision: https://reviews.llvm.org/D140332 Added: Modified: clang/include/clang/Basic/LLVM.h clang/lib/StaticAnalyzer/Core/ExprEngine.cpp flang/include/flang/Lower/Runtime.h lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp lldb/source/Symbol/Type.cpp llvm/include/llvm/ADT/Optional.h llvm/include/llvm/ADT/STLForwardCompat.h llvm/include/llvm/Support/raw_ostream.h llvm/include/llvm/Testing/Support/SupportHelpers.h llvm/lib/CodeGen/RegAllocGreedy.h llvm/unittests/ADT/CMakeLists.txt llvm/unittests/Support/TypeTraitsTest.cpp mlir/include/mlir/Bindings/Python/PybindAdaptors.h mlir/include/mlir/Support/LLVM.h mlir/lib/Bindings/Python/PybindUtils.h mlir/lib/Dialect/GPU/Transforms/SerializeToHsaco.cpp Removed: llvm/unittests/ADT/OptionalTest.cpp diff --git a/clang/include/clang/Basic/LLVM.h b/clang/include/clang/Basic/LLVM.h index 5d4d72630970b..7ffc4c403473b 100644 --- a/clang/include/clang/Basic/LLVM.h +++ b/clang/include/clang/Basic/LLVM.h @@ -37,7 +37,7 @@ namespace llvm { template class SmallString; template class SmallVector; template class SmallVectorImpl; - template class Optional; + template using Optional = std::optional; template class Expected; template diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp index 7ced94a7dc371..f9e76d85efdde 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -481,7 +481,7 @@ Optional ExprEngine::getPendingInitLoop(ProgramStateRef State, const CXXConstructExpr *E, const LocationContext *LCtx) { const unsigned *V = State->get({E, LCtx->getStackFrame()}); - return V ? Optional(*V) : std::nullopt; + return V ? std::make_optional(*V) : std::nullopt; } ProgramStateRef ExprEngine::removePendingInitLoop(ProgramStateRef State, @@ -510,7 +510,7 @@ ExprEngine::getIndexOfElementToConstruct(ProgramStateRef State, const LocationContext *LCtx) { const unsigned *V = State->get({E, LCtx->getStackFrame()}); - return V ? Optional(*V) : std::nullopt; + return V ? std::make_optional(*V) : std::nullopt; } ProgramStateRef @@ -530,7 +530,7 @@ ExprEngine::getPendingArrayDestruction(ProgramStateRef State, const unsigned *V = State->get(LCtx->getStackFrame()); - return V ? Optional(*V) : std::nullopt; + return V ? std::make_optional(*V) : std::nullopt; } ProgramStateRef ExprEngine::setPendingArrayDestruction( @@ -600,7 +600,7 @@ ExprEngine::getObjectUnderConstruction(ProgramStateRef State, const LocationContext *LC) { ConstructedObjectKey Key(Item, LC->getStackFrame()); const SVal *V = State->get(Key); - return V ? Optional(*V) : std::nullopt; + return V ? std::make_optional(*V) : std::nullopt; } ProgramStateRef diff --git a/flang/include/flang/Lower/Runtime.h b/flang/include/flang/Lower/Runtime.h index 64e9a16fd7988..da01d1a87cccd 100644 --- a/flang/include/flang/Lower/Runtime.h +++ b/flang/include/flang/Lower/Runtime.h @@ -16,9 +16,10 @@ #ifndef FORTRAN_LOWER_RUNTIME_H #define FORTRAN_LOWER_RUNTIME_H +#include + namespace llvm { -template -class Optional; +template using Optional = std::optional; } namespace mlir { diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp index 4efb5a2029e85..32960c2102eda 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -190,7 +190,7 @@ static FormSize g_form_sizes[] = { llvm::Optional DWARFFormValue::GetFixedSize(dw_form_t form, const DWARFUnit *u) { if (form <= DW_FORM_ref_sig8 && g_form_sizes[form].valid) -return g_form_sizes[form].size; +return static_cast(g_form_sizes[form].size); if (form == DW_FORM_addr && u) return u->GetAddressByteSize(); return std::nullopt; diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp index da9eeadc0ecd2..048e37fb1db2f 100644 --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -343,7 +343,7 @@ Type
[clang] 8956852 - Undo a bit of fcf4e360ba6b that confuses MSVC
Author: Benjamin Kramer Date: 2022-12-04T20:33:25+01:00 New Revision: 89568521943b79fe27c6f3c19799a575318b1882 URL: https://github.com/llvm/llvm-project/commit/89568521943b79fe27c6f3c19799a575318b1882 DIFF: https://github.com/llvm/llvm-project/commit/89568521943b79fe27c6f3c19799a575318b1882.diff LOG: Undo a bit of fcf4e360ba6b that confuses MSVC clang\lib\Serialization\GlobalModuleIndex.cpp(818): error C2440: 'initializing': cannot convert from 'const ValueTy' to '_Ty2 &&' with [ ValueTy=llvm::SmallVector ] and [ _Ty2=llvm::SmallVector ] Added: Modified: clang/lib/Serialization/GlobalModuleIndex.cpp Removed: diff --git a/clang/lib/Serialization/GlobalModuleIndex.cpp b/clang/lib/Serialization/GlobalModuleIndex.cpp index 568e207e64053..b2283c2b39877 100644 --- a/clang/lib/Serialization/GlobalModuleIndex.cpp +++ b/clang/lib/Serialization/GlobalModuleIndex.cpp @@ -815,8 +815,10 @@ bool GlobalModuleIndexBuilder::writeIndex(llvm::BitstreamWriter ) { IdentifierIndexWriterTrait Trait; // Populate the hash table. -for (auto &[Identifier, IDs] : InterestingIdentifiers) { - Generator.insert(Identifier, IDs, Trait); +for (InterestingIdentifierMap::iterator I = InterestingIdentifiers.begin(), +IEnd = InterestingIdentifiers.end(); + I != IEnd; ++I) { + Generator.insert(I->first(), I->second, Trait); } // Create the on-disk hash table in a buffer. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fcf4e36 - Iterate over StringMaps using structured bindings. NFCI.
Author: Benjamin Kramer Date: 2022-12-04T18:36:41+01:00 New Revision: fcf4e360ba6b5f005d2c478ca79112be7a61dacb URL: https://github.com/llvm/llvm-project/commit/fcf4e360ba6b5f005d2c478ca79112be7a61dacb DIFF: https://github.com/llvm/llvm-project/commit/fcf4e360ba6b5f005d2c478ca79112be7a61dacb.diff LOG: Iterate over StringMaps using structured bindings. NFCI. Added: Modified: clang/lib/Serialization/GlobalModuleIndex.cpp llvm/include/llvm/ProfileData/SampleProf.h llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h llvm/lib/CodeGen/CommandFlags.cpp llvm/lib/IR/AsmWriter.cpp llvm/lib/Target/TargetMachineC.cpp mlir/lib/Dialect/Transform/IR/TransformOps.cpp mlir/lib/ExecutionEngine/ExecutionEngine.cpp Removed: diff --git a/clang/lib/Serialization/GlobalModuleIndex.cpp b/clang/lib/Serialization/GlobalModuleIndex.cpp index b2283c2b3987..568e207e6405 100644 --- a/clang/lib/Serialization/GlobalModuleIndex.cpp +++ b/clang/lib/Serialization/GlobalModuleIndex.cpp @@ -815,10 +815,8 @@ bool GlobalModuleIndexBuilder::writeIndex(llvm::BitstreamWriter ) { IdentifierIndexWriterTrait Trait; // Populate the hash table. -for (InterestingIdentifierMap::iterator I = InterestingIdentifiers.begin(), -IEnd = InterestingIdentifiers.end(); - I != IEnd; ++I) { - Generator.insert(I->first(), I->second, Trait); +for (auto &[Identifier, IDs] : InterestingIdentifiers) { + Generator.insert(Identifier, IDs, Trait); } // Create the on-disk hash table in a buffer. diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h index aa202e91e9e0..db101b7bc7a8 100644 --- a/llvm/include/llvm/ProfileData/SampleProf.h +++ b/llvm/include/llvm/ProfileData/SampleProf.h @@ -405,8 +405,8 @@ class SampleRecord { /// Sort call targets in descending order of call frequency. static const SortedCallTargetSet SortCallTargets(const CallTargetMap ) { SortedCallTargetSet SortedTargets; -for (const auto : Targets) { - SortedTargets.emplace(I.first(), I.second); +for (const auto &[Target, Frequency] : Targets) { + SortedTargets.emplace(Target, Frequency); } return SortedTargets; } @@ -415,8 +415,8 @@ class SampleRecord { static const CallTargetMap adjustCallTargets(const CallTargetMap , float DistributionFactor) { CallTargetMap AdjustedTargets; -for (const auto : Targets) { - AdjustedTargets[I.first()] = I.second * DistributionFactor; +for (const auto &[Target, Frequency] : Targets) { + AdjustedTargets[Target] = Frequency * DistributionFactor; } return AdjustedTargets; } diff --git a/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h b/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h index c41871e33eaf..5e12fcfeae1b 100644 --- a/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h +++ b/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h @@ -159,9 +159,9 @@ class ProfiledCallGraph { addProfiledFunction(Samples.getFuncName()); for (const auto : Samples.getBodySamples()) { - for (const auto : Sample.second.getCallTargets()) { -addProfiledFunction(Target.first()); -addProfiledCall(Samples.getFuncName(), Target.first(), Target.second); + for (const auto &[Target, Frequency] : Sample.second.getCallTargets()) { +addProfiledFunction(Target); +addProfiledCall(Samples.getFuncName(), Target, Frequency); } } diff --git a/llvm/lib/CodeGen/CommandFlags.cpp b/llvm/lib/CodeGen/CommandFlags.cpp index 68041f9ddef6..9ad7c350a959 100644 --- a/llvm/lib/CodeGen/CommandFlags.cpp +++ b/llvm/lib/CodeGen/CommandFlags.cpp @@ -592,8 +592,8 @@ std::string codegen::getFeaturesStr() { if (getMCPU() == "native") { StringMap HostFeatures; if (sys::getHostCPUFeatures(HostFeatures)) - for (auto : HostFeatures) -Features.AddFeature(F.first(), F.second); + for (const auto &[Feature, IsEnabled] : HostFeatures) +Features.AddFeature(Feature, IsEnabled); } for (auto const : getMAttrs()) @@ -612,8 +612,8 @@ std::vector codegen::getFeatureList() { if (getMCPU() == "native") { StringMap HostFeatures; if (sys::getHostCPUFeatures(HostFeatures)) - for (auto : HostFeatures) -Features.AddFeature(F.first(), F.second); + for (const auto &[Feature, IsEnabled] : HostFeatures) +Features.AddFeature(Feature, IsEnabled); } for (auto const : getMAttrs()) diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp index e67970a17c8e..af80b47449e4 100644 --- a/llvm/lib/IR/AsmWriter.cpp +++ b/llvm/lib/IR/AsmWriter.cpp @@ -1059,8 +1059,8 @@ int SlotTracker::processIndex() { // assigned consecutively. Since the StringMap iteration
[clang] 5cfc22c - Revert "[SROA] `isVectorPromotionViable()`: memory intrinsics operate on vectors of bytes"
Author: Benjamin Kramer Date: 2022-11-23T13:11:16+01:00 New Revision: 5cfc22cafe3f2465e0bb324f8daba82ffcabd0df URL: https://github.com/llvm/llvm-project/commit/5cfc22cafe3f2465e0bb324f8daba82ffcabd0df DIFF: https://github.com/llvm/llvm-project/commit/5cfc22cafe3f2465e0bb324f8daba82ffcabd0df.diff LOG: Revert "[SROA] `isVectorPromotionViable()`: memory intrinsics operate on vectors of bytes" This reverts commit cf624b23bc5d5a6161706d1663def49380ff816a. It triggers crashes in clang, see the comments on github on the original change. Added: Modified: clang/test/CodeGenOpenCL/amdgpu-nullptr.cl llvm/lib/Transforms/Scalar/SROA.cpp llvm/test/CodeGen/AMDGPU/v1024.ll llvm/test/DebugInfo/X86/sroasplit-1.ll llvm/test/DebugInfo/X86/sroasplit-4.ll llvm/test/Transforms/PhaseOrdering/instcombine-sroa-inttoptr.ll llvm/test/Transforms/SROA/address-spaces.ll llvm/test/Transforms/SROA/alignment.ll llvm/test/Transforms/SROA/alloca-address-space.ll llvm/test/Transforms/SROA/basictest.ll llvm/test/Transforms/SROA/pointer-offset-size.ll llvm/test/Transforms/SROA/scalable-vectors.ll llvm/test/Transforms/SROA/slice-width.ll llvm/test/Transforms/SROA/sroa-common-type-fail-promotion.ll llvm/test/Transforms/SROA/tbaa-struct.ll llvm/test/Transforms/SROA/tbaa-struct2.ll llvm/test/Transforms/SROA/vector-promotion.ll Removed: diff --git a/clang/test/CodeGenOpenCL/amdgpu-nullptr.cl b/clang/test/CodeGenOpenCL/amdgpu-nullptr.cl index 859e81f08d6bd..65f6f2e7d8c24 100644 --- a/clang/test/CodeGenOpenCL/amdgpu-nullptr.cl +++ b/clang/test/CodeGenOpenCL/amdgpu-nullptr.cl @@ -515,17 +515,13 @@ typedef struct { private char *p; } StructTy3; -// CHECK-LABEL: @test_memset_private( -// CHECK-NEXT: entry: -// CHECK-NEXT:[[TMP0:%.*]] = bitcast [[STRUCT_STRUCTTY3:%.*]] addrspace(5)* [[PTR:%.*]] to i8 addrspace(5)* -// CHECK-NEXT:[[S3_SROA_0_SROA_0_0_S3_SROA_0_0__SROA_CAST2_SROA_CAST:%.*]] = bitcast [[STRUCT_STRUCTTY3]] addrspace(5)* [[PTR]] to <32 x i8> addrspace(5)* -// CHECK-NEXT:store <32 x i8> zeroinitializer, <32 x i8> addrspace(5)* [[S3_SROA_0_SROA_0_0_S3_SROA_0_0__SROA_CAST2_SROA_CAST]], align 8, !tbaa.struct !9 -// CHECK-NEXT:[[S3_SROA_4_0__SROA_IDX6:%.*]] = getelementptr inbounds [[STRUCT_STRUCTTY3]], [[STRUCT_STRUCTTY3]] addrspace(5)* [[PTR]], i32 0, i32 4 -// CHECK-NEXT:store i8 addrspace(5)* addrspacecast (i8* null to i8 addrspace(5)*), i8 addrspace(5)* addrspace(5)* [[S3_SROA_4_0__SROA_IDX6]], align 8, !tbaa.struct !12 -// CHECK-NEXT:[[S3_SROA_5_0__SROA_IDX:%.*]] = getelementptr inbounds i8, i8 addrspace(5)* [[TMP0]], i32 36 -// CHECK-NEXT:[[S3_SROA_5_0__SROA_CAST8:%.*]] = bitcast i8 addrspace(5)* [[S3_SROA_5_0__SROA_IDX]] to i32 addrspace(5)* -// CHECK-NEXT:store i32 0, i32 addrspace(5)* [[S3_SROA_5_0__SROA_CAST8]], align 4, !tbaa.struct !13 -// CHECK-NEXT:ret void +// CHECK-LABEL: test_memset_private +// CHECK: call void @llvm.memset.p5i8.i64(i8 addrspace(5)* noundef align 8 {{.*}}, i8 0, i64 32, i1 false) +// CHECK: [[GEP:%.*]] = getelementptr inbounds %struct.StructTy3, %struct.StructTy3 addrspace(5)* %ptr, i32 0, i32 4 +// CHECK: store i8 addrspace(5)* addrspacecast (i8* null to i8 addrspace(5)*), i8 addrspace(5)* addrspace(5)* [[GEP]] +// CHECK: [[GEP1:%.*]] = getelementptr inbounds i8, i8 addrspace(5)* {{.*}}, i32 36 +// CHECK: [[GEP1_CAST:%.*]] = bitcast i8 addrspace(5)* [[GEP1]] to i32 addrspace(5)* +// CHECK: store i32 0, i32 addrspace(5)* [[GEP1_CAST]], align 4 void test_memset_private(private StructTy3 *ptr) { StructTy3 S3 = {0, 0, 0, 0, 0}; *ptr = S3; diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index 09a445c236fa7..6dcdd630b6bae 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -1806,10 +1806,8 @@ static bool isVectorPromotionViableForSlice(Partition , const Slice , ? Ty->getElementType() : FixedVectorType::get(Ty->getElementType(), NumElements); - Type *SplitIntTy = nullptr; - if (uint64_t Bitwidth = NumElements * ElementSize * 8; - Bitwidth <= IntegerType::MAX_INT_BITS) -SplitIntTy = Type::getIntNTy(Ty->getContext(), Bitwidth); + Type *SplitIntTy = + Type::getIntNTy(Ty->getContext(), NumElements * ElementSize * 8); Use *U = S.getUse(); @@ -1828,8 +1826,7 @@ static bool isVectorPromotionViableForSlice(Partition , const Slice , // Disable vector promotion when there are loads or stores of an FCA. if (LTy->isStructTy()) return false; -if (SplitIntTy && -(P.beginOffset() > S.beginOffset() || P.endOffset() < S.endOffset())) { +if (P.beginOffset() > S.beginOffset() || P.endOffset() < S.endOffset()) { assert(LTy->isIntegerTy()); LTy = SplitIntTy; } @@ -1842,8 +1839,7 @@ static bool
[clang] 88eb3c6 - Add FP8 E4M3 support to APFloat.
Author: Reed Date: 2022-11-15T20:26:42+01:00 New Revision: 88eb3c62f25d820a80bc73af786002e1fc4a URL: https://github.com/llvm/llvm-project/commit/88eb3c62f25d820a80bc73af786002e1fc4a DIFF: https://github.com/llvm/llvm-project/commit/88eb3c62f25d820a80bc73af786002e1fc4a.diff LOG: Add FP8 E4M3 support to APFloat. NVIDIA, ARM, and Intel recently introduced two new FP8 formats, as described in the paper: https://arxiv.org/abs/2209.05433. The first of the two FP8 dtypes, E5M2, was added in https://reviews.llvm.org/D133823. This change adds the second of the two: E4M3. There is an RFC for adding the FP8 dtypes here: https://discourse.llvm.org/t/rfc-add-apfloat-and-mlir-type-support-for-fp8-e5m2/65279. I spoke with the RFC's author, Stella, and she gave me the go ahead to implement the E4M3 type. The name of the E4M3 type in APFloat is Float8E4M3FN, as discussed in the RFC. The "FN" means only Finite and NaN values are supported. Unlike E5M2, E4M3 has different behavior from IEEE types in regards to Inf and NaN values. There are no Inf values, and NaN is represented when the exponent and mantissa bits are all 1s. To represent these differences in APFloat, I added an enum field, fltNonfiniteBehavior, to the fltSemantics struct. The possible enum values are IEEE754 and NanOnly. Only Float8E4M3FN has the NanOnly behavior. After this change is submitted, I plan on adding the Float8E4M3FN type to MLIR, in the same way as E5M2 was added in https://reviews.llvm.org/D133823. Reviewed By: bkramer Differential Revision: https://reviews.llvm.org/D137760 Added: Modified: clang/include/clang/AST/Stmt.h clang/lib/AST/MicrosoftMangle.cpp llvm/include/llvm/ADT/APFloat.h llvm/lib/Support/APFloat.cpp llvm/unittests/ADT/APFloatTest.cpp Removed: diff --git a/clang/include/clang/AST/Stmt.h b/clang/include/clang/AST/Stmt.h index 49a66a1ea5b86..c65cdeb574cc9 100644 --- a/clang/include/clang/AST/Stmt.h +++ b/clang/include/clang/AST/Stmt.h @@ -22,6 +22,7 @@ #include "clang/Basic/LangOptions.h" #include "clang/Basic/SourceLocation.h" #include "clang/Basic/Specifiers.h" +#include "llvm/ADT/APFloat.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/BitmaskEnum.h" #include "llvm/ADT/PointerIntPair.h" @@ -389,7 +390,10 @@ class alignas(void *) Stmt { unsigned : NumExprBits; -unsigned Semantics : 3; // Provides semantics for APFloat construction +static_assert( +llvm::APFloat::S_MaxSemantics < 16, +"Too many Semantics enum values to fit in bitfield of size 4"); +unsigned Semantics : 4; // Provides semantics for APFloat construction unsigned IsExact : 1; }; diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 8f724191e697a..bc4dd66433b52 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -839,6 +839,7 @@ void MicrosoftCXXNameMangler::mangleFloat(llvm::APFloat Number) { case APFloat::S_IEEEquad: Out << 'Y'; break; case APFloat::S_PPCDoubleDouble: Out << 'Z'; break; case APFloat::S_Float8E5M2: + case APFloat::S_Float8E4M3FN: llvm_unreachable("Tried to mangle unexpected APFloat semantics"); } diff --git a/llvm/include/llvm/ADT/APFloat.h b/llvm/include/llvm/ADT/APFloat.h index 72eef0fb4763c..bc312df5a07db 100644 --- a/llvm/include/llvm/ADT/APFloat.h +++ b/llvm/include/llvm/ADT/APFloat.h @@ -156,8 +156,13 @@ struct APFloatBase { S_IEEEquad, S_PPCDoubleDouble, // 8-bit floating point number following IEEE-754 conventions with bit -// layout S1E5M2 as described in https://arxiv.org/abs/2209.05433 +// layout S1E5M2 as described in https://arxiv.org/abs/2209.05433. S_Float8E5M2, +// 8-bit floating point number mostly following IEEE-754 conventions with +// bit layout S1E4M3 as described in https://arxiv.org/abs/2209.05433. +// Unlike IEEE-754 types, there are no infinity values, and NaN is +// represented with the exponent and mantissa bits set to all 1s. +S_Float8E4M3FN, S_x87DoubleExtended, S_MaxSemantics = S_x87DoubleExtended, }; @@ -172,6 +177,7 @@ struct APFloatBase { static const fltSemantics () LLVM_READNONE; static const fltSemantics () LLVM_READNONE; static const fltSemantics () LLVM_READNONE; + static const fltSemantics () LLVM_READNONE; static const fltSemantics () LLVM_READNONE; /// A Pseudo fltsemantic used to construct APFloats that cannot conflict with @@ -508,6 +514,7 @@ class IEEEFloat final : public APFloatBase { void zeroSignificand(); /// Return true if the significand excluding the integral bit is all ones. bool isSignificandAllOnes() const; + bool isSignificandAllOnesExceptLSB() const; /// Return true if the significand excluding the integral bit is all zeros. bool isSignificandAllZeros() const; @@ -557,6 +564,7 @@ class
[clang] da4b929 - [clang][Interp] Reorder field destruction to avoid use after dtor
Author: Benjamin Kramer Date: 2022-10-31T12:20:10+01:00 New Revision: da4b929da79f4ce886f5612e3c84d29c1d2632f7 URL: https://github.com/llvm/llvm-project/commit/da4b929da79f4ce886f5612e3c84d29c1d2632f7 DIFF: https://github.com/llvm/llvm-project/commit/da4b929da79f4ce886f5612e3c84d29c1d2632f7.diff LOG: [clang][Interp] Reorder field destruction to avoid use after dtor Found by msan -fsanitize-memory-use-after-dtor. ==8259==WARNING: MemorySanitizer: use-of-uninitialized-value #0 0x55dbec54d2b8 in dtorRecord(clang::interp::Block*, char*, clang::interp::Descriptor*) clang/lib/AST/Interp/Descriptor.cpp:150:22 #1 0x55dbec54bfcf in dtorArrayDesc(clang::interp::Block*, char*, clang::interp::Descriptor*) clang/lib/AST/Interp/Descriptor.cpp:97:7 #2 0x55dbec508578 in invokeDtor clang/lib/AST/Interp/InterpBlock.h:79:7 #3 0x55dbec508578 in clang::interp::Program::~Program() clang/lib/AST/Interp/Program.h:55:19 #4 0x55dbec50657a in operator() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:55:5 #5 0x55dbec50657a in std::__msan::unique_ptr>::~unique_ptr() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:261:7 #6 0x55dbec5035a1 in clang::interp::Context::~Context() clang/lib/AST/Interp/Context.cpp:27:22 #7 0x55dbebec1daa in operator() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:55:5 #8 0x55dbebec1daa in std::__msan::unique_ptr>::~unique_ptr() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:261:7 #9 0x55dbebe285f9 in clang::ASTContext::~ASTContext() clang/lib/AST/ASTContext.cpp:1038:40 #10 0x55dbe941ff13 in llvm::RefCountedBase::Release() const llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:101:7 #11 0x55dbe94353ef in release llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:159:38 #12 0x55dbe94353ef in release llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:224:7 #13 0x55dbe94353ef in ~IntrusiveRefCntPtr llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:191:27 #14 0x55dbe94353ef in clang::CompilerInstance::setASTContext(clang::ASTContext*) clang/lib/Frontend/CompilerInstance.cpp:178:3 #15 0x55dbe95ad0ad in clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:1100:8 #16 0x55dbe9445fcf in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:1047:11 #17 0x55dbe6b3afef in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:266:25 #18 0x55dbe6b13288 in cc1_main(llvm::ArrayRef, char const*, void*) clang/tools/driver/cc1_main.cpp:250:15 #19 0x55dbe6b0095f in ExecuteCC1Tool(llvm::SmallVectorImpl&) clang/tools/driver/driver.cpp:319:12 #20 0x55dbe6aff41c in clang_main(int, char**) clang/tools/driver/driver.cpp:395:12 #21 0x7f9be07fa632 in __libc_start_main #22 0x55dbe6a702e9 in _start Member fields were destroyed #0 0x55dbe6a7da5d in __sanitizer_dtor_callback_fields compiler-rt/lib/msan/msan_interceptors.cpp:949:5 #1 0x55dbec5094ac in ~SmallVectorImpl llvm/include/llvm/ADT/SmallVector.h:479:7 #2 0x55dbec5094ac in ~SmallVectorImpl llvm/include/llvm/ADT/SmallVector.h:612:3 #3 0x55dbec5094ac in llvm::SmallVector::~SmallVector() llvm/include/llvm/ADT/SmallVector.h:1207:3 #4 0x55dbec508e79 in clang::interp::Record::~Record() clang/lib/AST/Interp/Record.h:24:7 #5 0x55dbec508612 in clang::interp::Program::~Program() clang/lib/AST/Interp/Program.h:49:26 #6 0x55dbec50657a in operator() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:55:5 #7 0x55dbec50657a in std::__msan::unique_ptr>::~unique_ptr() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:261:7 #8 0x55dbec5035a1 in clang::interp::Context::~Context() clang/lib/AST/Interp/Context.cpp:27:22 #9 0x55dbebec1daa in operator() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:55:5 #10 0x55dbebec1daa in std::__msan::unique_ptr>::~unique_ptr() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:261:7 #11 0x55dbebe285f9 in clang::ASTContext::~ASTContext() clang/lib/AST/ASTContext.cpp:1038:40 #12 0x55dbe941ff13 in llvm::RefCountedBase::Release() const llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:101:7 #13 0x55dbe94353ef in release llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:159:38 #14 0x55dbe94353ef in release llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:224:7 #15 0x55dbe94353ef in ~IntrusiveRefCntPtr llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:191:27 #16 0x55dbe94353ef in clang::CompilerInstance::setASTContext(clang::ASTContext*) clang/lib/Frontend/CompilerInstance.cpp:178:3 #17 0x55dbe95ad0ad in clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:1100:8
[clang] 2f35705 - [Interp] Silence warning in release builds. NFC.
Author: Benjamin Kramer Date: 2022-10-14T10:38:32+02:00 New Revision: 2f357054d705459c534a74781e4dc24debe78fcb URL: https://github.com/llvm/llvm-project/commit/2f357054d705459c534a74781e4dc24debe78fcb DIFF: https://github.com/llvm/llvm-project/commit/2f357054d705459c534a74781e4dc24debe78fcb.diff LOG: [Interp] Silence warning in release builds. NFC. Added: Modified: clang/lib/AST/Interp/EvalEmitter.cpp Removed: diff --git a/clang/lib/AST/Interp/EvalEmitter.cpp b/clang/lib/AST/Interp/EvalEmitter.cpp index 94cd1ba9bf94..aa4396f135d2 100644 --- a/clang/lib/AST/Interp/EvalEmitter.cpp +++ b/clang/lib/AST/Interp/EvalEmitter.cpp @@ -113,6 +113,7 @@ bool EvalEmitter::emitCall(const Function *Func, const SourceInfo ) { bool EvalEmitter::emitCallVoid(const Function *Func, const SourceInfo ) { APValue VoidResult; InterpFrame *before = S.Current; + (void)before; S.Current = new InterpFrame(S, const_cast(Func), {}); bool Success = Interpret(S, VoidResult); assert(VoidResult.isAbsent()); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] c5d950f - [HLSL] Simplify code and fix unused variable warnings. NFC.
Author: Benjamin Kramer Date: 2022-10-13T09:46:32+02:00 New Revision: c5d950f4699ff0d9eee20fa144a2ef5f2deffa7b URL: https://github.com/llvm/llvm-project/commit/c5d950f4699ff0d9eee20fa144a2ef5f2deffa7b DIFF: https://github.com/llvm/llvm-project/commit/c5d950f4699ff0d9eee20fa144a2ef5f2deffa7b.diff LOG: [HLSL] Simplify code and fix unused variable warnings. NFC. Added: Modified: clang/lib/CodeGen/CGHLSLRuntime.cpp Removed: diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp index 245fe88c170f..e1011db758d6 100644 --- a/clang/lib/CodeGen/CGHLSLRuntime.cpp +++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp @@ -98,16 +98,12 @@ GlobalVariable *replaceBuffer(CGHLSLRuntime::Buffer ) { IRBuilder<> B(CBGV->getContext()); Value *ZeroIdx = B.getInt32(0); // Replace Const use with CB use. - for (auto : Buf.Constants) { -llvm::Type *EltTy = Buf.LayoutStruct->getElementType(Const.second); -GlobalVariable *GV = Const.first; -unsigned Offset = Const.second; - + for (auto &[GV, Offset]: Buf.Constants) { Value *GEP = B.CreateGEP(Buf.LayoutStruct, CBGV, {ZeroIdx, B.getInt32(Offset)}); -llvm::Type *GVTy = GV->getValueType(); -assert(EltTy == GVTy && "constant type mismatch"); +assert(Buf.LayoutStruct->getElementType(Offset) == GV->getValueType() && + "constant type mismatch"); // Replace. GV->replaceAllUsesWith(GEP); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] b831af5 - [libTooling] Simplify code with constexpr if. NFCI.
Author: Benjamin Kramer Date: 2022-08-27T10:50:06+02:00 New Revision: b831af51977b4150763d69a26a2d912459c1114d URL: https://github.com/llvm/llvm-project/commit/b831af51977b4150763d69a26a2d912459c1114d DIFF: https://github.com/llvm/llvm-project/commit/b831af51977b4150763d69a26a2d912459c1114d.diff LOG: [libTooling] Simplify code with constexpr if. NFCI. Added: Modified: clang/include/clang/Tooling/Transformer/Transformer.h Removed: diff --git a/clang/include/clang/Tooling/Transformer/Transformer.h b/clang/include/clang/Tooling/Transformer/Transformer.h index 4e93783f2b9d9..23683bfb86036 100644 --- a/clang/include/clang/Tooling/Transformer/Transformer.h +++ b/clang/include/clang/Tooling/Transformer/Transformer.h @@ -112,22 +112,7 @@ class Transformer : public ast_matchers::MatchFinder::MatchCallback { }; namespace detail { -/// Asserts that all \c Metadata for the \c Rule is set. -/// FIXME: Use constexpr-if in C++17. -/// @{ -template -void assertMetadataSet(const transformer::RewriteRuleWith ) { - assert(llvm::all_of(Rule.Metadata, - [](const typename transformer::Generator ) - -> bool { return !!Metadata; }) && - "metadata generator must be provided for each rule"); -} -template <> -inline void assertMetadataSet(const transformer::RewriteRuleWith &) {} -/// @} - /// Runs the metadata generator on \c Rule and stuffs it into \c Result. -/// FIXME: Use constexpr-if in C++17. /// @{ template llvm::Error @@ -135,17 +120,12 @@ populateMetadata(const transformer::RewriteRuleWith , size_t SelectedCase, const ast_matchers::MatchFinder::MatchResult , TransformerResult ) { - auto Metadata = Rule.Metadata[SelectedCase]->eval(Match); - if (!Metadata) -return Metadata.takeError(); - Result.Metadata = std::move(*Metadata); - return llvm::Error::success(); -} -template <> -inline llvm::Error -populateMetadata(const transformer::RewriteRuleWith &, size_t, - const ast_matchers::MatchFinder::MatchResult , - TransformerResult &) { + if constexpr (!std::is_void_v) { +auto Metadata = Rule.Metadata[SelectedCase]->eval(Match); +if (!Metadata) + return Metadata.takeError(); +Result.Metadata = std::move(*Metadata); + } return llvm::Error::success(); } /// @} @@ -165,7 +145,11 @@ template class WithMetadataImpl final : public TransformerImpl { [](const transformer::RewriteRuleBase::Case ) -> bool { return !!Case.Edits; }) && "edit generator must be provided for each rule"); -assertMetadataSet(Rule); +if constexpr (!std::is_void_v) + assert(llvm::all_of(Rule.Metadata, + [](const typename transformer::Generator ) + -> bool { return !!Metadata; }) && + "metadata generator must be provided for each rule"); } private: ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 01bebed - [Basic] Drop header-only dependency from Basic to Lex
Author: Benjamin Kramer Date: 2022-08-26T16:03:22+02:00 New Revision: 01bebedaf09bcb7b4f00b8d37a121e68316f9f59 URL: https://github.com/llvm/llvm-project/commit/01bebedaf09bcb7b4f00b8d37a121e68316f9f59 DIFF: https://github.com/llvm/llvm-project/commit/01bebedaf09bcb7b4f00b8d37a121e68316f9f59.diff LOG: [Basic] Drop header-only dependency from Basic to Lex It's still a bit weird for IdentifierTable to depend on Lex diagnostics, but we can get away with including the enum info that's in Basic already. Added: Modified: clang/include/clang/Basic/IdentifierTable.h clang/lib/Basic/IdentifierTable.cpp Removed: diff --git a/clang/include/clang/Basic/IdentifierTable.h b/clang/include/clang/Basic/IdentifierTable.h index 1e89aa5f670f..f98ea48f952f 100644 --- a/clang/include/clang/Basic/IdentifierTable.h +++ b/clang/include/clang/Basic/IdentifierTable.h @@ -15,9 +15,9 @@ #ifndef LLVM_CLANG_BASIC_IDENTIFIERTABLE_H #define LLVM_CLANG_BASIC_IDENTIFIERTABLE_H +#include "clang/Basic/DiagnosticIDs.h" #include "clang/Basic/LLVM.h" #include "clang/Basic/TokenKinds.h" -#include "clang/Lex/LexDiagnostic.h" #include "llvm/ADT/DenseMapInfo.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringMap.h" diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp index 5d413a8da6d3..3940d4bc5de3 100644 --- a/clang/lib/Basic/IdentifierTable.cpp +++ b/clang/lib/Basic/IdentifierTable.cpp @@ -13,6 +13,7 @@ #include "clang/Basic/IdentifierTable.h" #include "clang/Basic/CharInfo.h" +#include "clang/Basic/DiagnosticLex.h" #include "clang/Basic/LangOptions.h" #include "clang/Basic/OperatorKinds.h" #include "clang/Basic/Specifiers.h" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 9be8630 - Add a missing override keyword. NFC.
Author: Benjamin Kramer Date: 2022-08-25T14:50:28+02:00 New Revision: 9be8630ca9445b3370385bdbce9b7919f267e38a URL: https://github.com/llvm/llvm-project/commit/9be8630ca9445b3370385bdbce9b7919f267e38a DIFF: https://github.com/llvm/llvm-project/commit/9be8630ca9445b3370385bdbce9b7919f267e38a.diff LOG: Add a missing override keyword. NFC. clang/lib/Basic/Targets/X86.h:293:8: warning: 'shouldEmitFloat16WithExcessPrecision' overrides a member function but is not marked 'override' [-Winconsistent-missing-override] bool shouldEmitFloat16WithExcessPrecision() const { ^ clang/include/clang/Basic/TargetInfo.h:915:16: note: overridden virtual function is here virtual bool shouldEmitFloat16WithExcessPrecision() const { return false; } ^ Added: Modified: clang/lib/Basic/Targets/X86.h Removed: diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h index aef9f4a0676ec..7c1fe0d50fac0 100644 --- a/clang/lib/Basic/Targets/X86.h +++ b/clang/lib/Basic/Targets/X86.h @@ -290,7 +290,7 @@ class LLVM_LIBRARY_VISIBILITY X86TargetInfo : public TargetInfo { return false; } - bool shouldEmitFloat16WithExcessPrecision() const { + bool shouldEmitFloat16WithExcessPrecision() const override { return HasFloat16 && !hasLegalHalfType(); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] bbf19a6 - [AST] Use std::apply to pop front of tuples. NFCI.
Author: Benjamin Kramer Date: 2022-08-25T00:03:08+02:00 New Revision: bbf19a6745d5e2caa60d466c3c9fc8bc8eac3474 URL: https://github.com/llvm/llvm-project/commit/bbf19a6745d5e2caa60d466c3c9fc8bc8eac3474 DIFF: https://github.com/llvm/llvm-project/commit/bbf19a6745d5e2caa60d466c3c9fc8bc8eac3474.diff LOG: [AST] Use std::apply to pop front of tuples. NFCI. Added: Modified: clang/lib/AST/ParentMapContext.cpp Removed: diff --git a/clang/lib/AST/ParentMapContext.cpp b/clang/lib/AST/ParentMapContext.cpp index e0d4700e4b10b..0840c573e0e45 100644 --- a/clang/lib/AST/ParentMapContext.cpp +++ b/clang/lib/AST/ParentMapContext.cpp @@ -265,16 +265,6 @@ class ParentMapContext::ParentMap { } }; -template -auto tuple_pop_front_impl(const Tuple , std::index_sequence) { - return std::make_tuple(std::get<1 + Is>(tuple)...); -} - -template auto tuple_pop_front(const Tuple ) { - return tuple_pop_front_impl( - tuple, std::make_index_sequence::value - 1>()); -} - template struct MatchParents { static std::tuple match(const DynTypedNodeList , @@ -285,10 +275,11 @@ template struct MatchParents { if (NextParentList.size() == 1) { auto TailTuple = MatchParents::match(NextParentList, ParentMap); if (std::get(TailTuple)) { - return std::tuple_cat( - std::make_tuple(true, std::get(TailTuple), - TypedNode), - tuple_pop_front(tuple_pop_front(TailTuple))); + return std::apply( + [TypedNode](bool, DynTypedNodeList NodeList, auto... TupleTail) { +return std::make_tuple(true, NodeList, TypedNode, TupleTail...); + }, + TailTuple); } } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 99a5a02 - [ASTMatchers] Replace hand-coded copy of std::apply with the real C++17 function. NFCI
Author: Benjamin Kramer Date: 2022-08-08T14:08:04+02:00 New Revision: 99a5a029e66643364c87d3945fb6990e943915dc URL: https://github.com/llvm/llvm-project/commit/99a5a029e66643364c87d3945fb6990e943915dc DIFF: https://github.com/llvm/llvm-project/commit/99a5a029e66643364c87d3945fb6990e943915dc.diff LOG: [ASTMatchers] Replace hand-coded copy of std::apply with the real C++17 function. NFCI Added: Modified: clang/include/clang/ASTMatchers/ASTMatchersInternal.h Removed: diff --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h index 49de9a458c3db..5785a72559987 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h +++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h @@ -1396,20 +1396,6 @@ struct VariadicOperatorMatcherFunc { } }; -template -constexpr auto applyMatcherImpl(F &, Tuple &, -std::index_sequence) { - return std::forward(f)(std::get(std::forward(args))...); -} - -template -constexpr auto applyMatcher(F &, Tuple &) { - return applyMatcherImpl( - std::forward(f), std::forward(args), - std::make_index_sequence< - std::tuple_size::type>::value>()); -} - template struct GetCladeImpl { using Type = Head; @@ -1428,12 +1414,11 @@ struct MapAnyOfMatcherImpl { template BindableMatcher operator()(InnerMatchers &&... InnerMatcher) const { -// TODO: Use std::apply from c++17 -return VariadicAllOfMatcher()(applyMatcher( +return VariadicAllOfMatcher()(std::apply( internal::VariadicOperatorMatcherFunc< 0, std::numeric_limits::max()>{ internal::DynTypedMatcher::VO_AnyOf}, -applyMatcher( +std::apply( [&](auto... Matcher) { return std::make_tuple(Matcher(InnerMatcher...)...); }, ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] ad17e69 - [analyzer] Fix unused variable warning in release builds. NFC.
Author: Benjamin Kramer Date: 2022-07-26T11:29:38+02:00 New Revision: ad17e69923ec39b6439ac0041e69de1f1f5ecec4 URL: https://github.com/llvm/llvm-project/commit/ad17e69923ec39b6439ac0041e69de1f1f5ecec4 DIFF: https://github.com/llvm/llvm-project/commit/ad17e69923ec39b6439ac0041e69de1f1f5ecec4.diff LOG: [analyzer] Fix unused variable warning in release builds. NFC. Added: Modified: clang/lib/StaticAnalyzer/Core/ExprEngine.cpp Removed: diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp index 936d4ed7c89b..19149d079822 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -541,8 +541,6 @@ ExprEngine::addObjectUnderConstruction(ProgramStateRef State, if (const auto *AILE = dyn_cast_or_null(Init)) Init = AILE->getSubExpr(); - const auto *E = dyn_cast_or_null(Init); - // FIXME: Currently the state might already contain the marker due to // incorrect handling of temporaries bound to default parameters. // The state will already contain the marker if we construct elements @@ -552,7 +550,8 @@ ExprEngine::addObjectUnderConstruction(ProgramStateRef State, assert((!State->get(Key) || Key.getItem().getKind() == ConstructionContextItem::TemporaryDestructorKind || - State->contains({E, LC})) && + State->contains( + {dyn_cast_or_null(Init), LC})) && "The object is already marked as `UnderConstruction`, when it's not " "supposed to!"); return State->set(Key, V); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 35b80c4 - Don't write to source directory in test
Author: Benjamin Kramer Date: 2022-07-22T11:14:26+02:00 New Revision: 35b80c448bbc056a7060201c9f62eec9115e3c31 URL: https://github.com/llvm/llvm-project/commit/35b80c448bbc056a7060201c9f62eec9115e3c31 DIFF: https://github.com/llvm/llvm-project/commit/35b80c448bbc056a7060201c9f62eec9115e3c31.diff LOG: Don't write to source directory in test Added: Modified: clang/test/CodeGen/module-intializer-pmf.cpp Removed: diff --git a/clang/test/CodeGen/module-intializer-pmf.cpp b/clang/test/CodeGen/module-intializer-pmf.cpp index e513b280b0a7..7ab4a2e2bd78 100644 --- a/clang/test/CodeGen/module-intializer-pmf.cpp +++ b/clang/test/CodeGen/module-intializer-pmf.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 %s \ -// RUN:-emit-module-interface -o HasPMF.pcm -// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 HasPMF.pcm \ +// RUN:-emit-module-interface -o %T/HasPMF.pcm +// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 %T/HasPMF.pcm \ // RUN: -S -emit-llvm -o - | FileCheck %s module; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 313f8a2 - Don't include private gtest/gmock headers
Author: Benjamin Kramer Date: 2022-07-18T16:34:36+02:00 New Revision: 313f8a20fdf968501a79c7f9aaaf77ae0faaf907 URL: https://github.com/llvm/llvm-project/commit/313f8a20fdf968501a79c7f9aaaf77ae0faaf907 DIFF: https://github.com/llvm/llvm-project/commit/313f8a20fdf968501a79c7f9aaaf77ae0faaf907.diff LOG: Don't include private gtest/gmock headers Only gmock.h and gtest.h are supposed to be user-visible. Added: Modified: clang/unittests/Basic/SarifTest.cpp Removed: diff --git a/clang/unittests/Basic/SarifTest.cpp b/clang/unittests/Basic/SarifTest.cpp index 123be8e924fe..05221c828afe 100644 --- a/clang/unittests/Basic/SarifTest.cpp +++ b/clang/unittests/Basic/SarifTest.cpp @@ -20,9 +20,7 @@ #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/VirtualFileSystem.h" #include "llvm/Support/raw_ostream.h" -#include "gmock/gmock-matchers.h" -#include "gtest/gtest-death-test.h" -#include "gtest/gtest-matchers.h" +#include "gmock/gmock.h" #include "gtest/gtest.h" #include ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 170ca11 - [Sema] Remove unused function after 8c7b64b5ae2a
Author: Benjamin Kramer Date: 2022-06-15T12:20:44+02:00 New Revision: 170ca11aeff25735006ca51e5ed3005b672e8f97 URL: https://github.com/llvm/llvm-project/commit/170ca11aeff25735006ca51e5ed3005b672e8f97 DIFF: https://github.com/llvm/llvm-project/commit/170ca11aeff25735006ca51e5ed3005b672e8f97.diff LOG: [Sema] Remove unused function after 8c7b64b5ae2a Added: Modified: clang/lib/Sema/SemaType.cpp Removed: diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 0c84673b3479..0015d6a870b9 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -8221,19 +8221,6 @@ static void HandleLifetimeBoundAttr(TypeProcessingState , } } -static bool isAddressSpaceKind(const ParsedAttr ) { - auto attrKind = attr.getKind(); - - return attrKind == ParsedAttr::AT_AddressSpace || - attrKind == ParsedAttr::AT_OpenCLPrivateAddressSpace || - attrKind == ParsedAttr::AT_OpenCLGlobalAddressSpace || - attrKind == ParsedAttr::AT_OpenCLGlobalDeviceAddressSpace || - attrKind == ParsedAttr::AT_OpenCLGlobalHostAddressSpace || - attrKind == ParsedAttr::AT_OpenCLLocalAddressSpace || - attrKind == ParsedAttr::AT_OpenCLConstantAddressSpace || - attrKind == ParsedAttr::AT_OpenCLGenericAddressSpace; -} - static void processTypeAttrs(TypeProcessingState , QualType , TypeAttrLocation TAL, const ParsedAttributesView ) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] b3c0918 - [AST] Make header self-contained
Author: Benjamin Kramer Date: 2022-06-08T12:36:36+02:00 New Revision: b3c0918fb4809ebb681daaf1910e171b204b93ea URL: https://github.com/llvm/llvm-project/commit/b3c0918fb4809ebb681daaf1910e171b204b93ea DIFF: https://github.com/llvm/llvm-project/commit/b3c0918fb4809ebb681daaf1910e171b204b93ea.diff LOG: [AST] Make header self-contained There's a dependency in AbstractTypeReader.inc that becomes an error after D127231. Added: Modified: clang/include/clang/AST/AbstractTypeReader.h Removed: diff --git a/clang/include/clang/AST/AbstractTypeReader.h b/clang/include/clang/AST/AbstractTypeReader.h index c9162b1779bc6..e44bbf61c0ed0 100644 --- a/clang/include/clang/AST/AbstractTypeReader.h +++ b/clang/include/clang/AST/AbstractTypeReader.h @@ -9,8 +9,9 @@ #ifndef LLVM_CLANG_AST_ABSTRACTTYPEREADER_H #define LLVM_CLANG_AST_ABSTRACTTYPEREADER_H -#include "clang/AST/Type.h" #include "clang/AST/AbstractBasicReader.h" +#include "clang/AST/DeclObjC.h" +#include "clang/AST/Type.h" namespace clang { namespace serialization { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 1fd6f06 - [format] Fix an uninitialized variable
Author: Benjamin Kramer Date: 2022-06-07T18:18:29+02:00 New Revision: 1fd6f06b9e975386f4bb30ce8a1d044abeb1b633 URL: https://github.com/llvm/llvm-project/commit/1fd6f06b9e975386f4bb30ce8a1d044abeb1b633 DIFF: https://github.com/llvm/llvm-project/commit/1fd6f06b9e975386f4bb30ce8a1d044abeb1b633.diff LOG: [format] Fix an uninitialized variable parseBlock may decide to leave it unchanged. Found by msan. Added: Modified: clang/lib/Format/UnwrappedLineParser.cpp Removed: diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index f581005e8c3ca..86b42c499b23b 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -2595,7 +2595,7 @@ FormatToken *UnwrappedLineParser::parseIfThenElse(IfStmtKind *IfKind, FormatTok->setFinalizedType(TT_ElseLBrace); ElseLeftBrace = FormatTok; CompoundStatementIndenter Indenter(this, Style, Line->Level); - IfStmtKind ElseBlockKind; + IfStmtKind ElseBlockKind = IfStmtKind::NotIf; parseBlock(/*MustBeDeclaration=*/false, /*AddLevels=*/1u, /*MunchSemi=*/true, KeepElseBraces, ); if ((ElseBlockKind == IfStmtKind::IfOnly || ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] 817df79 - [clang-tidy] Silence unused variable warning in release builds. NFCI.
Author: Benjamin Kramer Date: 2022-04-07T11:00:28+02:00 New Revision: 817df7999a71a5dbda0025b75612b54160fb5f9c URL: https://github.com/llvm/llvm-project/commit/817df7999a71a5dbda0025b75612b54160fb5f9c DIFF: https://github.com/llvm/llvm-project/commit/817df7999a71a5dbda0025b75612b54160fb5f9c.diff LOG: [clang-tidy] Silence unused variable warning in release builds. NFCI. Added: Modified: clang-tools-extra/clang-tidy/bugprone/SignalHandlerCheck.cpp Removed: diff --git a/clang-tools-extra/clang-tidy/bugprone/SignalHandlerCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SignalHandlerCheck.cpp index 37d373905b693..dcc01589f1162 100644 --- a/clang-tools-extra/clang-tidy/bugprone/SignalHandlerCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/SignalHandlerCheck.cpp @@ -335,12 +335,11 @@ void SignalHandlerCheck::registerMatchers(MatchFinder *Finder) { } void SignalHandlerCheck::check(const MatchFinder::MatchResult ) { - const auto *SignalCall = Result.Nodes.getNodeAs("register_call"); const auto *HandlerDecl = Result.Nodes.getNodeAs("handler_decl"); const auto *HandlerExpr = Result.Nodes.getNodeAs("handler_expr"); - assert(SignalCall && HandlerDecl && HandlerExpr && - "All of these should exist in a match here."); + assert(Result.Nodes.getNodeAs("register_call") && HandlerDecl && + HandlerExpr && "All of these should exist in a match here."); if (CG.size() <= 1) { // Call graph must be populated with the entire TU at the beginning. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 302fe7b - Remove libc++ test from clang lib.
Author: Benjamin Kramer Date: 2022-04-05T11:33:55+02:00 New Revision: 302fe7b3c40f7b949f3bebb74997bef9bf74d59f URL: https://github.com/llvm/llvm-project/commit/302fe7b3c40f7b949f3bebb74997bef9bf74d59f DIFF: https://github.com/llvm/llvm-project/commit/302fe7b3c40f7b949f3bebb74997bef9bf74d59f.diff LOG: Remove libc++ test from clang lib. This was added in 3ba8548c8e04bb301c4243887362c54bfbd4af8b Added: Modified: Removed: clang/lib/ExtractAPI/Serialization/ranges_transform.module.verify.cpp diff --git a/clang/lib/ExtractAPI/Serialization/ranges_transform.module.verify.cpp b/clang/lib/ExtractAPI/Serialization/ranges_transform.module.verify.cpp deleted file mode 100644 index 1eb0655124cb4..0 --- a/clang/lib/ExtractAPI/Serialization/ranges_transform.module.verify.cpp +++ /dev/null @@ -1,15 +0,0 @@ -//===--===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===--===// - -// REQUIRES: modules-build - -// WARNING: This test was generated by 'generate_private_header_tests.py' -// and should not be edited manually. - -// expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_transform.h'}} -#include <__algorithm/ranges_transform.h> ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 5d2ce76 - Use llvm::append_range instead of push_back loops where applicable. NFCI.
Author: Benjamin Kramer Date: 2022-03-18T01:25:34+01:00 New Revision: 5d2ce7663b10c107328a4ae0c678165209e64619 URL: https://github.com/llvm/llvm-project/commit/5d2ce7663b10c107328a4ae0c678165209e64619 DIFF: https://github.com/llvm/llvm-project/commit/5d2ce7663b10c107328a4ae0c678165209e64619.diff LOG: Use llvm::append_range instead of push_back loops where applicable. NFCI. Added: Modified: clang/include/clang/ASTMatchers/ASTMatchers.h clang/include/clang/ASTMatchers/ASTMatchersInternal.h clang/include/clang/Analysis/CloneDetection.h clang/include/clang/Tooling/DiagnosticsYaml.h clang/lib/AST/ASTContext.cpp clang/lib/AST/VTableBuilder.cpp clang/lib/Analysis/CFG.cpp clang/lib/CodeGen/CGBlocks.cpp clang/lib/CodeGen/CGCall.cpp clang/lib/CodeGen/CGNonTrivialStruct.cpp clang/lib/CodeGen/CGVTables.cpp clang/lib/CodeGen/CodeGenFunction.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/CodeGen/TargetInfo.cpp clang/lib/Driver/ToolChains/Hexagon.cpp clang/lib/Sema/SemaCUDA.cpp clang/lib/Sema/SemaCodeComplete.cpp clang/lib/Sema/SemaCoroutine.cpp clang/lib/Sema/SemaDecl.cpp clang/lib/Sema/SemaDeclCXX.cpp clang/lib/Sema/SemaOpenMP.cpp clang/lib/Sema/SemaOverload.cpp clang/lib/Sema/SemaTemplateInstantiateDecl.cpp clang/lib/Sema/SemaType.cpp clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTWriter.cpp clang/lib/Serialization/ASTWriterDecl.cpp llvm/include/llvm/ExecutionEngine/JITLink/MemoryFlags.h Removed: diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h index 6664a5bcfe7fb..c16bc5f0eafde 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchers.h +++ b/clang/include/clang/ASTMatchers/ASTMatchers.h @@ -7928,8 +7928,7 @@ AST_MATCHER_P(Stmt, forFunction, internal::Matcher, return true; } } else { - for (const auto : Finder->getASTContext().getParents(CurNode)) -Stack.push_back(Parent); + llvm::append_range(Stack, Finder->getASTContext().getParents(CurNode)); } } return false; @@ -7987,8 +7986,7 @@ AST_MATCHER_P(Stmt, forCallable, internal::Matcher, InnerMatcher) { return true; } } else { - for (const auto : Finder->getASTContext().getParents(CurNode)) -Stack.push_back(Parent); + llvm::append_range(Stack, Finder->getASTContext().getParents(CurNode)); } } return false; diff --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h index 5648c716c539e..49de9a458c3db 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h +++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h @@ -132,10 +132,7 @@ struct VariadicFunction { // We also allow calls with an already created array, in case the caller // already had it. ResultT operator()(ArrayRef Args) const { -SmallVector InnerArgs; -for (const ArgT : Args) - InnerArgs.push_back(); -return Func(InnerArgs); +return Func(llvm::to_vector<8>(llvm::make_pointer_range(Args))); } private: diff --git a/clang/include/clang/Analysis/CloneDetection.h b/clang/include/clang/Analysis/CloneDetection.h index b2911a5b44eb9..ffd496c5c9f65 100644 --- a/clang/include/clang/Analysis/CloneDetection.h +++ b/clang/include/clang/Analysis/CloneDetection.h @@ -208,13 +208,7 @@ class CloneDetector { // The initial assumption is that there is only one clone group and every // statement is a clone of the others. This clone group will then be // split up with the help of the constraints. -CloneGroup AllClones; -AllClones.reserve(Sequences.size()); -for (const auto : Sequences) { - AllClones.push_back(C); -} - -Result.push_back(AllClones); +Result.push_back(Sequences); constrainClones(Result, ConstraintList...); } diff --git a/clang/include/clang/Tooling/DiagnosticsYaml.h b/clang/include/clang/Tooling/DiagnosticsYaml.h index 3f257d84f8136..88f81e1f62999 100644 --- a/clang/include/clang/Tooling/DiagnosticsYaml.h +++ b/clang/include/clang/Tooling/DiagnosticsYaml.h @@ -42,8 +42,7 @@ template <> struct MappingTraits { Io.mapOptional("FileOffset", M.FileOffset); std::vector Fixes; for (auto : M.Fix) { - for (auto : Replacements.second) -Fixes.push_back(Replacement); + llvm::append_range(Fixes, Replacements.second); } Io.mapRequired("Replacements", Fixes); for (auto : Fixes) { diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 77b21746c83fc..3ba9f40a52a36 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -739,8 +739,8 @@ canonicalizeImmediatelyDeclaredConstraint(const ASTContext , Expr *IDC, // template concept C = true; // template T>
[clang] e44bbed - Make ParsedAttrInfo and subclasses use constexpr construction
Author: Benjamin Kramer Date: 2022-03-05T20:37:21+01:00 New Revision: e44bbedb3261e918dcbd77d271dcdf0c89a41ce0 URL: https://github.com/llvm/llvm-project/commit/e44bbedb3261e918dcbd77d271dcdf0c89a41ce0 DIFF: https://github.com/llvm/llvm-project/commit/e44bbedb3261e918dcbd77d271dcdf0c89a41ce0.diff LOG: Make ParsedAttrInfo and subclasses use constexpr construction This removes a 30 kB global initializer. NFCI. Added: Modified: clang/include/clang/Sema/ParsedAttr.h clang/utils/TableGen/ClangAttrEmitter.cpp Removed: diff --git a/clang/include/clang/Sema/ParsedAttr.h b/clang/include/clang/Sema/ParsedAttr.h index ef59e14b58c46..f8abb8cb119ba 100644 --- a/clang/include/clang/Sema/ParsedAttr.h +++ b/clang/include/clang/Sema/ParsedAttr.h @@ -74,12 +74,29 @@ struct ParsedAttrInfo { // The names of the known arguments of this attribute. ArrayRef ArgNames; - ParsedAttrInfo(AttributeCommonInfo::Kind AttrKind = - AttributeCommonInfo::NoSemaHandlerAttribute) - : AttrKind(AttrKind), NumArgs(0), OptArgs(0), HasCustomParsing(0), -IsTargetSpecific(0), IsType(0), IsStmt(0), IsKnownToGCC(0), -IsSupportedByPragmaAttribute(0) {} +protected: + constexpr ParsedAttrInfo(AttributeCommonInfo::Kind AttrKind = + AttributeCommonInfo::NoSemaHandlerAttribute) + : AttrKind(AttrKind), NumArgs(0), OptArgs(0), NumArgMembers(0), +HasCustomParsing(0), AcceptsExprPack(0), IsTargetSpecific(0), IsType(0), +IsStmt(0), IsKnownToGCC(0), IsSupportedByPragmaAttribute(0) {} + + constexpr ParsedAttrInfo(AttributeCommonInfo::Kind AttrKind, unsigned NumArgs, + unsigned OptArgs, unsigned NumArgMembers, + unsigned HasCustomParsing, unsigned AcceptsExprPack, + unsigned IsTargetSpecific, unsigned IsType, + unsigned IsStmt, unsigned IsKnownToGCC, + unsigned IsSupportedByPragmaAttribute, + ArrayRef Spellings, + ArrayRef ArgNames) + : AttrKind(AttrKind), NumArgs(NumArgs), OptArgs(OptArgs), +NumArgMembers(NumArgMembers), HasCustomParsing(HasCustomParsing), +AcceptsExprPack(AcceptsExprPack), IsTargetSpecific(IsTargetSpecific), +IsType(IsType), IsStmt(IsStmt), IsKnownToGCC(IsKnownToGCC), +IsSupportedByPragmaAttribute(IsSupportedByPragmaAttribute), +Spellings(Spellings), ArgNames(ArgNames) {} +public: virtual ~ParsedAttrInfo() = default; /// Check if this attribute appertains to D, and issue a diagnostic if not. diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp index 3a9df85b017b3..47c06cdd147cb 100644 --- a/clang/utils/TableGen/ClangAttrEmitter.cpp +++ b/clang/utils/TableGen/ClangAttrEmitter.cpp @@ -3577,9 +3577,9 @@ static void emitArgInfo(const Record , raw_ostream ) { // If there is a variadic argument, we will set the optional argument count // to its largest value. Since it's currently a 4-bit number, we set it to 15. - OS << "NumArgs = " << ArgCount << ";\n"; - OS << "OptArgs = " << (HasVariadic ? 15 : OptCount) << ";\n"; - OS << "NumArgMembers = " << ArgMemberCount << ";\n"; + OS << "/*NumArgs=*/" << ArgCount << ",\n"; + OS << "/*OptArgs=*/" << (HasVariadic ? 15 : OptCount) << ",\n"; + OS << "/*NumArgMembers=*/" << ArgMemberCount << ",\n"; } static std::string GetDiagnosticSpelling(const Record ) { @@ -4205,30 +4205,34 @@ void EmitClangAttrParsedAttrImpl(RecordKeeper , raw_ostream ) { OS << "struct ParsedAttrInfo" << I->first << " final : public ParsedAttrInfo {\n"; -OS << " ParsedAttrInfo" << I->first << "() {\n"; -OS << "AttrKind = ParsedAttr::AT_" << AttrName << ";\n"; +OS << " constexpr ParsedAttrInfo" << I->first << "() : ParsedAttrInfo(\n"; +OS << "/*AttrKind=*/ParsedAttr::AT_" << AttrName << ",\n"; emitArgInfo(Attr, OS); -OS << "HasCustomParsing = "; -OS << Attr.getValueAsBit("HasCustomParsing") << ";\n"; -OS << "AcceptsExprPack = "; -OS << Attr.getValueAsBit("AcceptsExprPack") << ";\n"; -OS << "IsTargetSpecific = "; -OS << Attr.isSubClassOf("TargetSpecificAttr") << ";\n"; -OS << "IsType = "; -OS << (Attr.isSubClassOf("TypeAttr") || - Attr.isSubClassOf("DeclOrTypeAttr")) << ";\n"; -OS << "IsStmt = "; +OS << "/*HasCustomParsing=*/"; +OS << Attr.getValueAsBit("HasCustomParsing") << ",\n"; +OS << "/*AcceptsExprPack=*/"; +OS << Attr.getValueAsBit("AcceptsExprPack") << ",\n"; +OS << "/*IsTargetSpecific=*/"; +OS << Attr.isSubClassOf("TargetSpecificAttr") << ",\n"; +OS << "/*IsType=*/"; +OS << (Attr.isSubClassOf("TypeAttr") ||
[clang] 14af99d - [OpenCL] Turn global vector into static array. NFCI.
Author: Benjamin Kramer Date: 2022-03-05T19:16:28+01:00 New Revision: 14af99d375b6c47e4b5ec457fb1f1f02b71a8566 URL: https://github.com/llvm/llvm-project/commit/14af99d375b6c47e4b5ec457fb1f1f02b71a8566 DIFF: https://github.com/llvm/llvm-project/commit/14af99d375b6c47e4b5ec457fb1f1f02b71a8566.diff LOG: [OpenCL] Turn global vector into static array. NFCI. Added: Modified: clang/include/clang/Basic/OpenCLOptions.h clang/lib/Basic/OpenCLOptions.cpp Removed: diff --git a/clang/include/clang/Basic/OpenCLOptions.h b/clang/include/clang/Basic/OpenCLOptions.h index 512bcb1e6ef10..d6cb1a210519d 100644 --- a/clang/include/clang/Basic/OpenCLOptions.h +++ b/clang/include/clang/Basic/OpenCLOptions.h @@ -212,15 +212,6 @@ class OpenCLOptions { bool isEnabled(llvm::StringRef Ext) const; OpenCLOptionInfoMap OptMap; - - // First feature in a pair requires the second one to be supported. - using FeatureDepEntry = std::pair; - using FeatureDepList = llvm::SmallVector; - - static const FeatureDepList DependentFeaturesList; - - // Extensions and equivalent feature pairs. - static const llvm::StringMap FeatureExtensionMap; }; } // end namespace clang diff --git a/clang/lib/Basic/OpenCLOptions.cpp b/clang/lib/Basic/OpenCLOptions.cpp index 7e89b3f1b804d..44edf54025405 100644 --- a/clang/lib/Basic/OpenCLOptions.cpp +++ b/clang/lib/Basic/OpenCLOptions.cpp @@ -12,14 +12,16 @@ namespace clang { -const OpenCLOptions::FeatureDepList OpenCLOptions::DependentFeaturesList = { +// First feature in a pair requires the second one to be supported. +static const std::pair DependentFeaturesList[] = { {"__opencl_c_read_write_images", "__opencl_c_images"}, {"__opencl_c_3d_image_writes", "__opencl_c_images"}, {"__opencl_c_pipes", "__opencl_c_generic_address_space"}, {"__opencl_c_device_enqueue", "__opencl_c_generic_address_space"}, {"__opencl_c_device_enqueue", "__opencl_c_program_scope_global_variables"}}; -const llvm::StringMap OpenCLOptions::FeatureExtensionMap = { +// Extensions and equivalent feature pairs. +static const std::pair FeatureExtensionMap[] = { {"cl_khr_fp64", "__opencl_c_fp64"}, {"cl_khr_3d_image_writes", "__opencl_c_3d_image_writes"}}; @@ -140,11 +142,11 @@ bool OpenCLOptions::diagnoseFeatureExtensionDifferences( bool IsValid = true; for (auto : FeatureExtensionMap) -if (TI.hasFeatureEnabled(OpenCLFeaturesMap, ExtAndFeat.getKey()) != -TI.hasFeatureEnabled(OpenCLFeaturesMap, ExtAndFeat.getValue())) { +if (TI.hasFeatureEnabled(OpenCLFeaturesMap, ExtAndFeat.first) != +TI.hasFeatureEnabled(OpenCLFeaturesMap, ExtAndFeat.second)) { IsValid = false; Diags.Report(diag::err_opencl_extension_and_feature_ diff ers) - << ExtAndFeat.getKey() << ExtAndFeat.getValue(); + << ExtAndFeat.first << ExtAndFeat.second; } return IsValid; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] a887b95 - [clang-format] Turn global COperatorsFollowingVar vector into a switch
Author: Benjamin Kramer Date: 2022-03-05T18:00:16+01:00 New Revision: a887b95edf34117b0274e5c9443ef6afa58b058a URL: https://github.com/llvm/llvm-project/commit/a887b95edf34117b0274e5c9443ef6afa58b058a DIFF: https://github.com/llvm/llvm-project/commit/a887b95edf34117b0274e5c9443ef6afa58b058a.diff LOG: [clang-format] Turn global COperatorsFollowingVar vector into a switch LLVM optimizes this into a bit test. NFCI. Added: Modified: clang/lib/Format/FormatToken.h clang/lib/Format/UnwrappedLineParser.cpp Removed: diff --git a/clang/lib/Format/FormatToken.h b/clang/lib/Format/FormatToken.h index e72df7d377823..b00b8ab7b927c 100644 --- a/clang/lib/Format/FormatToken.h +++ b/clang/lib/Format/FormatToken.h @@ -134,34 +134,6 @@ namespace format { TYPE(CSharpGenericTypeConstraintComma) \ TYPE(Unknown) -/// Sorted operators that can follow a C variable. -static const std::vector COperatorsFollowingVar = [] { - std::vector ReturnVal = { - tok::l_square, tok::r_square, - tok::l_paren, tok::r_paren, - tok::r_brace, tok::period, - tok::ellipsis, tok::ampamp, - tok::ampequal, tok::star, - tok::starequal,tok::plus, - tok::plusplus, tok::plusequal, - tok::minus,tok::arrow, - tok::minusminus, tok::minusequal, - tok::exclaim, tok::exclaimequal, - tok::slash,tok::slashequal, - tok::percent, tok::percentequal, - tok::less, tok::lessless, - tok::lessequal,tok::lesslessequal, - tok::greater, tok::greatergreater, - tok::greaterequal, tok::greatergreaterequal, - tok::caret,tok::caretequal, - tok::pipe, tok::pipepipe, - tok::pipeequal,tok::question, - tok::semi, tok::equal, - tok::equalequal, tok::comma}; - assert(std::is_sorted(ReturnVal.begin(), ReturnVal.end())); - return ReturnVal; -}(); - /// Determines the semantic type of a syntactic token, e.g. whether "<" is a /// template opener or binary operator. enum TokenType : uint8_t { diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 68b0e2a630bcd..646374c0cd626 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -2816,6 +2816,57 @@ void UnwrappedLineParser::parseSwitch() { NestedTooDeep.pop_back(); } +// Operators that can follow a C variable. +static bool isCOperatorFollowingVar(tok::TokenKind kind) { + switch (kind) { + case tok::ampamp: + case tok::ampequal: + case tok::arrow: + case tok::caret: + case tok::caretequal: + case tok::comma: + case tok::ellipsis: + case tok::equal: + case tok::equalequal: + case tok::exclaim: + case tok::exclaimequal: + case tok::greater: + case tok::greaterequal: + case tok::greatergreater: + case tok::greatergreaterequal: + case tok::l_paren: + case tok::l_square: + case tok::less: + case tok::lessequal: + case tok::lessless: + case tok::lesslessequal: + case tok::minus: + case tok::minusequal: + case tok::minusminus: + case tok::percent: + case tok::percentequal: + case tok::period: + case tok::pipe: + case tok::pipeequal: + case tok::pipepipe: + case tok::plus: + case tok::plusequal: + case tok::plusplus: + case tok::question: + case tok::r_brace: + case tok::r_paren: + case tok::r_square: + case tok::semi: + case tok::slash: + case tok::slashequal: + case tok::star: + case tok::starequal: +return true; + default: +return false; + } +} + void UnwrappedLineParser::parseAccessSpecifier() { FormatToken *AccessSpecifierCandidate = FormatTok; nextToken(); @@ -2827,9 +2878,7 @@ void UnwrappedLineParser::parseAccessSpecifier() { nextToken(); addUnwrappedLine(); } else if (!FormatTok->is(tok::coloncolon) && - !std::binary_search(COperatorsFollowingVar.begin(), - COperatorsFollowingVar.end(), - FormatTok->Tok.getKind())) { + !isCOperatorFollowingVar(FormatTok->Tok.getKind())) { // Not a variable name nor namespace name. addUnwrappedLine(); } else if (AccessSpecifierCandidate) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] 6c72a97 - [clangd] Qualify calls to std::move to silence -Wunqualified-std-cast-call. NFC.
Author: Benjamin Kramer Date: 2022-02-26T13:36:14+01:00 New Revision: 6c72a97c0e2d9dd884d67315629be1c219da3b34 URL: https://github.com/llvm/llvm-project/commit/6c72a97c0e2d9dd884d67315629be1c219da3b34 DIFF: https://github.com/llvm/llvm-project/commit/6c72a97c0e2d9dd884d67315629be1c219da3b34.diff LOG: [clangd] Qualify calls to std::move to silence -Wunqualified-std-cast-call. NFC. Added: Modified: clang-tools-extra/clangd/TUScheduler.cpp clang-tools-extra/clangd/index/dex/Dex.cpp clang-tools-extra/clangd/index/dex/Iterator.h clang-tools-extra/clangd/unittests/DexTests.cpp Removed: diff --git a/clang-tools-extra/clangd/TUScheduler.cpp b/clang-tools-extra/clangd/TUScheduler.cpp index 37baf9d3d862a..6aec87d197ed2 100644 --- a/clang-tools-extra/clangd/TUScheduler.cpp +++ b/clang-tools-extra/clangd/TUScheduler.cpp @@ -1504,7 +1504,7 @@ TUScheduler::TUScheduler(const GlobalCompilationDatabase , const Options , std::unique_ptr Callbacks) : CDB(CDB), Opts(Opts), - Callbacks(Callbacks ? move(Callbacks) + Callbacks(Callbacks ? std::move(Callbacks) : std::make_unique()), Barrier(Opts.AsyncThreadsCount), QuickRunBarrier(Opts.AsyncThreadsCount), IdleASTs( diff --git a/clang-tools-extra/clangd/index/dex/Dex.cpp b/clang-tools-extra/clangd/index/dex/Dex.cpp index 6975533c01f08..5829d780c6072 100644 --- a/clang-tools-extra/clangd/index/dex/Dex.cpp +++ b/clang-tools-extra/clangd/index/dex/Dex.cpp @@ -206,7 +206,7 @@ bool Dex::fuzzyFind(const FuzzyFindRequest , std::vector> TrigramIterators; for (const auto : TrigramTokens) TrigramIterators.push_back(iterator(Trigram)); - Criteria.push_back(Corpus.intersect(move(TrigramIterators))); + Criteria.push_back(Corpus.intersect(std::move(TrigramIterators))); // Generate scope tokens for search query. std::vector> ScopeIterators; @@ -215,7 +215,7 @@ bool Dex::fuzzyFind(const FuzzyFindRequest , if (Req.AnyScope) ScopeIterators.push_back( Corpus.boost(Corpus.all(), ScopeIterators.empty() ? 1.0 : 0.2)); - Criteria.push_back(Corpus.unionOf(move(ScopeIterators))); + Criteria.push_back(Corpus.unionOf(std::move(ScopeIterators))); // Add proximity paths boosting (all symbols, some boosted). Criteria.push_back(createFileProximityIterator(Req.ProximityPaths)); @@ -227,12 +227,12 @@ bool Dex::fuzzyFind(const FuzzyFindRequest , // Use TRUE iterator if both trigrams and scopes from the query are not // present in the symbol index. - auto Root = Corpus.intersect(move(Criteria)); + auto Root = Corpus.intersect(std::move(Criteria)); // Retrieve more items than it was requested: some of the items with high // final score might not be retrieved otherwise. // FIXME(kbobyrev): Tune this ratio. if (Req.Limit) -Root = Corpus.limit(move(Root), *Req.Limit * 100); +Root = Corpus.limit(std::move(Root), *Req.Limit * 100); SPAN_ATTACH(Tracer, "query", llvm::to_string(*Root)); vlog("Dex query tree: {0}", *Root); diff --git a/clang-tools-extra/clangd/index/dex/Iterator.h b/clang-tools-extra/clangd/index/dex/Iterator.h index 85661eed9fdfd..c7a5bae4adbba 100644 --- a/clang-tools-extra/clangd/index/dex/Iterator.h +++ b/clang-tools-extra/clangd/index/dex/Iterator.h @@ -124,8 +124,8 @@ inline void populateChildren(std::vector> &) {} template void populateChildren(std::vector> , std::unique_ptr Head, TailT... Tail) { - Children.push_back(move(Head)); - populateChildren(Children, move(Tail)...); + Children.push_back(std::move(Head)); + populateChildren(Children, std::move(Tail)...); } } // namespace detail @@ -178,7 +178,7 @@ class Corpus { std::unique_ptr intersect(Args... args) const { std::vector> Children; detail::populateChildren(Children, std::forward(args)...); -return intersect(move(Children)); +return intersect(std::move(Children)); } /// This allows unionOf(create(...), create(...)) syntax. @@ -186,7 +186,7 @@ class Corpus { std::unique_ptr unionOf(Args... args) const { std::vector> Children; detail::populateChildren(Children, std::forward(args)...); -return unionOf(move(Children)); +return unionOf(std::move(Children)); } }; diff --git a/clang-tools-extra/clangd/unittests/DexTests.cpp b/clang-tools-extra/clangd/unittests/DexTests.cpp index 17cf8de921d08..cafbfd324840c 100644 --- a/clang-tools-extra/clangd/unittests/DexTests.cpp +++ b/clang-tools-extra/clangd/unittests/DexTests.cpp @@ -252,7 +252,7 @@ TEST(DexIterators, StringRepresentation) { auto I2 = L1.iterator(); EXPECT_EQ(llvm::to_string(*I2), "T=L2"); - auto Tree = C.limit(C.intersect(move(I1), move(I2)), 10); + auto Tree = C.limit(C.intersect(std::move(I1), std::move(I2)), 10); // AND reorders its children, we don't care which
[clang-tools-extra] dfed8f5 - [clangd] Add a missing include. NFC.
Author: Benjamin Kramer Date: 2022-02-26T13:23:06+01:00 New Revision: dfed8f556d270cec0ac849ce1208671f33454534 URL: https://github.com/llvm/llvm-project/commit/dfed8f556d270cec0ac849ce1208671f33454534 DIFF: https://github.com/llvm/llvm-project/commit/dfed8f556d270cec0ac849ce1208671f33454534.diff LOG: [clangd] Add a missing include. NFC. Added: Modified: clang-tools-extra/clangd/index/dex/Trigram.h Removed: diff --git a/clang-tools-extra/clangd/index/dex/Trigram.h b/clang-tools-extra/clangd/index/dex/Trigram.h index f931004ebc223..3fe975e76fe88 100644 --- a/clang-tools-extra/clangd/index/dex/Trigram.h +++ b/clang-tools-extra/clangd/index/dex/Trigram.h @@ -26,6 +26,7 @@ #include "index/dex/Token.h" #include "llvm/ADT/bit.h" +#include #include namespace clang { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fb3a2d4 - [Sema] Silence unused variable warning in Release builds. NFC.
Author: Benjamin Kramer Date: 2022-02-24T11:00:52+01:00 New Revision: fb3a2d45cd79d3573dafcb7d26df355266b0228c URL: https://github.com/llvm/llvm-project/commit/fb3a2d45cd79d3573dafcb7d26df355266b0228c DIFF: https://github.com/llvm/llvm-project/commit/fb3a2d45cd79d3573dafcb7d26df355266b0228c.diff LOG: [Sema] Silence unused variable warning in Release builds. NFC. Added: Modified: clang/lib/Sema/SemaModule.cpp Removed: diff --git a/clang/lib/Sema/SemaModule.cpp b/clang/lib/Sema/SemaModule.cpp index 125dbefd9dd07..a797644754b59 100644 --- a/clang/lib/Sema/SemaModule.cpp +++ b/clang/lib/Sema/SemaModule.cpp @@ -484,6 +484,7 @@ DeclResult Sema::ActOnModuleImport(SourceLocation StartLoc, } else if (getLangOpts().isCompilingModule()) { Module *ThisModule = PP.getHeaderSearchInfo().lookupModule( getLangOpts().CurrentModule, ExportLoc, false, false); +(void)ThisModule; assert(ThisModule && "was expecting a module if building one"); } @@ -526,6 +527,7 @@ void Sema::BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod) { if (getLangOpts().isCompilingModule()) { Module *ThisModule = PP.getHeaderSearchInfo().lookupModule( getLangOpts().CurrentModule, DirectiveLoc, false, false); +(void)ThisModule; assert(ThisModule && "was expecting a module if building one"); } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] b32ead4 - Increase the limit on parser diagnostics
Author: Benjamin Kramer Date: 2022-02-21T11:44:48+01:00 New Revision: b32ead41b16af993918b14b243d08d04dcdcd4c9 URL: https://github.com/llvm/llvm-project/commit/b32ead41b16af993918b14b243d08d04dcdcd4c9 DIFF: https://github.com/llvm/llvm-project/commit/b32ead41b16af993918b14b243d08d04dcdcd4c9.diff LOG: Increase the limit on parser diagnostics We're really close to the limit $ grep -c DIAG tools/clang/include/clang/Basic/DiagnosticParseKinds.inc 598 Added: Modified: clang/include/clang/Basic/DiagnosticIDs.h Removed: diff --git a/clang/include/clang/Basic/DiagnosticIDs.h b/clang/include/clang/Basic/DiagnosticIDs.h index ba5f5acc8ce6..8139ffd375a2 100644 --- a/clang/include/clang/Basic/DiagnosticIDs.h +++ b/clang/include/clang/Basic/DiagnosticIDs.h @@ -34,7 +34,7 @@ namespace clang { DIAG_SIZE_FRONTEND = 150, DIAG_SIZE_SERIALIZATION = 120, DIAG_SIZE_LEX = 400, - DIAG_SIZE_PARSE = 600, + DIAG_SIZE_PARSE = 700, DIAG_SIZE_AST = 250, DIAG_SIZE_COMMENT = 100, DIAG_SIZE_CROSSTU = 100, ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] ce0fdf1 - Put back err_drv_negative_columns/err_drv_small_columns for flang
Author: Benjamin Kramer Date: 2022-02-20T15:42:20+01:00 New Revision: ce0fdf116334506bd5c4609ab86111f8136a1408 URL: https://github.com/llvm/llvm-project/commit/ce0fdf116334506bd5c4609ab86111f8136a1408 DIFF: https://github.com/llvm/llvm-project/commit/ce0fdf116334506bd5c4609ab86111f8136a1408.diff LOG: Put back err_drv_negative_columns/err_drv_small_columns for flang These are unused by Clang, but Flang references them. Added: Modified: clang/include/clang/Basic/DiagnosticDriverKinds.td Removed: diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td index 276e83434d03..b608b8ec5068 100644 --- a/clang/include/clang/Basic/DiagnosticDriverKinds.td +++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -323,6 +323,10 @@ def err_drv_unsupported_embed_bitcode : Error<"%0 is not supported with -fembed-bitcode">; def err_drv_bitcode_unsupported_on_toolchain : Error< "-fembed-bitcode is not supported on versions of iOS prior to 6.0">; +def err_drv_negative_columns : Error< + "invalid value '%1' in '%0', value must be 'none' or a positive integer">; +def err_drv_small_columns : Error< + "invalid value '%1' in '%0', value must be '%2' or greater">; def err_drv_invalid_malign_branch_EQ : Error< "invalid argument '%0' to -malign-branch=; each element must be one of: %1">; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] 3a1d6a3 - [clangd] Remove uuidof warning. Clang never emits this one.
Author: Benjamin Kramer Date: 2022-02-20T14:44:47+01:00 New Revision: 3a1d6a361c822173abd87ff47fd8613892fc747f URL: https://github.com/llvm/llvm-project/commit/3a1d6a361c822173abd87ff47fd8613892fc747f DIFF: https://github.com/llvm/llvm-project/commit/3a1d6a361c822173abd87ff47fd8613892fc747f.diff LOG: [clangd] Remove uuidof warning. Clang never emits this one. Added: Modified: clang-tools-extra/clangd/IncludeFixer.cpp Removed: diff --git a/clang-tools-extra/clangd/IncludeFixer.cpp b/clang-tools-extra/clangd/IncludeFixer.cpp index 1f0515c1df702..7994e5f499200 100644 --- a/clang-tools-extra/clangd/IncludeFixer.cpp +++ b/clang-tools-extra/clangd/IncludeFixer.cpp @@ -224,8 +224,6 @@ std::vector IncludeFixer::fix(DiagnosticsEngine::Level DiagLevel, return only(insertHeader("")); case diag::err_need_header_before_typeid: return only(insertHeader("")); - case diag::err_need_header_before_ms_uuidof: -return only(insertHeader("")); case diag::err_need_header_before_placement_new: case diag::err_implicit_coroutine_std_nothrow_type_not_found: return only(insertHeader("")); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 52fcdc8 - Prune unused diagnostics. NFC.
Author: Benjamin Kramer Date: 2022-02-20T14:06:58+01:00 New Revision: 52fcdc8d69d20b48fb5266b00f505dc89b19be9b URL: https://github.com/llvm/llvm-project/commit/52fcdc8d69d20b48fb5266b00f505dc89b19be9b DIFF: https://github.com/llvm/llvm-project/commit/52fcdc8d69d20b48fb5266b00f505dc89b19be9b.diff LOG: Prune unused diagnostics. NFC. Added: Modified: clang/include/clang/Basic/DiagnosticASTKinds.td clang/include/clang/Basic/DiagnosticDriverKinds.td clang/include/clang/Basic/DiagnosticSemaKinds.td Removed: diff --git a/clang/include/clang/Basic/DiagnosticASTKinds.td b/clang/include/clang/Basic/DiagnosticASTKinds.td index a89bdff1a10c2..56662bcd0cc25 100644 --- a/clang/include/clang/Basic/DiagnosticASTKinds.td +++ b/clang/include/clang/Basic/DiagnosticASTKinds.td @@ -439,8 +439,6 @@ def note_odr_tag_kind_here: Note< def note_odr_field : Note<"field %0 has type %1 here">; def note_odr_field_name : Note<"field has name %0 here">; def note_odr_missing_field : Note<"no corresponding field here">; -def note_odr_bit_field : Note<"bit-field %0 with type %1 and length %2 here">; -def note_odr_not_bit_field : Note<"field %0 is not a bit-field">; def note_odr_base : Note<"class has base type %0">; def note_odr_virtual_base : Note< "%select{non-virtual|virtual}0 derivation here">; diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td index b688c121b1c07..276e83434d030 100644 --- a/clang/include/clang/Basic/DiagnosticDriverKinds.td +++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -29,8 +29,6 @@ def err_drv_invalid_arch_name : Error< "invalid arch name '%0'">; def err_drv_invalid_riscv_arch_name : Error< "invalid arch name '%0', %1">; -def err_drv_invalid_riscv_ext_arch_name : Error< - "invalid arch name '%0', %1 '%2'">; def warn_drv_invalid_arch_name_with_suggestion : Warning< "ignoring invalid /arch: argument '%0'; for %select{64|32}1-bit expected one of %2">, InGroup; @@ -302,7 +300,6 @@ def err_drv_optimization_remark_format : Error< "unknown remark serializer format: '%0'">; def err_drv_no_neon_modifier : Error<"[no]neon is not accepted as modifier, please use [no]simd instead">; def err_drv_invalid_omp_target : Error<"OpenMP target is invalid: '%0'">; -def err_drv_debug_no_new_runtime : Error<"OpenMP target device debugging enabled with incompatible runtime">; def err_drv_incompatible_omp_arch : Error<"OpenMP target architecture '%0' pointer size is incompatible with host '%1'">; def err_drv_omp_host_ir_file_not_found : Error< "provided host compiler IR file '%0' is required to generate code for OpenMP " @@ -326,10 +323,6 @@ def err_drv_unsupported_embed_bitcode : Error<"%0 is not supported with -fembed-bitcode">; def err_drv_bitcode_unsupported_on_toolchain : Error< "-fembed-bitcode is not supported on versions of iOS prior to 6.0">; -def err_drv_negative_columns : Error< -"invalid value '%1' in '%0', value must be 'none' or a positive integer">; -def err_drv_small_columns : Error< -"invalid value '%1' in '%0', value must be '%2' or greater">; def err_drv_invalid_malign_branch_EQ : Error< "invalid argument '%0' to -malign-branch=; each element must be one of: %1">; @@ -531,7 +524,6 @@ def warn_drv_ps4_sdk_dir : Warning< "environment variable SCE_ORBIS_SDK_DIR is set, but points to invalid or nonexistent directory '%0'">, InGroup; -def err_drv_unsupported_linker : Error<"unsupported value '%0' for -linker option">; def err_drv_defsym_invalid_format : Error<"defsym must be of the form: sym=value: %0">; def err_drv_defsym_invalid_symval : Error<"value is not an integer: %0">; def warn_drv_msvc_not_found : Warning< diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 8af1bed7b67f1..1719db4871ff3 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -556,9 +556,6 @@ def err_using_decl_can_not_refer_to_class_member : Error< def warn_cxx17_compat_using_decl_class_member_enumerator : Warning< "member using declaration naming a non-member enumerator is incompatible " "with C++ standards before C++20">, InGroup, DefaultIgnore; -def ext_using_decl_class_member_enumerator : ExtWarn< - "member using declaration naming a non-member enumerator is " - "a C++20 extension">, InGroup; def err_using_enum_is_dependent : Error< "using-enum cannot name a dependent type">; def err_ambiguous_inherited_constructor : Error< @@ -1696,8 +1693,6 @@ def err_missing_exception_specification : Error< def ext_missing_exception_specification : ExtWarn< err_missing_exception_specification.Text>, InGroup>; -def err_noexcept_needs_constant_expression : Error< - "argument to noexcept specifier must be a constant expression">; def
[clang] 51c0650 - Unionize clang::DynTypedNodeList. NFC.
Author: Benjamin Kramer Date: 2022-02-20T12:12:39+01:00 New Revision: 51c0650f6ba8128fb07036b4be8512bb5f727c1a URL: https://github.com/llvm/llvm-project/commit/51c0650f6ba8128fb07036b4be8512bb5f727c1a DIFF: https://github.com/llvm/llvm-project/commit/51c0650f6ba8128fb07036b4be8512bb5f727c1a.diff LOG: Unionize clang::DynTypedNodeList. NFC. Added: Modified: clang/include/clang/AST/ParentMapContext.h Removed: diff --git a/clang/include/clang/AST/ParentMapContext.h b/clang/include/clang/AST/ParentMapContext.h index 2edbc987850d2..3c2e2f9640ca3 100644 --- a/clang/include/clang/AST/ParentMapContext.h +++ b/clang/include/clang/AST/ParentMapContext.h @@ -90,29 +90,27 @@ class TraversalKindScope { /// Container for either a single DynTypedNode or for an ArrayRef to /// DynTypedNode. For use with ParentMap. class DynTypedNodeList { - llvm::AlignedCharArrayUnion> Storage; + union { +DynTypedNode SingleNode; +ArrayRef Nodes; + }; bool IsSingleNode; public: DynTypedNodeList(const DynTypedNode ) : IsSingleNode(true) { -new () DynTypedNode(N); +new () DynTypedNode(N); } DynTypedNodeList(ArrayRef A) : IsSingleNode(false) { -new () ArrayRef(A); +new () ArrayRef(A); } const DynTypedNode *begin() const { -if (!IsSingleNode) - return reinterpret_cast *>() - ->begin(); -return reinterpret_cast(); +return !IsSingleNode ? Nodes.begin() : } const DynTypedNode *end() const { -if (!IsSingleNode) - return reinterpret_cast *>()->end(); -return reinterpret_cast() + 1; +return !IsSingleNode ? Nodes.end() : + 1; } size_t size() const { return end() - begin(); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 012c811 - [Clang][Sema][OpenMP] Remove unused variables. NFC.
Author: Benjamin Kramer Date: 2022-02-04T19:27:59+01:00 New Revision: 012c811fed44da85f9870df9accf4477e626a012 URL: https://github.com/llvm/llvm-project/commit/012c811fed44da85f9870df9accf4477e626a012 DIFF: https://github.com/llvm/llvm-project/commit/012c811fed44da85f9870df9accf4477e626a012.diff LOG: [Clang][Sema][OpenMP] Remove unused variables. NFC. Added: Modified: clang/lib/Sema/SemaOpenMP.cpp Removed: diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 1fafd58ba3ed..4143e070a873 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -11369,8 +11369,6 @@ StmtResult Sema::ActOnOpenMPAtomicDirective(ArrayRef Clauses, Expr *V = nullptr; Expr *E = nullptr; Expr *UE = nullptr; - Expr *D = nullptr; - Expr *CE = nullptr; bool IsXLHSInRHSPart = false; bool IsPostfixUpdate = false; // OpenMP [2.12.6, atomic Construct] ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 9a6b0af - Don't rely on clang being named clang in test
Author: Benjamin Kramer Date: 2022-01-31T13:50:57+01:00 New Revision: 9a6b0afbe18d3abdc17d6208daecb8839b994e4a URL: https://github.com/llvm/llvm-project/commit/9a6b0afbe18d3abdc17d6208daecb8839b994e4a DIFF: https://github.com/llvm/llvm-project/commit/9a6b0afbe18d3abdc17d6208daecb8839b994e4a.diff LOG: Don't rely on clang being named clang in test Added: Modified: clang/test/Driver/cuda-device-triple.cu Removed: diff --git a/clang/test/Driver/cuda-device-triple.cu b/clang/test/Driver/cuda-device-triple.cu index d8e464293d34e..02574dcf91d9e 100644 --- a/clang/test/Driver/cuda-device-triple.cu +++ b/clang/test/Driver/cuda-device-triple.cu @@ -3,4 +3,4 @@ // RUN: %clang -### -emit-llvm --cuda-device-only \ // RUN: -nocudalib -nocudainc --offload=spirv32-unknown-unknown -c %s 2>&1 | FileCheck %s -// CHECK: clang{{.*}}" "-cc1" "-triple" "spirv32-unknown-unknown" {{.*}} "-fcuda-is-device" {{.*}} +// CHECK: "-cc1" "-triple" "spirv32-unknown-unknown" {{.*}} "-fcuda-is-device" {{.*}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] e07823a - [clang-tidy] Make header compile standalone. NFC.
Author: Benjamin Kramer Date: 2022-01-31T11:18:00+01:00 New Revision: e07823ad729a16c609e9e234849f56bf9f1d5f00 URL: https://github.com/llvm/llvm-project/commit/e07823ad729a16c609e9e234849f56bf9f1d5f00 DIFF: https://github.com/llvm/llvm-project/commit/e07823ad729a16c609e9e234849f56bf9f1d5f00.diff LOG: [clang-tidy] Make header compile standalone. NFC. Added: Modified: clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprMatchers.h Removed: diff --git a/clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprMatchers.h b/clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprMatchers.h index 62fc9cfcaa1d3..0b11b0d1e6b4c 100644 --- a/clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprMatchers.h +++ b/clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprMatchers.h @@ -6,6 +6,7 @@ // //===--===// +#include "clang/ASTMatchers/ASTMatchersInternal.h" #include "clang/ASTMatchers/ASTMatchersMacros.h" namespace clang { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] b810244 - [clang-tidy] Avoid binding nullptr to a reference
Author: Benjamin Kramer Date: 2022-01-21T15:55:17+01:00 New Revision: b8102449a72c5144cb75cfca46e78b517d7f6606 URL: https://github.com/llvm/llvm-project/commit/b8102449a72c5144cb75cfca46e78b517d7f6606 DIFF: https://github.com/llvm/llvm-project/commit/b8102449a72c5144cb75cfca46e78b517d7f6606.diff LOG: [clang-tidy] Avoid binding nullptr to a reference That's undefined behavior. Found by -fsanitize=null. Added: Modified: clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp Removed: diff --git a/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp b/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp index 0e91451211aed..6e7d28b2974f7 100644 --- a/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp +++ b/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp @@ -68,9 +68,9 @@ void MoveConstArgCheck::registerMatchers(MatchFinder *Finder) { } bool IsRValueReferenceParam(const Expr *Invocation, -const QualType , +const QualType *InvocationParmType, const Expr *Arg) { - if (Invocation && InvocationParmType->isRValueReferenceType() && + if (Invocation && (*InvocationParmType)->isRValueReferenceType() && Arg->isLValue()) { if (!Invocation->getType()->isRecordType()) return true; @@ -138,7 +138,7 @@ void MoveConstArgCheck::check(const MatchFinder::MatchResult ) { // std::move shouldn't be removed when an lvalue wrapped by std::move is // passed to the function with an rvalue reference parameter. bool IsRVRefParam = -IsRValueReferenceParam(ReceivingExpr, *InvocationParmType, Arg); +IsRValueReferenceParam(ReceivingExpr, InvocationParmType, Arg); const auto *Var = IsVariable ? dyn_cast(Arg)->getDecl() : nullptr; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 765dd8b - [CGBuiltin] Simplify code. NFCI.
Author: Benjamin Kramer Date: 2022-01-14T16:02:02+01:00 New Revision: 765dd8b8a44cd9689c87c0433739f421b9871061 URL: https://github.com/llvm/llvm-project/commit/765dd8b8a44cd9689c87c0433739f421b9871061 DIFF: https://github.com/llvm/llvm-project/commit/765dd8b8a44cd9689c87c0433739f421b9871061.diff LOG: [CGBuiltin] Simplify code. NFCI. Added: Modified: clang/lib/CodeGen/CGBuiltin.cpp Removed: diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index f68b7d3260e1..f9633f875b61 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -18462,15 +18462,11 @@ Value *CodeGenFunction::EmitWebAssemblyBuiltinExpr(unsigned BuiltinID, llvm_unreachable("unexpected builtin ID"); } llvm::Type *SrcT = Vec->getType(); -llvm::Type *TruncT = -SrcT->getWithNewType(llvm::IntegerType::get(getLLVMContext(), 32)); +llvm::Type *TruncT = SrcT->getWithNewType(Builder.getInt32Ty()); Function *Callee = CGM.getIntrinsic(IntNo, {TruncT, SrcT}); Value *Trunc = Builder.CreateCall(Callee, Vec); -Value *Splat = Builder.CreateVectorSplat(2, Builder.getInt32(0)); -Value *ConcatMask = -llvm::ConstantVector::get({Builder.getInt32(0), Builder.getInt32(1), - Builder.getInt32(2), Builder.getInt32(3)}); -return Builder.CreateShuffleVector(Trunc, Splat, ConcatMask); +Value *Splat = Constant::getNullValue(TruncT); +return Builder.CreateShuffleVector(Trunc, Splat, ArrayRef{0, 1, 2, 3}); } case WebAssembly::BI__builtin_wasm_shuffle_i8x16: { Value *Ops[18]; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] afc14a0 - Retire llvm::make_reverse_iterator in favor of std::make_reverse_iterator
Author: Benjamin Kramer Date: 2022-01-05T14:07:08+01:00 New Revision: afc14a0d1767d9f9dc1b9d81a2f76916ba2bab61 URL: https://github.com/llvm/llvm-project/commit/afc14a0d1767d9f9dc1b9d81a2f76916ba2bab61 DIFF: https://github.com/llvm/llvm-project/commit/afc14a0d1767d9f9dc1b9d81a2f76916ba2bab61.diff LOG: Retire llvm::make_reverse_iterator in favor of std::make_reverse_iterator std::make_reverse_iterator is a C++14 feature, gcc has it since GCC 5.1. Added: Modified: clang/include/clang/Analysis/CFG.h clang/tools/clang-scan-deps/ClangScanDeps.cpp lld/ELF/Writer.cpp llvm/include/llvm/ADT/STLExtras.h llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h Removed: diff --git a/clang/include/clang/Analysis/CFG.h b/clang/include/clang/Analysis/CFG.h index b8e453fcc235a..c5512a7e14998 100644 --- a/clang/include/clang/Analysis/CFG.h +++ b/clang/include/clang/Analysis/CFG.h @@ -707,7 +707,7 @@ class CFGBlock { template ElementRefIterator(ElementRefIterator E) -: ElementRefIterator(E.Parent, llvm::make_reverse_iterator(E.Pos)) {} +: ElementRefIterator(E.Parent, std::make_reverse_iterator(E.Pos)) {} bool operator<(ElementRefIterator Other) const { assert(Parent == Other.Parent); diff --git a/clang/tools/clang-scan-deps/ClangScanDeps.cpp b/clang/tools/clang-scan-deps/ClangScanDeps.cpp index 4d61e37db29bd..49cc97b27046f 100644 --- a/clang/tools/clang-scan-deps/ClangScanDeps.cpp +++ b/clang/tools/clang-scan-deps/ClangScanDeps.cpp @@ -480,7 +480,7 @@ int main(int argc, const char **argv) { llvm::is_contained(Args, "--driver-mode=cl"); // Reverse scan, starting at the end or at the element before "--". - auto R = llvm::make_reverse_iterator(FlagsEnd); + auto R = std::make_reverse_iterator(FlagsEnd); for (auto I = R, E = Args.rend(); I != E; ++I) { StringRef Arg = *I; if (ClangCLMode) { diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 6527493f1b1fd..9db997cddfbe3 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1212,9 +1212,9 @@ findOrphanPos(SmallVectorImpl::iterator b, auto *os = dyn_cast(cmd); return os && os->hasInputSections; }; - auto j = std::find_if(llvm::make_reverse_iterator(i), -llvm::make_reverse_iterator(b), -isOutputSecWithInputSections); + auto j = + std::find_if(std::make_reverse_iterator(i), std::make_reverse_iterator(b), + isOutputSecWithInputSections); i = j.base(); // As a special case, if the orphan section is the last section, put diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h index 2d38e153c79e0..ed5321821a3a2 100644 --- a/llvm/include/llvm/ADT/STLExtras.h +++ b/llvm/include/llvm/ADT/STLExtras.h @@ -416,20 +416,14 @@ auto reverse(ContainerTy &, return make_range(C.rbegin(), C.rend()); } -// Returns a std::reverse_iterator wrapped around the given iterator. -template -std::reverse_iterator make_reverse_iterator(IteratorTy It) { - return std::reverse_iterator(It); -} - // Returns an iterator_range over the given container which iterates in reverse. // Note that the container must have begin()/end() methods which return // bidirectional iterators for this to work. template auto reverse(ContainerTy &, std::enable_if_t::value> * = nullptr) { - return make_range(llvm::make_reverse_iterator(std::end(C)), -llvm::make_reverse_iterator(std::begin(C))); + return make_range(std::make_reverse_iterator(std::end(C)), +std::make_reverse_iterator(std::begin(C))); } /// An iterator adaptor that filters the elements of given inner iterators. diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h index 8f93ebc4ebc0b..0d4fe9aec8d03 100644 --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h @@ -463,11 +463,11 @@ inline bool operator!=(const std::reverse_iterator , } inline std::reverse_iterator DWARFDie::rbegin() const { - return llvm::make_reverse_iterator(end()); + return std::make_reverse_iterator(end()); } inline std::reverse_iterator DWARFDie::rend() const { - return llvm::make_reverse_iterator(begin()); + return std::make_reverse_iterator(begin()); } } // end namespace llvm ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] cff1927 - [clang-include-fixer] Fix incorrect ranking because of dangling references
Author: Danila Kutenin Date: 2021-12-20T15:56:57+01:00 New Revision: cff192739bb6dd67b2ec58f055af2ae2834c4348 URL: https://github.com/llvm/llvm-project/commit/cff192739bb6dd67b2ec58f055af2ae2834c4348 DIFF: https://github.com/llvm/llvm-project/commit/cff192739bb6dd67b2ec58f055af2ae2834c4348.diff LOG: [clang-include-fixer] Fix incorrect ranking because of dangling references SymbolAndSignals stores SymbolInfo which stores two std::strings. Then the values are stored in a llvm::DenseMap. When the sorting is happening, SymbolAndSignals are swapped and thus because of small string optimization some strings may become invalid. This results in incorrect ranking. This was detected when running new std::sort algorithm against llvm toolchain. This could have been prevented with running llvm::sort and EXPENSIVE_CHECKS. Unfortunately, no sanitizer yelled. I don't have commit rights, kutdan...@yandex.ru Danila Kutenin Reviewed By: bkramer Differential Revision: https://reviews.llvm.org/D116037 Added: Modified: clang-tools-extra/clang-include-fixer/SymbolIndexManager.cpp Removed: diff --git a/clang-tools-extra/clang-include-fixer/SymbolIndexManager.cpp b/clang-tools-extra/clang-include-fixer/SymbolIndexManager.cpp index cbd79b64eae09..ebb4a70c1f8db 100644 --- a/clang-tools-extra/clang-include-fixer/SymbolIndexManager.cpp +++ b/clang-tools-extra/clang-include-fixer/SymbolIndexManager.cpp @@ -8,8 +8,9 @@ #include "SymbolIndexManager.h" #include "find-all-symbols/SymbolInfo.h" -#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringMap.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Path.h" @@ -47,7 +48,7 @@ static double similarityScore(llvm::StringRef FileName, static void rank(std::vector , llvm::StringRef FileName) { - llvm::DenseMap Score; + llvm::StringMap Score; for (const auto : Symbols) { // Calculate a score from the similarity of the header the symbol is in // with the current file and the popularity of the symbol. @@ -58,14 +59,14 @@ static void rank(std::vector , } // Sort by the gathered scores. Use file name as a tie breaker so we can // deduplicate. - std::sort(Symbols.begin(), Symbols.end(), -[&](const SymbolAndSignals , const SymbolAndSignals ) { - auto AS = Score[A.Symbol.getFilePath()]; - auto BS = Score[B.Symbol.getFilePath()]; - if (AS != BS) -return AS > BS; - return A.Symbol.getFilePath() < B.Symbol.getFilePath(); -}); + llvm::sort(Symbols.begin(), Symbols.end(), + [&](const SymbolAndSignals , const SymbolAndSignals ) { + auto AS = Score[A.Symbol.getFilePath()]; + auto BS = Score[B.Symbol.getFilePath()]; + if (AS != BS) + return AS > BS; + return A.Symbol.getFilePath() < B.Symbol.getFilePath(); + }); } std::vector ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 4c7de4f - Thread safety analysis: Remove unused variable. NFC.
Author: Benjamin Kramer Date: 2021-12-09T18:57:43+01:00 New Revision: 4c7de4fbda03f38514c4aebed34dc2bbfb7e62a5 URL: https://github.com/llvm/llvm-project/commit/4c7de4fbda03f38514c4aebed34dc2bbfb7e62a5 DIFF: https://github.com/llvm/llvm-project/commit/4c7de4fbda03f38514c4aebed34dc2bbfb7e62a5.diff LOG: Thread safety analysis: Remove unused variable. NFC. Added: Modified: clang/lib/Analysis/ThreadSafety.cpp Removed: diff --git a/clang/lib/Analysis/ThreadSafety.cpp b/clang/lib/Analysis/ThreadSafety.cpp index b196ffa73cbfb..9cc990bd35a3f 100644 --- a/clang/lib/Analysis/ThreadSafety.cpp +++ b/clang/lib/Analysis/ThreadSafety.cpp @@ -418,7 +418,6 @@ class LocalVariableMap { private: Context::Factory ContextFactory; std::vector VarDefinitions; - std::vector CtxIndices; std::vector> SavedContexts; public: @@ -731,8 +730,6 @@ void LocalVariableMap::traverseCFG(CFG *CFGraph, std::vector ) { PostOrderCFGView::CFGBlockSet VisitedBlocks(CFGraph); - CtxIndices.resize(CFGraph->getNumBlockIDs()); - for (const auto *CurrBlock : *SortedGraph) { unsigned CurrBlockID = CurrBlock->getBlockID(); CFGBlockInfo *CurrBlockInfo = [CurrBlockID]; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fd1d8e4 - [clang][dataflow] Make header parse
Author: Benjamin Kramer Date: 2021-11-30T17:53:19+01:00 New Revision: fd1d8e45f488b28db8d63ab51733ddd1e37e751c URL: https://github.com/llvm/llvm-project/commit/fd1d8e45f488b28db8d63ab51733ddd1e37e751c DIFF: https://github.com/llvm/llvm-project/commit/fd1d8e45f488b28db8d63ab51733ddd1e37e751c.diff LOG: [clang][dataflow] Make header parse Looks like this is actually dead code? Added: Modified: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h Removed: diff --git a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h index 975d618e99edc..a5d4a5d6ba407 100644 --- a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h +++ b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h @@ -60,7 +60,7 @@ class DataflowAnalysis : public TypeErasedDataflowAnalysis { ASTContext () final { return Context; } - AnyLatticeElement typeErasedInitialElement() final { + TypeErasedLattice typeErasedInitialElement() final { return {static_cast(this)->initialElement()}; } @@ -78,8 +78,8 @@ class DataflowAnalysis : public TypeErasedDataflowAnalysis { return L1 == L2; } - AnyLatticeElement transferTypeErased(const Stmt *Stmt, - const AnyLatticeElement , + TypeErasedLattice transferTypeErased(const Stmt *Stmt, + const TypeErasedLattice , Environment ) final { const Lattice = llvm::any_cast(E.Value); return {static_cast(this)->transfer(Stmt, L, Env)}; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 98f80d2 - [Driver] Fix unused variable warning in release builds. NFC.
Author: Benjamin Kramer Date: 2021-11-12T00:20:21+01:00 New Revision: 98f80d248d9c888c2219454c1f655bc324b80cdc URL: https://github.com/llvm/llvm-project/commit/98f80d248d9c888c2219454c1f655bc324b80cdc DIFF: https://github.com/llvm/llvm-project/commit/98f80d248d9c888c2219454c1f655bc324b80cdc.diff LOG: [Driver] Fix unused variable warning in release builds. NFC. Added: Modified: clang/lib/Driver/ToolChains/HIP.cpp Removed: diff --git a/clang/lib/Driver/ToolChains/HIP.cpp b/clang/lib/Driver/ToolChains/HIP.cpp index 1b77e275200d..07af1a0457c7 100644 --- a/clang/lib/Driver/ToolChains/HIP.cpp +++ b/clang/lib/Driver/ToolChains/HIP.cpp @@ -64,6 +64,7 @@ static bool shouldSkipSanitizeOption(const ToolChain , auto OptionalGpuArch = parseTargetID(TC.getTriple(), TargetID, ); assert(OptionalGpuArch && "Invalid Target ID"); + (void)OptionalGpuArch; auto Loc = FeatureMap.find("xnack"); if (Loc == FeatureMap.end() || !Loc->second) { Diags.Report( ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] d398e8f - [ASTMatcher] Provide a definition for the lambdaCapture matcher
Author: Benjamin Kramer Date: 2021-11-08T20:26:37+01:00 New Revision: d398e8f170fa9b11a13707b8ccc2a278653d374b URL: https://github.com/llvm/llvm-project/commit/d398e8f170fa9b11a13707b8ccc2a278653d374b DIFF: https://github.com/llvm/llvm-project/commit/d398e8f170fa9b11a13707b8ccc2a278653d374b.diff LOG: [ASTMatcher] Provide a definition for the lambdaCapture matcher This is an empty object, but depending on your optimizer settings the compiler may emit a reference to the symbol. Added: Modified: clang/lib/ASTMatchers/ASTMatchersInternal.cpp Removed: diff --git a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp index b7622e3b51f1e..7680eb38283e7 100644 --- a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp +++ b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp @@ -768,6 +768,7 @@ const internal::VariadicDynCastAllOfMatcher const internal::VariadicDynCastAllOfMatcher templateTemplateParmDecl; +const internal::VariadicAllOfMatcher lambdaCapture; const internal::VariadicAllOfMatcher qualType; const internal::VariadicAllOfMatcher type; const internal::VariadicAllOfMatcher typeLoc; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 2e20ff8 - [AVR] Remove a global initializer. NFCI.
Author: Benjamin Kramer Date: 2021-11-07T16:30:18+01:00 New Revision: 2e20ff8c1ab42ccfe102589114587008b411397f URL: https://github.com/llvm/llvm-project/commit/2e20ff8c1ab42ccfe102589114587008b411397f DIFF: https://github.com/llvm/llvm-project/commit/2e20ff8c1ab42ccfe102589114587008b411397f.diff LOG: [AVR] Remove a global initializer. NFCI. Added: Modified: clang/lib/Driver/ToolChains/AVR.cpp Removed: diff --git a/clang/lib/Driver/ToolChains/AVR.cpp b/clang/lib/Driver/ToolChains/AVR.cpp index 896afcc3474a4..a66cae8b4d6b2 100644 --- a/clang/lib/Driver/ToolChains/AVR.cpp +++ b/clang/lib/Driver/ToolChains/AVR.cpp @@ -28,9 +28,9 @@ using namespace llvm::opt; namespace { -const struct { +constexpr struct { StringRef Name; - std::string SubPath; + StringRef SubPath; StringRef Family; unsigned DataAddr; } MCUInfo[] = { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 8adb6d6 - [clang] Use llvm::reverse. NFCI.
Author: Benjamin Kramer Date: 2021-11-07T14:24:33+01:00 New Revision: 8adb6d6de29b67dd0df1016083392a1b2eb1d49a URL: https://github.com/llvm/llvm-project/commit/8adb6d6de29b67dd0df1016083392a1b2eb1d49a DIFF: https://github.com/llvm/llvm-project/commit/8adb6d6de29b67dd0df1016083392a1b2eb1d49a.diff LOG: [clang] Use llvm::reverse. NFCI. Added: Modified: clang/lib/AST/Decl.cpp clang/lib/CodeGen/CGExpr.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/Lex/ModuleMap.cpp clang/lib/Sema/CodeCompleteConsumer.cpp Removed: diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 32dae5ccad3a9..5ea091edcf4c9 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -1663,8 +1663,7 @@ void NamedDecl::printNestedNameSpecifier(raw_ostream , NameInScope = ND->getDeclName(); } - for (unsigned I = Contexts.size(); I != 0; --I) { -const DeclContext *DC = Contexts[I - 1]; + for (const DeclContext *DC : llvm::reverse(Contexts)) { if (const auto *Spec = dyn_cast(DC)) { OS << Spec->getName(); const TemplateArgumentList = Spec->getTemplateArgs(); diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index e73782f2d317c..0d83d6a0d9665 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -568,8 +568,7 @@ EmitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *M) { // Perform derived-to-base casts and/or field accesses, to get from the // temporary object we created (and, potentially, for which we extended // the lifetime) to the subobject we're binding the reference to. - for (unsigned I = Adjustments.size(); I != 0; --I) { -SubobjectAdjustment = Adjustments[I-1]; + for (SubobjectAdjustment : llvm::reverse(Adjustments)) { switch (Adjustment.Kind) { case SubobjectAdjustment::DerivedToBaseAdjustment: Object = diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 9cedd9a9a35c0..3d11da2956546 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -2293,9 +2293,9 @@ static void addLinkOptionsPostorder(CodeGenModule , Module *Mod, } // Import this module's dependencies. - for (unsigned I = Mod->Imports.size(); I > 0; --I) { -if (Visited.insert(Mod->Imports[I - 1]).second) - addLinkOptionsPostorder(CGM, Mod->Imports[I-1], Metadata, Visited); + for (Module *Import : llvm::reverse(Mod->Imports)) { +if (Visited.insert(Import).second) + addLinkOptionsPostorder(CGM, Import, Metadata, Visited); } // Add linker options to link against the libraries/frameworks @@ -2308,13 +2308,12 @@ static void addLinkOptionsPostorder(CodeGenModule , Module *Mod, if (Mod->UseExportAsModuleLinkName) return; - for (unsigned I = Mod->LinkLibraries.size(); I > 0; --I) { + for (const Module::LinkLibrary : llvm::reverse(Mod->LinkLibraries)) { // Link against a framework. Frameworks are currently Darwin only, so we // don't to ask TargetCodeGenInfo for the spelling of the linker option. -if (Mod->LinkLibraries[I-1].IsFramework) { - llvm::Metadata *Args[2] = { - llvm::MDString::get(Context, "-framework"), - llvm::MDString::get(Context, Mod->LinkLibraries[I - 1].Library)}; +if (LL.IsFramework) { + llvm::Metadata *Args[2] = {llvm::MDString::get(Context, "-framework"), + llvm::MDString::get(Context, LL.Library)}; Metadata.push_back(llvm::MDNode::get(Context, Args)); continue; @@ -2324,13 +2323,12 @@ static void addLinkOptionsPostorder(CodeGenModule , Module *Mod, if (IsELF) { llvm::Metadata *Args[2] = { llvm::MDString::get(Context, "lib"), - llvm::MDString::get(Context, Mod->LinkLibraries[I - 1].Library), + llvm::MDString::get(Context, LL.Library), }; Metadata.push_back(llvm::MDNode::get(Context, Args)); } else { llvm::SmallString<24> Opt; - CGM.getTargetCodeGenInfo().getDependentLibraryOption( - Mod->LinkLibraries[I - 1].Library, Opt); + CGM.getTargetCodeGenInfo().getDependentLibraryOption(LL.Library, Opt); auto *OptString = llvm::MDString::get(Context, Opt); Metadata.push_back(llvm::MDNode::get(Context, OptString)); } diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index 6324cdc5a6b0a..9fa170410da3c 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -167,8 +167,8 @@ static void appendSubframeworkPaths(Module *Mod, return; // Add Frameworks/Name.framework for each subframework. - for (unsigned I = Paths.size() - 1; I != 0; --I) -llvm::sys::path::append(Path, "Frameworks", Paths[I-1] + ".framework"); + for (StringRef Framework : llvm::drop_begin(llvm::reverse(Paths))) +llvm::sys::path::append(Path, "Frameworks",
[libunwind] 5ece556 - [libunwind] Don't include cet.h/immintrin.h unconditionally
Author: Benjamin Kramer Date: 2021-08-26T11:37:07+02:00 New Revision: 5ece5562719dde1d8e88fdb41ec5ac0cf6f05274 URL: https://github.com/llvm/llvm-project/commit/5ece5562719dde1d8e88fdb41ec5ac0cf6f05274 DIFF: https://github.com/llvm/llvm-project/commit/5ece5562719dde1d8e88fdb41ec5ac0cf6f05274.diff LOG: [libunwind] Don't include cet.h/immintrin.h unconditionally These may not exist when CET isn't available. Added: Modified: libunwind/src/cet_unwind.h Removed: diff --git a/libunwind/src/cet_unwind.h b/libunwind/src/cet_unwind.h index eac0bf12a3a6d..482e0c8086a20 100644 --- a/libunwind/src/cet_unwind.h +++ b/libunwind/src/cet_unwind.h @@ -11,8 +11,6 @@ #define LIBUNWIND_CET_UNWIND_H #include "libunwind.h" -#include -#include // Currently, CET is implemented on Linux x86 platforms. #if defined(_LIBUNWIND_TARGET_LINUX) && defined(__CET__) && defined(__SHSTK__) @@ -20,6 +18,9 @@ #endif #if defined(_LIBUNWIND_USE_CET) +#include +#include + #define _LIBUNWIND_POP_CET_SSP(x) \ do { \ unsigned long ssp = _get_ssp(); \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 3f3642a - [CodeGen] Avoid unused variable warning in Release builds. NFCI.
Author: Benjamin Kramer Date: 2021-05-18T11:09:12+02:00 New Revision: 3f3642a7631e28e44c248a46703e381d389958a1 URL: https://github.com/llvm/llvm-project/commit/3f3642a7631e28e44c248a46703e381d389958a1 DIFF: https://github.com/llvm/llvm-project/commit/3f3642a7631e28e44c248a46703e381d389958a1.diff LOG: [CodeGen] Avoid unused variable warning in Release builds. NFCI. Added: Modified: clang/lib/CodeGen/CGCleanup.cpp Removed: diff --git a/clang/lib/CodeGen/CGCleanup.cpp b/clang/lib/CodeGen/CGCleanup.cpp index bfc8f4b724a8..b439204cf047 100644 --- a/clang/lib/CodeGen/CGCleanup.cpp +++ b/clang/lib/CodeGen/CGCleanup.cpp @@ -1318,8 +1318,7 @@ void CodeGenFunction::EmitCXXTemporary(const CXXTemporary *Temporary, static void EmitSehScope(CodeGenFunction , llvm::FunctionCallee ) { llvm::BasicBlock *InvokeDest = CGF.getInvokeDest(); - llvm::BasicBlock *BB = CGF.Builder.GetInsertBlock(); - assert(BB && InvokeDest); + assert(CGF.Builder.GetInsertBlock() && InvokeDest); llvm::BasicBlock *Cont = CGF.createBasicBlock("invoke.cont"); SmallVector BundleList = CGF.getBundlesForFunclet(SehCppScope.getCallee()); @@ -1368,4 +1367,4 @@ void CodeGenFunction::EmitSehTryScopeEnd() { llvm::FunctionCallee SehCppScope = CGM.CreateRuntimeFunction(FTy, "llvm.seh.try.end"); EmitSehScope(*this, SehCppScope); -} \ No newline at end of file +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 05de4b4 - Put back the trailing commas on TYPED_TEST_SUITE
Author: Benjamin Kramer Date: 2021-05-17T14:14:13+02:00 New Revision: 05de4b413930418b60c0dd1e72681b476b50e7fb URL: https://github.com/llvm/llvm-project/commit/05de4b413930418b60c0dd1e72681b476b50e7fb DIFF: https://github.com/llvm/llvm-project/commit/05de4b413930418b60c0dd1e72681b476b50e7fb.diff LOG: Put back the trailing commas on TYPED_TEST_SUITE This avoids a -pedantic warning: warning: ISO C++11 requires at least one argument for the "..." in a variadic macro See also https://github.com/google/googletest/issues/2271 Added: Modified: clang/unittests/StaticAnalyzer/RangeSetTest.cpp flang/unittests/RuntimeGTest/CharacterTest.cpp llvm/unittests/ADT/BitVectorTest.cpp llvm/unittests/ADT/DenseMapTest.cpp llvm/unittests/ADT/DenseSetTest.cpp llvm/unittests/ADT/IListBaseTest.cpp llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp llvm/unittests/ADT/MapVectorTest.cpp llvm/unittests/ADT/PriorityWorklistTest.cpp llvm/unittests/ADT/RangeAdapterTest.cpp llvm/unittests/ADT/STLForwardCompatTest.cpp llvm/unittests/ADT/SmallVectorTest.cpp llvm/unittests/ADT/TinyPtrVectorTest.cpp llvm/unittests/IR/PatternMatch.cpp llvm/unittests/IR/ValueMapTest.cpp llvm/unittests/Support/MathExtrasTest.cpp llvm/unittests/XRay/FDRProducerConsumerTest.cpp llvm/unittests/XRay/FDRRecordPrinterTest.cpp llvm/unittests/XRay/GraphTest.cpp Removed: diff --git a/clang/unittests/StaticAnalyzer/RangeSetTest.cpp b/clang/unittests/StaticAnalyzer/RangeSetTest.cpp index c29a5eef00e16..6d9d70277d9d3 100644 --- a/clang/unittests/StaticAnalyzer/RangeSetTest.cpp +++ b/clang/unittests/StaticAnalyzer/RangeSetTest.cpp @@ -188,7 +188,7 @@ llvm::APSInt RangeSetTest::Base{sizeof(BaseType) * 8, !isSigned()}; using IntTypes = ::testing::Types; -TYPED_TEST_SUITE(RangeSetTest, IntTypes); +TYPED_TEST_SUITE(RangeSetTest, IntTypes, ); TYPED_TEST(RangeSetTest, RangeSetNegateTest) { // Use next values of the range {MIN, A, B, MID, C, D, MAX}. diff --git a/flang/unittests/RuntimeGTest/CharacterTest.cpp b/flang/unittests/RuntimeGTest/CharacterTest.cpp index ff43e99ae61c5..536855306575e 100644 --- a/flang/unittests/RuntimeGTest/CharacterTest.cpp +++ b/flang/unittests/RuntimeGTest/CharacterTest.cpp @@ -111,7 +111,7 @@ struct CharacterComparisonTests : public ::testing::Test { }; using CharacterTypes = ::testing::Types; -TYPED_TEST_SUITE(CharacterComparisonTests, CharacterTypes); +TYPED_TEST_SUITE(CharacterComparisonTests, CharacterTypes, ); TYPED_TEST(CharacterComparisonTests, CompareCharacters) { for (auto &[x, y, xBytes, yBytes, expect] : this->parameters) { @@ -204,7 +204,7 @@ void RunExtremumTests(const char *which, } template struct ExtremumTests : public ::testing::Test {}; -TYPED_TEST_SUITE(ExtremumTests, CharacterTypes); +TYPED_TEST_SUITE(ExtremumTests, CharacterTypes, ); TYPED_TEST(ExtremumTests, MinTests) { static std::vector tests{ @@ -284,7 +284,7 @@ void RunSearchTests(const char *which, } template struct SearchTests : public ::testing::Test {}; -TYPED_TEST_SUITE(SearchTests, CharacterTypes); +TYPED_TEST_SUITE(SearchTests, CharacterTypes, ); TYPED_TEST(SearchTests, IndexTests) { static SearchFunctions functions{ diff --git a/llvm/unittests/ADT/BitVectorTest.cpp b/llvm/unittests/ADT/BitVectorTest.cpp index 858adb36f22e4..7ab4ab9a9d06e 100644 --- a/llvm/unittests/ADT/BitVectorTest.cpp +++ b/llvm/unittests/ADT/BitVectorTest.cpp @@ -21,7 +21,7 @@ class BitVectorTest : public ::testing::Test { }; // Test both BitVector and SmallBitVector with the same suite of tests. typedef ::testing::Types BitVectorTestTypes; -TYPED_TEST_SUITE(BitVectorTest, BitVectorTestTypes); +TYPED_TEST_SUITE(BitVectorTest, BitVectorTestTypes, ); TYPED_TEST(BitVectorTest, TrivialOperation) { TypeParam Vec; diff --git a/llvm/unittests/ADT/DenseMapTest.cpp b/llvm/unittests/ADT/DenseMapTest.cpp index e9fe4cb8d5cd2..58eac978157ec 100644 --- a/llvm/unittests/ADT/DenseMapTest.cpp +++ b/llvm/unittests/ADT/DenseMapTest.cpp @@ -105,7 +105,7 @@ typedef ::testing::Types, SmallDenseMap > DenseMapTestTypes; -TYPED_TEST_SUITE(DenseMapTest, DenseMapTestTypes); +TYPED_TEST_SUITE(DenseMapTest, DenseMapTestTypes, ); // Empty map tests TYPED_TEST(DenseMapTest, EmptyIntMapTest) { diff --git a/llvm/unittests/ADT/DenseSetTest.cpp b/llvm/unittests/ADT/DenseSetTest.cpp index 1320e283c59aa..82ac1d8bff0f2 100644 --- a/llvm/unittests/ADT/DenseSetTest.cpp +++ b/llvm/unittests/ADT/DenseSetTest.cpp @@ -68,7 +68,7 @@ typedef ::testing::Types, const SmallDenseSet, SmallDenseSet> DenseSetTestTypes; -TYPED_TEST_SUITE(DenseSetTest, DenseSetTestTypes); +TYPED_TEST_SUITE(DenseSetTest, DenseSetTestTypes, ); TYPED_TEST(DenseSetTest, Constructor) { constexpr unsigned a[] = {1, 2,
[clang-tools-extra] fde5b24 - [clangd] Make unit test compatible with gtest 1.10.0
Author: Benjamin Kramer Date: 2021-05-14T19:37:46+02:00 New Revision: fde5b24963f42c8f21e32e1c5b19e81ddc52e575 URL: https://github.com/llvm/llvm-project/commit/fde5b24963f42c8f21e32e1c5b19e81ddc52e575 DIFF: https://github.com/llvm/llvm-project/commit/fde5b24963f42c8f21e32e1c5b19e81ddc52e575.diff LOG: [clangd] Make unit test compatible with gtest 1.10.0 Added: Modified: clang-tools-extra/clangd/unittests/PrintASTTests.cpp Removed: diff --git a/clang-tools-extra/clangd/unittests/PrintASTTests.cpp b/clang-tools-extra/clangd/unittests/PrintASTTests.cpp index 9e4cc565003f4..d0e2c2406abfb 100644 --- a/clang-tools-extra/clangd/unittests/PrintASTTests.cpp +++ b/clang-tools-extra/clangd/unittests/PrintASTTests.cpp @@ -53,15 +53,15 @@ TEST_P(ASTUtils, PrintTemplateArgs) { EXPECT_THAT(V.TemplateArgsAtPoints, ElementsAreArray(Pair.Expected)); } -INSTANTIATE_TEST_CASE_P(ASTUtilsTests, ASTUtils, -::testing::ValuesIn(std::vector({ -{ -R"cpp( +INSTANTIATE_TEST_SUITE_P(ASTUtilsTests, ASTUtils, + ::testing::ValuesIn(std::vector({ + { + R"cpp( template class Bar {}; template <> class ^Bar {};)cpp", -{""}}, -{ -R"cpp( + {""}}, + { + R"cpp( template class Bar {}; template class Z, int Q> @@ -69,42 +69,42 @@ INSTANTIATE_TEST_CASE_P(ASTUtilsTests, ASTUtils, template struct ^Foo; template struct ^Foo {};)cpp", -{"", ""}}, -{ -R"cpp( + {"", ""}}, + { + R"cpp( template void Foz() {}; template <> void ^Foz<3, 5, 8>() {};)cpp", -{"<3, 5, 8>"}}, -{ -R"cpp( + {"<3, 5, 8>"}}, + { + R"cpp( template class Bar {}; template class ...> class Aux {}; template <> class ^Aux {}; template class T> class ^Aux {};)cpp", -{"", ""}}, -{ -R"cpp( + {"", ""}}, + { + R"cpp( template T var = 1234; template <> int ^var = 1;)cpp", -{""}}, -{ -R"cpp( + {""}}, + { + R"cpp( template struct Foo; struct Bar { friend class Foo; }; template <> struct ^Foo {};)cpp", -{""}}, -{ -R"cpp( + {""}}, + { + R"cpp( template T S = T(10); template int ^S = 0; template <> int ^S = 0;)cpp", -{"", ""}}, -})), ); + {"", ""}}, + }))); } // namespace } // namespace clangd } // namespace clang ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 1470b85 - Remove AST inclusion from Basic include
Author: Benjamin Kramer Date: 2021-05-12T19:51:21+02:00 New Revision: 1470b8587f6fdc357163c2258747b77ae9ad6d7a URL: https://github.com/llvm/llvm-project/commit/1470b8587f6fdc357163c2258747b77ae9ad6d7a DIFF: https://github.com/llvm/llvm-project/commit/1470b8587f6fdc357163c2258747b77ae9ad6d7a.diff LOG: Remove AST inclusion from Basic include That's a cyclic dependency. NFC. Added: Modified: clang/include/clang/Basic/Thunk.h Removed: diff --git a/clang/include/clang/Basic/Thunk.h b/clang/include/clang/Basic/Thunk.h index 7f3c4b24ec6d..91088be6ae73 100644 --- a/clang/include/clang/Basic/Thunk.h +++ b/clang/include/clang/Basic/Thunk.h @@ -15,10 +15,13 @@ #ifndef LLVM_CLANG_BASIC_THUNK_H #define LLVM_CLANG_BASIC_THUNK_H -#include "clang/AST/GlobalDecl.h" +#include +#include namespace clang { +class CXXMethodDecl; + /// A return adjustment. struct ReturnAdjustment { /// The non-virtual adjustment from the derived object to its ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 19d2c65 - [CodeGen] Don't crash on for loops with cond variables and no increment
Author: Benjamin Kramer Date: 2021-03-19T20:43:52+01:00 New Revision: 19d2c65ddd757997785163709800f837857f686d URL: https://github.com/llvm/llvm-project/commit/19d2c65ddd757997785163709800f837857f686d DIFF: https://github.com/llvm/llvm-project/commit/19d2c65ddd757997785163709800f837857f686d.diff LOG: [CodeGen] Don't crash on for loops with cond variables and no increment This looks like an oversight from a875721d8a2d, creating IR that refers to `for.inc` even if it doesn't exist. Differential Revision: https://reviews.llvm.org/D98980 Added: Modified: clang/lib/CodeGen/CGStmt.cpp clang/test/CodeGenCXX/for-cond-var.cpp Removed: diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 6461e2011216..38f3aa941415 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -992,7 +992,7 @@ void CodeGenFunction::EmitForStmt(const ForStmt , // We have entered the condition variable's scope, so we're now able to // jump to the continue block. - Continue = getJumpDestInCurrentScope("for.inc"); + Continue = S.getInc() ? getJumpDestInCurrentScope("for.inc") : CondDest; BreakContinueStack.back().ContinueBlock = Continue; } diff --git a/clang/test/CodeGenCXX/for-cond-var.cpp b/clang/test/CodeGenCXX/for-cond-var.cpp index 45b4a82cb905..60e54d4141f7 100644 --- a/clang/test/CodeGenCXX/for-cond-var.cpp +++ b/clang/test/CodeGenCXX/for-cond-var.cpp @@ -123,3 +123,16 @@ void PR49585_break() { // CHECK [[for_end]]: // CHECK: ret void } + +// CHECK: define {{.*}} void @_Z16incless_for_loopv( +void incless_for_loop() { + // CHECK: br label %[[for_cond:.*]] + // CHECK: [[for_cond]]: + // CHECK: br i1 {{.*}}, label %[[for_body:.*]], label %[[for_end:.*]] + // CHECK: [[for_body]]: + // CHECK: br label %[[for_cond]] + // CHECK: [[for_end]]: + // CHECK: ret void + // CHECK: } + for (; int b = 0;) continue; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 965f24d - [Driver] Don't litter the source directory in test
Author: Benjamin Kramer Date: 2021-03-01T11:20:13+01:00 New Revision: 965f24d4dbd6bc8905de75150d36c693d4396bfd URL: https://github.com/llvm/llvm-project/commit/965f24d4dbd6bc8905de75150d36c693d4396bfd DIFF: https://github.com/llvm/llvm-project/commit/965f24d4dbd6bc8905de75150d36c693d4396bfd.diff LOG: [Driver] Don't litter the source directory in test Added: Modified: clang/test/Driver/cc-print-proc-stat.c Removed: diff --git a/clang/test/Driver/cc-print-proc-stat.c b/clang/test/Driver/cc-print-proc-stat.c index f3a38559b78a..14029c3ccca0 100644 --- a/clang/test/Driver/cc-print-proc-stat.c +++ b/clang/test/Driver/cc-print-proc-stat.c @@ -5,5 +5,5 @@ // CHECK-CSV: clang{{.*}},"{{.*}}.s",{{[0-9]+}},{{[0-9]+}},{{[0-9]+}} // RUN: env CC_PRINT_PROC_STAT=1 \ -// RUN: %clang -c -fintegrated-as %s | FileCheck %s +// RUN: %clang -no-canonical-prefixes -c -fintegrated-as %s -o %t.o | FileCheck %s // CHECK: clang{{.*}}: output={{.*}}.o, total={{[0-9.]+}} ms, user={{[0-9.]+}} ms, mem={{[0-9]+}} Kb ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 2a136a7 - [X86] Autodetect znver3
Author: Benjamin Kramer Date: 2020-12-05T19:08:20+01:00 New Revision: 2a136a7a9c68e4818b28bea6051b78a8181ba78e URL: https://github.com/llvm/llvm-project/commit/2a136a7a9c68e4818b28bea6051b78a8181ba78e DIFF: https://github.com/llvm/llvm-project/commit/2a136a7a9c68e4818b28bea6051b78a8181ba78e.diff LOG: [X86] Autodetect znver3 Added: Modified: clang/test/CodeGen/target-builtin-noerror.c compiler-rt/lib/builtins/cpu_model.c llvm/include/llvm/Support/X86TargetParser.def llvm/lib/Support/Host.cpp Removed: diff --git a/clang/test/CodeGen/target-builtin-noerror.c b/clang/test/CodeGen/target-builtin-noerror.c index 50967c6657cd..808f3a03431b 100644 --- a/clang/test/CodeGen/target-builtin-noerror.c +++ b/clang/test/CodeGen/target-builtin-noerror.c @@ -128,4 +128,5 @@ void verifycpustrings() { (void)__builtin_cpu_is("westmere"); (void)__builtin_cpu_is("znver1"); (void)__builtin_cpu_is("znver2"); + (void)__builtin_cpu_is("znver3"); } diff --git a/compiler-rt/lib/builtins/cpu_model.c b/compiler-rt/lib/builtins/cpu_model.c index 05ef8492384f..51bedd98c3d3 100644 --- a/compiler-rt/lib/builtins/cpu_model.c +++ b/compiler-rt/lib/builtins/cpu_model.c @@ -68,6 +68,7 @@ enum ProcessorTypes { INTEL_GOLDMONT, INTEL_GOLDMONT_PLUS, INTEL_TREMONT, + AMDFAM19H, CPU_TYPE_MAX }; @@ -97,6 +98,7 @@ enum ProcessorSubtypes { INTEL_COREI7_COOPERLAKE, INTEL_COREI7_SAPPHIRERAPIDS, INTEL_COREI7_ALDERLAKE, + AMDFAM19H_ZNVER3, CPU_SUBTYPE_MAX }; @@ -550,6 +552,14 @@ getAMDProcessorTypeAndSubtype(unsigned Family, unsigned Model, break; // 00h-0Fh: Zen1 } break; + case 25: +CPU = "znver3"; +*Type = AMDFAM19H; +if (Model <= 0x0f) { + *Subtype = AMDFAM19H_ZNVER3; + break; // 00h-0Fh: Zen3 +} +break; default: break; // Unknown AMD CPU. } diff --git a/llvm/include/llvm/Support/X86TargetParser.def b/llvm/include/llvm/Support/X86TargetParser.def index c0fe76dfdd64..ec19ce4e7cdd 100644 --- a/llvm/include/llvm/Support/X86TargetParser.def +++ b/llvm/include/llvm/Support/X86TargetParser.def @@ -44,6 +44,7 @@ X86_CPU_TYPE(INTEL_KNM, "knm") X86_CPU_TYPE(INTEL_GOLDMONT, "goldmont") X86_CPU_TYPE(INTEL_GOLDMONT_PLUS, "goldmont-plus") X86_CPU_TYPE(INTEL_TREMONT, "tremont") +X86_CPU_TYPE(AMDFAM19H, "amdfam19h") // Alternate names supported by __builtin_cpu_is and target multiversioning. X86_CPU_TYPE_ALIAS(INTEL_BONNELL,"atom") @@ -86,6 +87,7 @@ X86_CPU_SUBTYPE(INTEL_COREI7_TIGERLAKE, "tigerlake") X86_CPU_SUBTYPE(INTEL_COREI7_COOPERLAKE, "cooperlake") X86_CPU_SUBTYPE(INTEL_COREI7_SAPPHIRERAPIDS, "sapphirerapids") X86_CPU_SUBTYPE(INTEL_COREI7_ALDERLAKE, "alderlake") +X86_CPU_SUBTYPE(AMDFAM19H_ZNVER3,"znver3") #undef X86_CPU_SUBTYPE diff --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp index 4fb93928ff15..b179c8334a2b 100644 --- a/llvm/lib/Support/Host.cpp +++ b/llvm/lib/Support/Host.cpp @@ -964,6 +964,14 @@ getAMDProcessorTypeAndSubtype(unsigned Family, unsigned Model, break; // 00h-0Fh: Zen1 } break; + case 25: +CPU = "znver3"; +*Type = X86::AMDFAM19H; +if (Model <= 0x0f) { + *Subtype = X86::AMDFAM19H_ZNVER3; + break; // 00h-0Fh: Zen3 +} +break; default: break; // Unknown AMD CPU. } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 90a9f97 - [openmp] Use front() instead of *begin() to not hide bugs when CurTypes is empty.
Author: Benjamin Kramer Date: 2020-10-28T13:58:23+01:00 New Revision: 90a9f97cbda3bef63d9866d300b73b8ccf65c7f5 URL: https://github.com/llvm/llvm-project/commit/90a9f97cbda3bef63d9866d300b73b8ccf65c7f5 DIFF: https://github.com/llvm/llvm-project/commit/90a9f97cbda3bef63d9866d300b73b8ccf65c7f5.diff LOG: [openmp] Use front() instead of *begin() to not hide bugs when CurTypes is empty. Added: Modified: clang/lib/CodeGen/CGOpenMPRuntime.cpp Removed: diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 3cc4a6b6c9e4..d59dd6a2e7f7 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -7989,7 +7989,7 @@ class MappableExprsHandler { })) CombinedInfo.Types.back() |= OMP_MAP_PRESENT; // Remove TARGET_PARAM flag from the first element -(*CurTypes.begin()) &= ~OMP_MAP_TARGET_PARAM; +CurTypes.front() &= ~OMP_MAP_TARGET_PARAM; // All other current entries will be MEMBER_OF the combined entry // (except for PTR_AND_OBJ entries which do not have a placeholder value ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] 26750a1 - [clang-tidy] Silence unused variable warning in Release builds. NFCI.
Author: Benjamin Kramer Date: 2020-10-26T20:20:23+01:00 New Revision: 26750a1264b3df114a1efae7cde6f0784206b2ce URL: https://github.com/llvm/llvm-project/commit/26750a1264b3df114a1efae7cde6f0784206b2ce DIFF: https://github.com/llvm/llvm-project/commit/26750a1264b3df114a1efae7cde6f0784206b2ce.diff LOG: [clang-tidy] Silence unused variable warning in Release builds. NFCI. ExpandModularHeadersPPCallbacks.cpp:55:15: warning: unused variable 'FileEntry' for (auto FileEntry : FilesToRecord) ^ Added: Modified: clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp Removed: diff --git a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp index 9e693b62e50d..1d008c23617c 100644 --- a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp +++ b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp @@ -52,9 +52,11 @@ class ExpandModularHeadersPPCallbacks::FileRecorder { /// Makes sure we have contents for all the files we were interested in. Ideally /// `FilesToRecord` should be empty. void checkAllFilesRecorded() { -for (auto FileEntry : FilesToRecord) - LLVM_DEBUG(llvm::dbgs() << "Did not record contents for input file: " - << FileEntry->getName() << "\n"); +LLVM_DEBUG({ + for (auto FileEntry : FilesToRecord) +llvm::dbgs() << "Did not record contents for input file: " + << FileEntry->getName() << "\n"; +}); } private: ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] dd7095f - [clang][unittest] Don't hardcode the string "Assertion"
Author: Benjamin Kramer Date: 2020-10-26T18:10:56+01:00 New Revision: dd7095f52bda36e0f3cd37574a1cb97c7a46cffe URL: https://github.com/llvm/llvm-project/commit/dd7095f52bda36e0f3cd37574a1cb97c7a46cffe DIFF: https://github.com/llvm/llvm-project/commit/dd7095f52bda36e0f3cd37574a1cb97c7a46cffe.diff LOG: [clang][unittest] Don't hardcode the string "Assertion" This depends on the libc implementation. Use the string from the assertion message instead. Overly specific, but so is this entire test. Added: Modified: clang/unittests/Basic/LineOffsetMappingTest.cpp Removed: diff --git a/clang/unittests/Basic/LineOffsetMappingTest.cpp b/clang/unittests/Basic/LineOffsetMappingTest.cpp index e04081378283..b50374a449c8 100644 --- a/clang/unittests/Basic/LineOffsetMappingTest.cpp +++ b/clang/unittests/Basic/LineOffsetMappingTest.cpp @@ -20,7 +20,7 @@ TEST(LineOffsetMappingTest, empty) { EXPECT_FALSE(Mapping); #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST - EXPECT_DEATH((void)Mapping.getLines(), "Assertion"); + EXPECT_DEATH((void)Mapping.getLines(), "Storage"); #endif } @@ -34,7 +34,7 @@ TEST(LineOffsetMappingTest, construct) { EXPECT_EQ(20u, Mapping[2]); #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST - EXPECT_DEATH((void)Mapping[3], "Assertion"); + EXPECT_DEATH((void)Mapping[3], "Invalid index"); #endif } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 39a0d68 - [X86] Add a stub for Intel's alderlake.
Author: Benjamin Kramer Date: 2020-10-24T19:01:22+02:00 New Revision: 39a0d6889dee636af3b7fbb69e1ac5c8af777ad0 URL: https://github.com/llvm/llvm-project/commit/39a0d6889dee636af3b7fbb69e1ac5c8af777ad0 DIFF: https://github.com/llvm/llvm-project/commit/39a0d6889dee636af3b7fbb69e1ac5c8af777ad0.diff LOG: [X86] Add a stub for Intel's alderlake. No scheduling, no autodetection. Added: Modified: clang/docs/ReleaseNotes.rst clang/lib/Basic/Targets/X86.cpp clang/test/CodeGen/attr-target-mv.c clang/test/CodeGen/target-builtin-noerror.c clang/test/Driver/x86-march.c clang/test/Misc/target-invalid-cpu-note.c clang/test/Preprocessor/predefined-arch-macros.c compiler-rt/lib/builtins/cpu_model.c llvm/docs/ReleaseNotes.rst llvm/include/llvm/Support/X86TargetParser.def llvm/include/llvm/Support/X86TargetParser.h llvm/lib/Support/X86TargetParser.cpp llvm/lib/Target/X86/X86.td llvm/test/CodeGen/X86/cpus-intel.ll Removed: diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 56337177e060..2a7beba73b69 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -190,7 +190,8 @@ X86 Support in Clang - The x86 intrinsics ``__rorb``, ``__rorw``, ``__rord``, ``__rorq`, ``_rotr``, ``_rotwr`` and ``_lrotr`` may now be used within constant expressions. -- Support for ``-march=sapphirerapids`` was added. +- Support for ``-march=alderlake``, ``-march=sapphirerapids`` and + ``-march=znver3`` was added. - Support for ``-march=x86-64-v[234]`` has been added. See :doc:`UsersManual` for details about these micro-architecture levels. diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp index 3239e3231cc0..4ce3a5d0327f 100644 --- a/clang/lib/Basic/Targets/X86.cpp +++ b/clang/lib/Basic/Targets/X86.cpp @@ -468,6 +468,7 @@ void X86TargetInfo::getTargetDefines(const LangOptions , case CK_IcelakeServer: case CK_Tigerlake: case CK_SapphireRapids: + case CK_Alderlake: // FIXME: Historically, we defined this legacy name, it would be nice to // remove it at some point. We've never exposed fine-grained names for // recent primary x86 CPUs, and we should keep it that way. @@ -1308,6 +1309,7 @@ Optional X86TargetInfo::getCPUCacheLineSize() const { case CK_SapphireRapids: case CK_IcelakeClient: case CK_IcelakeServer: +case CK_Alderlake: case CK_KNL: case CK_KNM: // K7 diff --git a/clang/test/CodeGen/attr-target-mv.c b/clang/test/CodeGen/attr-target-mv.c index 57b266403dfc..adad3c936a99 100644 --- a/clang/test/CodeGen/attr-target-mv.c +++ b/clang/test/CodeGen/attr-target-mv.c @@ -12,6 +12,7 @@ int __attribute__((target("arch=icelake-server"))) foo(void) {return 7;} int __attribute__((target("arch=cooperlake"))) foo(void) {return 8;} int __attribute__((target("arch=tigerlake"))) foo(void) {return 9;} int __attribute__((target("arch=sapphirerapids"))) foo(void) {return 10;} +int __attribute__((target("arch=alderlake"))) foo(void) {return 11;} int __attribute__((target("default"))) foo(void) { return 2; } int bar() { @@ -94,6 +95,8 @@ __attribute__((target("avx,sse4.2"), used)) inline void foo_used2(int i, double // LINUX: ret i32 9 // LINUX: define i32 @foo.arch_sapphirerapids() // LINUX: ret i32 10 +// LINUX: define i32 @foo.arch_alderlake() +// LINUX: ret i32 11 // LINUX: define i32 @foo() // LINUX: ret i32 2 // LINUX: define i32 @bar() diff --git a/clang/test/CodeGen/target-builtin-noerror.c b/clang/test/CodeGen/target-builtin-noerror.c index 42164303e4a6..50967c6657cd 100644 --- a/clang/test/CodeGen/target-builtin-noerror.c +++ b/clang/test/CodeGen/target-builtin-noerror.c @@ -85,6 +85,7 @@ void verifyfeaturestrings() { } void verifycpustrings() { + (void)__builtin_cpu_is("alderlake"); (void)__builtin_cpu_is("amd"); (void)__builtin_cpu_is("amdfam10h"); (void)__builtin_cpu_is("amdfam15h"); diff --git a/clang/test/Driver/x86-march.c b/clang/test/Driver/x86-march.c index 26ffc161c273..871f47109b40 100644 --- a/clang/test/Driver/x86-march.c +++ b/clang/test/Driver/x86-march.c @@ -80,6 +80,10 @@ // RUN: | FileCheck %s -check-prefix=tigerlake // tigerlake: "-target-cpu" "tigerlake" // +// RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=alderlake 2>&1 \ +// RUN: | FileCheck %s -check-prefix=alderlake +// alderlake: "-target-cpu" "alderlake" +// // RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=lakemont 2>&1 \ // RUN: | FileCheck %s -check-prefix=lakemont // lakemont: "-target-cpu" "lakemont" diff --git a/clang/test/Misc/target-invalid-cpu-note.c b/clang/test/Misc/target-invalid-cpu-note.c index 82165de6f079..d54403331f57 100644 --- a/clang/test/Misc/target-invalid-cpu-note.c +++ b/clang/test/Misc/target-invalid-cpu-note.c @@ -21,7 +21,7 @@ // X86-SAME: nocona, core2, penryn,
[clang] bd2cf96 - [X86] Add a stub for znver3 based on the little public information there is in AMD's manuals
Author: Benjamin Kramer Date: 2020-10-24T19:01:22+02:00 New Revision: bd2cf96c098ed0020f5178eda12cf30d3980d9bd URL: https://github.com/llvm/llvm-project/commit/bd2cf96c098ed0020f5178eda12cf30d3980d9bd DIFF: https://github.com/llvm/llvm-project/commit/bd2cf96c098ed0020f5178eda12cf30d3980d9bd.diff LOG: [X86] Add a stub for znver3 based on the little public information there is in AMD's manuals No scheduling, no autodetection. Just enough so -march=znver3 works. Added: Modified: clang/lib/Basic/Targets/X86.cpp clang/test/Misc/target-invalid-cpu-note.c clang/test/Preprocessor/predefined-arch-macros.c llvm/include/llvm/Support/X86TargetParser.h llvm/lib/Support/X86TargetParser.cpp llvm/lib/Target/X86/X86.td llvm/test/CodeGen/X86/cpus-amd.ll Removed: diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp index c8d96f887e90..3239e3231cc0 100644 --- a/clang/lib/Basic/Targets/X86.cpp +++ b/clang/lib/Basic/Targets/X86.cpp @@ -542,6 +542,9 @@ void X86TargetInfo::getTargetDefines(const LangOptions , case CK_ZNVER2: defineCPUMacros(Builder, "znver2"); break; + case CK_ZNVER3: +defineCPUMacros(Builder, "znver3"); +break; case CK_Geode: defineCPUMacros(Builder, "geode"); break; @@ -1325,6 +1328,7 @@ Optional X86TargetInfo::getCPUCacheLineSize() const { // Zen case CK_ZNVER1: case CK_ZNVER2: +case CK_ZNVER3: // Deprecated case CK_x86_64: case CK_x86_64_v2: diff --git a/clang/test/Misc/target-invalid-cpu-note.c b/clang/test/Misc/target-invalid-cpu-note.c index a2d20c31caa4..82165de6f079 100644 --- a/clang/test/Misc/target-invalid-cpu-note.c +++ b/clang/test/Misc/target-invalid-cpu-note.c @@ -24,7 +24,7 @@ // X86-SAME: skx, cascadelake, cooperlake, cannonlake, icelake-client, icelake-server, tigerlake, sapphirerapids, knl, knm, lakemont, k6, k6-2, k6-3, // X86-SAME: athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, // X86-SAME: athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, -// X86-SAME: barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, +// X86-SAME: barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, // X86-SAME: x86-64, x86-64-v2, x86-64-v3, x86-64-v4, geode{{$}} // RUN: not %clang_cc1 -triple x86_64--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix X86_64 @@ -35,7 +35,7 @@ // X86_64-SAME: core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, // X86_64-SAME: icelake-client, icelake-server, tigerlake, sapphirerapids, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, // X86_64-SAME: athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, -// X86_64-SAME: btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, +// X86_64-SAME: btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, // X86_64-SAME: x86-64, x86-64-v2, x86-64-v3, x86-64-v4{{$}} // RUN: not %clang_cc1 -triple i386--- -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE_X86 @@ -49,7 +49,7 @@ // TUNE_X86-SAME: skx, cascadelake, cooperlake, cannonlake, icelake-client, icelake-server, tigerlake, sapphirerapids, knl, knm, lakemont, k6, k6-2, k6-3, // TUNE_X86-SAME: athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, // TUNE_X86-SAME: athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, -// TUNE_X86-SAME: barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, +// TUNE_X86-SAME: barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, // TUNE_X86-SAME: x86-64, geode{{$}} // RUN: not %clang_cc1 -triple x86_64--- -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE_X86_64 @@ -63,7 +63,7 @@ // TUNE_X86_64-SAME: skx, cascadelake, cooperlake, cannonlake, icelake-client, icelake-server, tigerlake, sapphirerapids, knl, knm, lakemont, k6, k6-2, k6-3, // TUNE_X86_64-SAME: athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, // TUNE_X86_64-SAME: athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, -// TUNE_X86_64-SAME: barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, +// TUNE_X86_64-SAME: barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, // TUNE_X86_64-SAME: x86-64, geode{{$}} // RUN: not %clang_cc1 -triple nvptx--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix NVPTX diff --git a/clang/test/Preprocessor/predefined-arch-macros.c b/clang/test/Preprocessor/predefined-arch-macros.c index f8ee187b15f3..65089e8f97c7 100644 --- a/clang/test/Preprocessor/predefined-arch-macros.c +++ b/clang/test/Preprocessor/predefined-arch-macros.c @@ -3154,6 +3154,110 @@ // CHECK_ZNVER2_M64: #define __znver2 1 //
[clang] b8d2b6f - Unbreak the clang-interpreter example after 0aec49c8531bc5282b095730d34681455826bc2c
Author: Benjamin Kramer Date: 2020-10-24T19:01:21+02:00 New Revision: b8d2b6f6cf6015751fc950c3e8149404e8b37fe8 URL: https://github.com/llvm/llvm-project/commit/b8d2b6f6cf6015751fc950c3e8149404e8b37fe8 DIFF: https://github.com/llvm/llvm-project/commit/b8d2b6f6cf6015751fc950c3e8149404e8b37fe8.diff LOG: Unbreak the clang-interpreter example after 0aec49c8531bc5282b095730d34681455826bc2c Added: Modified: clang/examples/clang-interpreter/main.cpp Removed: diff --git a/clang/examples/clang-interpreter/main.cpp b/clang/examples/clang-interpreter/main.cpp index 6b4cdca15fb0..342d42089472 100644 --- a/clang/examples/clang-interpreter/main.cpp +++ b/clang/examples/clang-interpreter/main.cpp @@ -72,6 +72,11 @@ class SimpleJIT { } public: + ~SimpleJIT() { +if (auto Err = ES.endSession()) + ES.reportError(std::move(Err)); + } + static Expected> Create() { auto JTMB = JITTargetMachineBuilder::detectHost(); if (!JTMB) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] f2cca0b - Silence unused variable warning in Release builds. NFCI.
Author: Benjamin Kramer Date: 2020-10-20T10:48:48+02:00 New Revision: f2cca0b291491f25dc6d2c073d71a2799625ad3b URL: https://github.com/llvm/llvm-project/commit/f2cca0b291491f25dc6d2c073d71a2799625ad3b DIFF: https://github.com/llvm/llvm-project/commit/f2cca0b291491f25dc6d2c073d71a2799625ad3b.diff LOG: Silence unused variable warning in Release builds. NFCI. Added: Modified: clang/lib/AST/Decl.cpp Removed: diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 5084f867622f4..b3a67715d604b 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -2451,8 +2451,7 @@ bool VarDecl::checkForConstantInitialization( "already evaluated var value before checking for constant init"); assert(getASTContext().getLangOpts().CPlusPlus && "only meaningful in C++"); - const auto *Init = cast(Eval->Value); - assert(!Init->isValueDependent()); + assert(!cast(Eval->Value)->isValueDependent()); // Evaluate the initializer to check whether it's a constant expression. Eval->HasConstantInitialization = ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 633f9fc - Make header self-contained. NFC.
Author: Benjamin Kramer Date: 2020-10-14T22:03:19+02:00 New Revision: 633f9fcb820bf01d59cdcdd8038889eec61cf2f2 URL: https://github.com/llvm/llvm-project/commit/633f9fcb820bf01d59cdcdd8038889eec61cf2f2 DIFF: https://github.com/llvm/llvm-project/commit/633f9fcb820bf01d59cdcdd8038889eec61cf2f2.diff LOG: Make header self-contained. NFC. Added: Modified: clang/include/clang/Basic/TargetCXXABI.h Removed: diff --git a/clang/include/clang/Basic/TargetCXXABI.h b/clang/include/clang/Basic/TargetCXXABI.h index ed6438a9b236..d987d1b0eda0 100644 --- a/clang/include/clang/Basic/TargetCXXABI.h +++ b/clang/include/clang/Basic/TargetCXXABI.h @@ -15,6 +15,7 @@ #ifndef LLVM_CLANG_BASIC_TARGETCXXABI_H #define LLVM_CLANG_BASIC_TARGETCXXABI_H +#include "clang/Basic/LLVM.h" #include "llvm/ADT/StringMap.h" #include "llvm/Support/ErrorHandling.h" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] 0db08e5 - [clangd] Map bits/stdint-intn.h and bits/stdint-uintn.h to cstdint.
Author: Benjamin Kramer Date: 2020-10-10T14:13:42+02:00 New Revision: 0db08e59c9d2d3b004ea61f96d823edff283ed25 URL: https://github.com/llvm/llvm-project/commit/0db08e59c9d2d3b004ea61f96d823edff283ed25 DIFF: https://github.com/llvm/llvm-project/commit/0db08e59c9d2d3b004ea61f96d823edff283ed25.diff LOG: [clangd] Map bits/stdint-intn.h and bits/stdint-uintn.h to cstdint. These are private glibc headers containing parts of the implementation of stdint.h. Added: Modified: clang-tools-extra/clangd/index/CanonicalIncludes.cpp Removed: diff --git a/clang-tools-extra/clangd/index/CanonicalIncludes.cpp b/clang-tools-extra/clangd/index/CanonicalIncludes.cpp index 120f121c7278..a63a6bd82a15 100644 --- a/clang-tools-extra/clangd/index/CanonicalIncludes.cpp +++ b/clang-tools-extra/clangd/index/CanonicalIncludes.cpp @@ -420,6 +420,8 @@ void CanonicalIncludes::addSystemHeadersMapping(const LangOptions ) { {"bits/signum.h", ""}, {"bits/sigset.h", ""}, {"bits/sigstack.h", ""}, + {"bits/stdint-intn.h", ""}, + {"bits/stdint-uintn.h", ""}, {"bits/stdio_lim.h", ""}, {"bits/sys_errlist.h", ""}, {"bits/time.h", ""}, ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 6a1bca8 - [Analyzer] Fix unused variable warning in Release builds
Author: Benjamin Kramer Date: 2020-09-25T14:09:43+02:00 New Revision: 6a1bca8798c6ba119f188061472b60876495b9ae URL: https://github.com/llvm/llvm-project/commit/6a1bca8798c6ba119f188061472b60876495b9ae DIFF: https://github.com/llvm/llvm-project/commit/6a1bca8798c6ba119f188061472b60876495b9ae.diff LOG: [Analyzer] Fix unused variable warning in Release builds clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp:377:19: warning: unused variable 'Init' Added: Modified: clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp Removed: diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp index 953a8ef58b44..cab65687444b 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp @@ -379,8 +379,7 @@ ProgramStateRef ExprEngine::updateObjectsUnderConstruction( assert(Init->isAnyMemberInitializer() && "Base and delegating initializers should have been handled by" "computeObjectUnderConstruction()"); - return addObjectUnderConstruction(State, ICC->getCXXCtorInitializer(), -LCtx, V); + return addObjectUnderConstruction(State, Init, LCtx, V); } case ConstructionContext::NewAllocatedObjectKind: { return State; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] f054617 - [ASTMatchers] Add missing definition for decompositionDecl
Author: Benjamin Kramer Date: 2020-09-16T17:32:29+02:00 New Revision: f0546173fa4bdde03ecb21a174fcaa8a6490adbd URL: https://github.com/llvm/llvm-project/commit/f0546173fa4bdde03ecb21a174fcaa8a6490adbd DIFF: https://github.com/llvm/llvm-project/commit/f0546173fa4bdde03ecb21a174fcaa8a6490adbd.diff LOG: [ASTMatchers] Add missing definition for decompositionDecl Otherwise we'd get a linker error whenever decompositionDecl is ODR used. Added: Modified: clang/lib/ASTMatchers/ASTMatchersInternal.cpp Removed: diff --git a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp index 6b17bd0cda0b..4e4e43b2a94a 100644 --- a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp +++ b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp @@ -710,6 +710,7 @@ const internal::VariadicDynCastAllOfMatcher typeAliasDecl; const internal::VariadicDynCastAllOfMatcher typeAliasTemplateDecl; const internal::VariadicAllOfMatcher decl; +const internal::VariadicAllOfMatcher decompositionDecl; const internal::VariadicDynCastAllOfMatcher linkageSpecDecl; const internal::VariadicDynCastAllOfMatcher namedDecl; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 4d0312c - Add proper move ctor/move assign to APValue. NFCI.
Author: Benjamin Kramer Date: 2020-09-06T13:02:11+02:00 New Revision: 4d0312c8e05be5353c6c29b31036647dceca3ce5 URL: https://github.com/llvm/llvm-project/commit/4d0312c8e05be5353c6c29b31036647dceca3ce5 DIFF: https://github.com/llvm/llvm-project/commit/4d0312c8e05be5353c6c29b31036647dceca3ce5.diff LOG: Add proper move ctor/move assign to APValue. NFCI. Swapping 64 bytes to make a move isn't cheap. Added: Modified: clang/include/clang/AST/APValue.h clang/lib/AST/APValue.cpp Removed: diff --git a/clang/include/clang/AST/APValue.h b/clang/include/clang/AST/APValue.h index 87e4bd7f84c1..5103cfa8604e 100644 --- a/clang/include/clang/AST/APValue.h +++ b/clang/include/clang/AST/APValue.h @@ -304,7 +304,7 @@ class APValue { MakeComplexFloat(); setComplexFloat(std::move(R), std::move(I)); } APValue(const APValue ); - APValue(APValue &) : Kind(None) { swap(RHS); } + APValue(APValue &); APValue(LValueBase B, const CharUnits , NoLValuePath N, bool IsNullPtr = false) : Kind(None) { @@ -339,6 +339,9 @@ class APValue { return Result; } + APValue =(const APValue ); + APValue =(APValue &); + ~APValue() { if (Kind != None && Kind != Indeterminate) DestroyDataAndMakeUninit(); @@ -591,12 +594,6 @@ class APValue { ((AddrLabelDiffData*)(char*)Data.buffer)->RHSExpr = RHSExpr; } - /// Assign by swapping from a copy of the RHS. - APValue =(APValue RHS) { -swap(RHS); -return *this; - } - private: void DestroyDataAndMakeUninit(); void MakeInt() { diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp index 2a8834b4db0c..08ae0ff3c67d 100644 --- a/clang/lib/AST/APValue.cpp +++ b/clang/lib/AST/APValue.cpp @@ -304,6 +304,25 @@ APValue::APValue(const APValue ) : Kind(None) { } } +APValue::APValue(APValue &) : Kind(RHS.Kind), Data(RHS.Data) { + RHS.Kind = None; +} + +APValue ::operator=(const APValue ) { + if (this != ) +*this = APValue(RHS); + return *this; +} + +APValue ::operator=(APValue &) { + if (Kind != None && Kind != Indeterminate) +DestroyDataAndMakeUninit(); + Kind = RHS.Kind; + Data = RHS.Data; + RHS.Kind = None; + return *this; +} + void APValue::DestroyDataAndMakeUninit() { if (Kind == Int) ((APSInt*)(char*)Data.buffer)->~APSInt(); @@ -372,10 +391,7 @@ bool APValue::needsCleanup() const { void APValue::swap(APValue ) { std::swap(Kind, RHS.Kind); - char TmpData[DataSize]; - memcpy(TmpData, Data.buffer, DataSize); - memcpy(Data.buffer, RHS.Data.buffer, DataSize); - memcpy(RHS.Data.buffer, TmpData, DataSize); + std::swap(Data, RHS.Data); } static double GetApproxValue(const llvm::APFloat ) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 8782c72 - Strength-reduce SmallVectors to arrays. NFCI.
Author: Benjamin Kramer Date: 2020-08-28T21:14:20+02:00 New Revision: 8782c727655942c9aa4c80d698c9ba575510799c URL: https://github.com/llvm/llvm-project/commit/8782c727655942c9aa4c80d698c9ba575510799c DIFF: https://github.com/llvm/llvm-project/commit/8782c727655942c9aa4c80d698c9ba575510799c.diff LOG: Strength-reduce SmallVectors to arrays. NFCI. Added: Modified: clang/lib/Driver/ToolChains/AMDGPU.cpp llvm/lib/IR/DebugInfoMetadata.cpp llvm/lib/Target/AArch64/AArch64ISelLowering.cpp llvm/lib/Transforms/Utils/SimplifyCFG.cpp mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp mlir/lib/Dialect/SPIRV/SPIRVOps.cpp Removed: diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp index b11ce41de479..71acf3ed3281 100644 --- a/clang/lib/Driver/ToolChains/AMDGPU.cpp +++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp @@ -245,9 +245,9 @@ void RocmInstallationDetector::detectDeviceLibrary() { // - ${ROCM_ROOT}/lib/* // - ${ROCM_ROOT}/lib/bitcode/* // so try to detect these layouts. -static llvm::SmallVector SubDirsList[] = { +static constexpr std::array SubDirsList[] = { {"amdgcn", "bitcode"}, -{"lib"}, +{"lib", ""}, {"lib", "bitcode"}, }; diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp index f20270810ed6..129a52b710c6 100644 --- a/llvm/lib/IR/DebugInfoMetadata.cpp +++ b/llvm/lib/IR/DebugInfoMetadata.cpp @@ -133,7 +133,7 @@ const DILocation *DILocation::getMergedLocation(const DILocation *LocA, } Optional DILocation::encodeDiscriminator(unsigned BD, unsigned DF, unsigned CI) { - SmallVector Components = {BD, DF, CI}; + std::array Components = {BD, DF, CI}; uint64_t RemainingWork = 0U; // We use RemainingWork to figure out if we have no remaining components to // encode. For example: if BD != 0 but DF == 0 && CI == 0, we don't need to diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index e68183dc46a2..e1b79393f25f 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -15710,8 +15710,8 @@ SDValue AArch64TargetLowering::LowerFixedLengthVectorSetccToSVE( auto Pg = getPredicateForFixedLengthVector(DAG, DL, InVT); EVT CmpVT = Pg.getValueType(); - SmallVector CmpOps = {Pg, Op1, Op2, Op.getOperand(2)}; - auto Cmp = DAG.getNode(AArch64ISD::SETCC_MERGE_ZERO, DL, CmpVT, CmpOps); + auto Cmp = DAG.getNode(AArch64ISD::SETCC_MERGE_ZERO, DL, CmpVT, + {Pg, Op1, Op2, Op.getOperand(2)}); EVT PromoteVT = ContainerVT.changeTypeToInteger(); auto Promote = DAG.getBoolExtOrTrunc(Cmp, DL, PromoteVT, InVT); diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 75cb87345949..ae2471969160 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -3156,7 +3156,7 @@ static bool mergeConditionalStoreToAddress(BasicBlock *PTB, BasicBlock *PFB, return true; }; - const SmallVector FreeStores = {PStore, QStore}; + const std::array FreeStores = {PStore, QStore}; if (!MergeCondStoresAggressively && (!IsWorthwhile(PTB, FreeStores) || !IsWorthwhile(PFB, FreeStores) || !IsWorthwhile(QTB, FreeStores) || !IsWorthwhile(QFB, FreeStores))) diff --git a/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp b/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp index 126228bce25a..6c0c841451da 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp @@ -377,11 +377,10 @@ fuseProducerOfDep(OpBuilder , LinalgOp consumer, unsigned consumerIdx, Optional mlir::linalg::fuseProducerOf( OpBuilder , LinalgOp consumer, unsigned consumerIdx, const LinalgDependenceGraph , OperationFolder *folder) { - SmallVector deps = { - LinalgDependenceGraph::DependenceType::RAW, - LinalgDependenceGraph::DependenceType::WAW, - }; - for (auto dep : deps) { + for (auto dep : { + LinalgDependenceGraph::DependenceType::RAW, + LinalgDependenceGraph::DependenceType::WAW, + }) { if (auto res = fuseProducerOfDep(b, consumer, consumerIdx, graph, folder, dep)) return res; diff --git a/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp b/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp index 7aeecdbbac35..83de4cc2e8fe 100644 --- a/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp +++ b/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp @@ -2849,9 +2849,9 @@ static ParseResult parseCooperativeMatrixLoadNVOp(OpAsmParser , parser.parseType(ptrType) || parser.parseKeywordType("as", elementType)) { return failure(); } - SmallVector OperandType = {ptrType, strideType, columnMajorType}; - if (parser.resolveOperands(operandInfo, OperandType,
[clang] b98e25b - Make helpers static. NFC.
Author: Benjamin Kramer Date: 2020-08-19T16:00:03+02:00 New Revision: b98e25b6d7231798a4d819aae3a93f6f1627931a URL: https://github.com/llvm/llvm-project/commit/b98e25b6d7231798a4d819aae3a93f6f1627931a DIFF: https://github.com/llvm/llvm-project/commit/b98e25b6d7231798a4d819aae3a93f6f1627931a.diff LOG: Make helpers static. NFC. Added: Modified: clang/lib/Tooling/Transformer/RewriteRule.cpp llvm/lib/ObjectYAML/DWARFEmitter.cpp llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp Removed: diff --git a/clang/lib/Tooling/Transformer/RewriteRule.cpp b/clang/lib/Tooling/Transformer/RewriteRule.cpp index 89497f67bbb5..fe33f9cf8b0c 100644 --- a/clang/lib/Tooling/Transformer/RewriteRule.cpp +++ b/clang/lib/Tooling/Transformer/RewriteRule.cpp @@ -242,7 +242,7 @@ class ApplyRuleCallback : public MatchFinder::MatchCallback { } // namespace template -llvm::Expected> +static llvm::Expected> rewriteDescendantsImpl(const T , RewriteRule Rule, const MatchResult ) { ApplyRuleCallback Callback(std::move(Rule)); diff --git a/llvm/lib/ObjectYAML/DWARFEmitter.cpp b/llvm/lib/ObjectYAML/DWARFEmitter.cpp index b0d2a8b42b9b..cb2bf16392f2 100644 --- a/llvm/lib/ObjectYAML/DWARFEmitter.cpp +++ b/llvm/lib/ObjectYAML/DWARFEmitter.cpp @@ -800,9 +800,9 @@ static Expected writeListEntry(raw_ostream , } template -Error writeDWARFLists(raw_ostream , - ArrayRef> Tables, - bool IsLittleEndian, bool Is64BitAddrSize) { +static Error writeDWARFLists(raw_ostream , + ArrayRef> Tables, + bool IsLittleEndian, bool Is64BitAddrSize) { for (const DWARFYAML::ListTable : Tables) { // sizeof(version) + sizeof(address_size) + sizeof(segment_selector_size) + // sizeof(offset_entry_count) = 8 diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index 77e38236686b..c6017b4fc577 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -3719,7 +3719,7 @@ Value *InstCombinerImpl::foldUnsignedMultiplicationOverflowCheck(ICmpInst ) { return Res; } -Instruction *foldICmpXNegX(ICmpInst ) { +static Instruction *foldICmpXNegX(ICmpInst ) { CmpInst::Predicate Pred; Value *X; if (!match(, m_c_ICmp(Pred, m_NSWNeg(m_Value(X)), m_Deferred(X diff --git a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp index 45f6f4d1cf31..23af60be585c 100644 --- a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp +++ b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp @@ -136,8 +136,8 @@ LogicalResult getMemRefAlignment(LLVMTypeConverter , T op, } // Helper that returns the base address of a memref. -LogicalResult getBase(ConversionPatternRewriter , Location loc, - Value memref, MemRefType memRefType, Value ) { +static LogicalResult getBase(ConversionPatternRewriter , Location loc, + Value memref, MemRefType memRefType, Value ) { // Inspect stride and offset structure. // // TODO: flat memory only for now, generalize @@ -153,8 +153,9 @@ LogicalResult getBase(ConversionPatternRewriter , Location loc, } // Helper that returns a pointer given a memref base. -LogicalResult getBasePtr(ConversionPatternRewriter , Location loc, - Value memref, MemRefType memRefType, Value ) { +static LogicalResult getBasePtr(ConversionPatternRewriter , +Location loc, Value memref, +MemRefType memRefType, Value ) { Value base; if (failed(getBase(rewriter, loc, memref, memRefType, base))) return failure(); @@ -164,9 +165,9 @@ LogicalResult getBasePtr(ConversionPatternRewriter , Location loc, } // Helper that returns a bit-casted pointer given a memref base. -LogicalResult getBasePtr(ConversionPatternRewriter , Location loc, - Value memref, MemRefType memRefType, Type type, - Value ) { +static LogicalResult getBasePtr(ConversionPatternRewriter , +Location loc, Value memref, +MemRefType memRefType, Type type, Value ) { Value base; if (failed(getBase(rewriter, loc, memref, memRefType, base))) return failure(); @@ -178,9 +179,10 @@ LogicalResult getBasePtr(ConversionPatternRewriter , Location loc, // Helper that returns vector of pointers given a memref base and an index // vector. -LogicalResult getIndexedPtrs(ConversionPatternRewriter , Location loc, - Value memref, Value