[clang] f529c0a - Fix unused variable warning. NFCI.
Author: Simon Pilgrim Date: 2020-06-11T13:48:42+01:00 New Revision: f529c0a8a149ce6d027400a12a1637eda19e03b5 URL: https://github.com/llvm/llvm-project/commit/f529c0a8a149ce6d027400a12a1637eda19e03b5 DIFF: https://github.com/llvm/llvm-project/commit/f529c0a8a149ce6d027400a12a1637eda19e03b5.diff LOG: Fix unused variable warning. NFCI. We're only using the D2 iteration value inside the assert (the only component of the loop) - move the entire loop inside the assert by using llvm::all_of. Added: Modified: clang/unittests/StaticAnalyzer/ParamRegionTest.cpp Removed: diff --git a/clang/unittests/StaticAnalyzer/ParamRegionTest.cpp b/clang/unittests/StaticAnalyzer/ParamRegionTest.cpp index 4edbeb30df1c..52789fdf5b9d 100644 --- a/clang/unittests/StaticAnalyzer/ParamRegionTest.cpp +++ b/clang/unittests/StaticAnalyzer/ParamRegionTest.cpp @@ -19,10 +19,10 @@ class ParamRegionTestConsumer : public ExprEngineConsumer { void checkForSameParamRegions(MemRegionManager , const StackFrameContext *SFC, const ParmVarDecl *PVD) { -for (const auto *D2: PVD->redecls()) { - assert(MRMgr.getVarRegion(PVD, SFC) == - MRMgr.getVarRegion(cast(D2), SFC)); -} +assert(llvm::all_of(PVD->redecls(), [](const clang::VarDecl *D2) { + return MRMgr.getVarRegion(PVD, SFC) == + MRMgr.getVarRegion(cast(D2), SFC) +})); } void performTest(const Decl *D) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 236129f - [CompilationDatabase] Pass Twine by const reference instead of by value. NFCI.
Author: Simon Pilgrim Date: 2021-01-07T12:53:28Z New Revision: 236129fb4460a4030eee685abc2f02b32458e775 URL: https://github.com/llvm/llvm-project/commit/236129fb4460a4030eee685abc2f02b32458e775 DIFF: https://github.com/llvm/llvm-project/commit/236129fb4460a4030eee685abc2f02b32458e775.diff LOG: [CompilationDatabase] Pass Twine by const reference instead of by value. NFCI. Added: Modified: clang/include/clang/Tooling/CompilationDatabase.h clang/lib/Tooling/CompilationDatabase.cpp Removed: diff --git a/clang/include/clang/Tooling/CompilationDatabase.h b/clang/include/clang/Tooling/CompilationDatabase.h index cbd57e9609aa..44af236347b3 100644 --- a/clang/include/clang/Tooling/CompilationDatabase.h +++ b/clang/include/clang/Tooling/CompilationDatabase.h @@ -43,10 +43,10 @@ namespace tooling { /// Specifies the working directory and command of a compilation. struct CompileCommand { CompileCommand() = default; - CompileCommand(Twine Directory, Twine Filename, - std::vector CommandLine, Twine Output) + CompileCommand(const Twine , const Twine , + std::vector CommandLine, const Twine ) : Directory(Directory.str()), Filename(Filename.str()), -CommandLine(std::move(CommandLine)), Output(Output.str()){} +CommandLine(std::move(CommandLine)), Output(Output.str()) {} /// The working directory the command was executed from. std::string Directory; @@ -180,9 +180,9 @@ class FixedCompilationDatabase : public CompilationDatabase { /// \param Argv Points to the command line arguments. /// \param ErrorMsg Contains error text if the function returns null pointer. /// \param Directory The base directory used in the FixedCompilationDatabase. - static std::unique_ptr loadFromCommandLine( - int , const char *const *Argv, std::string , - Twine Directory = "."); + static std::unique_ptr + loadFromCommandLine(int , const char *const *Argv, std::string , + const Twine = "."); /// Reads flags from the given file, one-per-line. /// Returns nullptr and sets ErrorMessage if we can't read the file. @@ -196,7 +196,8 @@ class FixedCompilationDatabase : public CompilationDatabase { /// Constructs a compilation data base from a specified directory /// and command line. - FixedCompilationDatabase(Twine Directory, ArrayRef CommandLine); + FixedCompilationDatabase(const Twine , + ArrayRef CommandLine); /// Returns the given compile command. /// diff --git a/clang/lib/Tooling/CompilationDatabase.cpp b/clang/lib/Tooling/CompilationDatabase.cpp index d339fd044c02..1e19e68633d2 100644 --- a/clang/lib/Tooling/CompilationDatabase.cpp +++ b/clang/lib/Tooling/CompilationDatabase.cpp @@ -323,7 +323,7 @@ std::unique_ptr FixedCompilationDatabase::loadFromCommandLine(int , const char *const *Argv, std::string , - Twine Directory) { + const Twine ) { ErrorMsg.clear(); if (Argc == 0) return nullptr; @@ -368,8 +368,8 @@ FixedCompilationDatabase::loadFromBuffer(StringRef Directory, StringRef Data, return std::make_unique(Directory, std::move(Args)); } -FixedCompilationDatabase:: -FixedCompilationDatabase(Twine Directory, ArrayRef CommandLine) { +FixedCompilationDatabase::FixedCompilationDatabase( +const Twine , ArrayRef CommandLine) { std::vector ToolCommandLine(1, GetClangToolCommand()); ToolCommandLine.insert(ToolCommandLine.end(), CommandLine.begin(), CommandLine.end()); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 25f5df7 - SemaType.cpp - use castAs<> instead of getAs<> for dereferenced pointers
Author: Simon Pilgrim Date: 2020-12-08T16:37:20Z New Revision: 25f5df7e0bc950ad244e8da000ce4248bd41c140 URL: https://github.com/llvm/llvm-project/commit/25f5df7e0bc950ad244e8da000ce4248bd41c140 DIFF: https://github.com/llvm/llvm-project/commit/25f5df7e0bc950ad244e8da000ce4248bd41c140.diff LOG: SemaType.cpp - use castAs<> instead of getAs<> for dereferenced pointers Fix static analyzer warnings - castAs<> will assert the type is correct, but getAs<> just returns null, which would just result in a dereferenced null pointer. Added: Modified: clang/lib/Sema/SemaType.cpp Removed: diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index df46aa3bfc1f..fbdbfbc9f8ec 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -7967,7 +7967,7 @@ static void HandleOpenCLAccessAttr(QualType , const ParsedAttr , diag::note_opencl_typedef_access_qualifier) << PrevAccessQual; } else if (CurType->isPipeType()) { if (Attr.getSemanticSpelling() == OpenCLAccessAttr::Keyword_write_only) { - QualType ElemType = CurType->getAs()->getElementType(); + QualType ElemType = CurType->castAs()->getElementType(); CurType = S.Context.getWritePipeType(ElemType); } } @@ -9021,7 +9021,7 @@ QualType Sema::BuildUnaryTransformType(QualType BaseType, return QualType(); } -EnumDecl *ED = BaseType->getAs()->getDecl(); +EnumDecl *ED = BaseType->castAs()->getDecl(); assert(ED && "EnumType has no EnumDecl"); DiagnoseUseOfDecl(ED, Loc); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 9d996c0 - TargetInfo.cpp - use castAs<> instead of getAs<> as we dereference the pointer directly. NFCI.
Author: Simon Pilgrim Date: 2020-11-25T11:38:29Z New Revision: 9d996c01aad5371ccf3790ce937b1cc85d1b07ab URL: https://github.com/llvm/llvm-project/commit/9d996c01aad5371ccf3790ce937b1cc85d1b07ab DIFF: https://github.com/llvm/llvm-project/commit/9d996c01aad5371ccf3790ce937b1cc85d1b07ab.diff LOG: TargetInfo.cpp - use castAs<> instead of getAs<> as we dereference the pointer directly. NFCI. castAs<> will assert the correct cast type instead of just returning null, which we then try to dereference immediately. Added: Modified: clang/lib/CodeGen/TargetInfo.cpp Removed: diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 64240b1bde20c..06b24c0384d8a 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -10394,7 +10394,7 @@ void RISCVABIInfo::computeInfo(CGFunctionInfo ) const { if (!IsRetIndirect && RetTy->isScalarType() && getContext().getTypeSize(RetTy) > (2 * XLen)) { if (RetTy->isComplexType() && FLen) { - QualType EltTy = RetTy->getAs()->getElementType(); + QualType EltTy = RetTy->castAs()->getElementType(); IsRetIndirect = getContext().getTypeSize(EltTy) > FLen; } else { // This is a normal scalar > 2*XLen, such as fp128 on RV32. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 88bb265 - SemaExpr.cpp - use castAs<> instead of getAs<> as we dereference the pointer directly. NFCI.
Author: Simon Pilgrim Date: 2020-11-25T11:38:30Z New Revision: 88bb2656708050bdb012c9046b3e30f3975f9949 URL: https://github.com/llvm/llvm-project/commit/88bb2656708050bdb012c9046b3e30f3975f9949 DIFF: https://github.com/llvm/llvm-project/commit/88bb2656708050bdb012c9046b3e30f3975f9949.diff LOG: SemaExpr.cpp - use castAs<> instead of getAs<> as we dereference the pointer directly. NFCI. castAs<> will assert the correct cast type instead of just returning null, which we then try to dereference immediately. Added: Modified: clang/lib/Sema/SemaExpr.cpp Removed: diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 859caed8fd866..d25d91223826e 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -3778,8 +3778,7 @@ ExprResult Sema::ActOnNumericConstant(const Token , Scope *UDLScope) { if (Ty == Context.DoubleTy) { if (getLangOpts().SinglePrecisionConstants) { -const BuiltinType *BTy = Ty->getAs(); -if (BTy->getKind() != BuiltinType::Float) { +if (Ty->castAs()->getKind() != BuiltinType::Float) { Res = ImpCastExprToType(Res, Context.FloatTy, CK_FloatingCast).get(); } } else if (getLangOpts().OpenCL && ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 6d56823 - SemaExpr.cpp - use castAs<> instead of getAs<> as we dereference the pointer directly. NFCI.
Author: Simon Pilgrim Date: 2020-11-25T11:38:29Z New Revision: 6d56823116820962984cdd535cbed1191be696c9 URL: https://github.com/llvm/llvm-project/commit/6d56823116820962984cdd535cbed1191be696c9 DIFF: https://github.com/llvm/llvm-project/commit/6d56823116820962984cdd535cbed1191be696c9.diff LOG: SemaExpr.cpp - use castAs<> instead of getAs<> as we dereference the pointer directly. NFCI. castAs<> will assert the correct cast type instead of just returning null, which we then try to dereference immediately. Added: Modified: clang/lib/Sema/SemaExpr.cpp Removed: diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 5580cdf136914..859caed8fd866 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -15166,10 +15166,10 @@ void Sema::ActOnBlockArguments(SourceLocation CaretLoc, Declarator , CurBlock->TheDecl->setSignatureAsWritten(Sig); CurBlock->FunctionType = T; - const FunctionType *Fn = T->getAs(); + const auto *Fn = T->castAs(); QualType RetTy = Fn->getReturnType(); bool isVariadic = -(isa(Fn) && cast(Fn)->isVariadic()); + (isa(Fn) && cast(Fn)->isVariadic()); CurBlock->TheDecl->setIsVariadic(isVariadic); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] eb7ea5a - CGCall.cpp - use castAs<> instead of getAs<> as we dereference the pointer directly. NFCI.
Author: Simon Pilgrim Date: 2020-11-25T11:38:29Z New Revision: eb7ea5aa1ac6030b7bc94c5f2fb42de675cd392f URL: https://github.com/llvm/llvm-project/commit/eb7ea5aa1ac6030b7bc94c5f2fb42de675cd392f DIFF: https://github.com/llvm/llvm-project/commit/eb7ea5aa1ac6030b7bc94c5f2fb42de675cd392f.diff LOG: CGCall.cpp - use castAs<> instead of getAs<> as we dereference the pointer directly. NFCI. castAs<> will assert the correct cast type instead of just returning null, which we then try to dereference immediately in the setUsedBits call. Added: Modified: clang/lib/CodeGen/CGCall.cpp Removed: diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 2558dd42fac1e..78740018d416c 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -3153,7 +3153,7 @@ llvm::Value *CodeGenFunction::EmitCMSEClearRecord(llvm::Value *Src, const llvm::DataLayout = CGM.getDataLayout(); int Size = DataLayout.getTypeStoreSize(ITy); SmallVector Bits(Size); - setUsedBits(CGM, QTy->getAs(), 0, Bits); + setUsedBits(CGM, QTy->castAs(), 0, Bits); int CharWidth = CGM.getContext().getCharWidth(); uint64_t Mask = @@ -3170,7 +3170,7 @@ llvm::Value *CodeGenFunction::EmitCMSEClearRecord(llvm::Value *Src, const llvm::DataLayout = CGM.getDataLayout(); int Size = DataLayout.getTypeStoreSize(ATy); SmallVector Bits(Size); - setUsedBits(CGM, QTy->getAs(), 0, Bits); + setUsedBits(CGM, QTy->castAs(), 0, Bits); // Clear each element of the LLVM array. int CharWidth = CGM.getContext().getCharWidth(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 4855a10 - [X86] Convert fadd/fmul _mm_reduce_* intrinsics to emit llvm.reduction intrinsics (PR47506)
Author: Simon Pilgrim Date: 2020-12-13T15:37:35Z New Revision: 4855a1004d4d87b6c21c510c1724e74a8d37d91a URL: https://github.com/llvm/llvm-project/commit/4855a1004d4d87b6c21c510c1724e74a8d37d91a DIFF: https://github.com/llvm/llvm-project/commit/4855a1004d4d87b6c21c510c1724e74a8d37d91a.diff LOG: [X86] Convert fadd/fmul _mm_reduce_* intrinsics to emit llvm.reduction intrinsics (PR47506) Followup to D87604, having confirmed on PR47506 that we can use the llvm codegen expansion for fadd/fmul as well. Differential Revision: https://reviews.llvm.org/D92940 Added: Modified: clang/include/clang/Basic/BuiltinsX86.def clang/lib/CodeGen/CGBuiltin.cpp clang/lib/Headers/avx512fintrin.h clang/test/CodeGen/X86/avx512-reduceIntrin.c Removed: diff --git a/clang/include/clang/Basic/BuiltinsX86.def b/clang/include/clang/Basic/BuiltinsX86.def index 0f5594f1a4e6..16fb7dd7b0e6 100644 --- a/clang/include/clang/Basic/BuiltinsX86.def +++ b/clang/include/clang/Basic/BuiltinsX86.def @@ -1876,6 +1876,10 @@ TARGET_BUILTIN(__builtin_ia32_reduce_add_d512, "iV16i", "ncV:512:", "avx512f") TARGET_BUILTIN(__builtin_ia32_reduce_add_q512, "OiV8Oi", "ncV:512:", "avx512f") TARGET_BUILTIN(__builtin_ia32_reduce_and_d512, "iV16i", "ncV:512:", "avx512f") TARGET_BUILTIN(__builtin_ia32_reduce_and_q512, "OiV8Oi", "ncV:512:", "avx512f") +TARGET_BUILTIN(__builtin_ia32_reduce_fadd_pd512, "ddV8d", "ncV:512:", "avx512f") +TARGET_BUILTIN(__builtin_ia32_reduce_fadd_ps512, "ffV16f", "ncV:512:", "avx512f") +TARGET_BUILTIN(__builtin_ia32_reduce_fmul_pd512, "ddV8d", "ncV:512:", "avx512f") +TARGET_BUILTIN(__builtin_ia32_reduce_fmul_ps512, "ffV16f", "ncV:512:", "avx512f") TARGET_BUILTIN(__builtin_ia32_reduce_mul_d512, "iV16i", "ncV:512:", "avx512f") TARGET_BUILTIN(__builtin_ia32_reduce_mul_q512, "OiV8Oi", "ncV:512:", "avx512f") TARGET_BUILTIN(__builtin_ia32_reduce_or_d512, "iV16i", "ncV:512:", "avx512f") diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 316a60c31fd4..74f6c9fee2c8 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -13631,6 +13631,18 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, CGM.getIntrinsic(Intrinsic::vector_reduce_and, Ops[0]->getType()); return Builder.CreateCall(F, {Ops[0]}); } + case X86::BI__builtin_ia32_reduce_fadd_pd512: + case X86::BI__builtin_ia32_reduce_fadd_ps512: { +Function *F = +CGM.getIntrinsic(Intrinsic::vector_reduce_fadd, Ops[1]->getType()); +return Builder.CreateCall(F, {Ops[0], Ops[1]}); + } + case X86::BI__builtin_ia32_reduce_fmul_pd512: + case X86::BI__builtin_ia32_reduce_fmul_ps512: { +Function *F = +CGM.getIntrinsic(Intrinsic::vector_reduce_fmul, Ops[1]->getType()); +return Builder.CreateCall(F, {Ops[0], Ops[1]}); + } case X86::BI__builtin_ia32_reduce_mul_d512: case X86::BI__builtin_ia32_reduce_mul_q512: { Function *F = diff --git a/clang/lib/Headers/avx512fintrin.h b/clang/lib/Headers/avx512fintrin.h index 2df399d978e3..2ee4350b14d4 100644 --- a/clang/lib/Headers/avx512fintrin.h +++ b/clang/lib/Headers/avx512fintrin.h @@ -9345,37 +9345,25 @@ _mm512_mask_reduce_or_epi64(__mmask8 __M, __m512i __W) { return __builtin_ia32_reduce_or_q512(__W); } -#define _mm512_mask_reduce_operator(op) \ - __m256d __t1 = _mm512_extractf64x4_pd(__W, 0); \ - __m256d __t2 = _mm512_extractf64x4_pd(__W, 1); \ - __m256d __t3 = __t1 op __t2; \ - __m128d __t4 = _mm256_extractf128_pd(__t3, 0); \ - __m128d __t5 = _mm256_extractf128_pd(__t3, 1); \ - __m128d __t6 = __t4 op __t5; \ - __m128d __t7 = __builtin_shufflevector(__t6, __t6, 1, 0); \ - __m128d __t8 = __t6 op __t7; \ - return __t8[0] - static __inline__ double __DEFAULT_FN_ATTRS512 _mm512_reduce_add_pd(__m512d __W) { - _mm512_mask_reduce_operator(+); + return __builtin_ia32_reduce_fadd_pd512(0.0, __W); } static __inline__ double __DEFAULT_FN_ATTRS512 _mm512_reduce_mul_pd(__m512d __W) { - _mm512_mask_reduce_operator(*); + return __builtin_ia32_reduce_fmul_pd512(1.0, __W); } static __inline__ double __DEFAULT_FN_ATTRS512 _mm512_mask_reduce_add_pd(__mmask8 __M, __m512d __W) { __W = _mm512_maskz_mov_pd(__M, __W); - _mm512_mask_reduce_operator(+); + return __builtin_ia32_reduce_fadd_pd512(0.0, __W); } static __inline__ double __DEFAULT_FN_ATTRS512 _mm512_mask_reduce_mul_pd(__mmask8 __M, __m512d __W) { __W = _mm512_mask_mov_pd(_mm512_set1_pd(1.0), __M, __W); - _mm512_mask_reduce_operator(*); + return __builtin_ia32_reduce_fmul_pd512(1.0, __W); } -#undef _mm512_mask_reduce_operator static __inline__ int __DEFAULT_FN_ATTRS512 _mm512_reduce_add_epi32(__m512i __W) { @@ -9421,41 +9409,27 @@ _mm512_mask_reduce_or_epi32(__mmask16 __M, __m512i __W) { return __builtin_ia32_reduce_or_d512((__v16si)__W); } -#define _mm512_mask_reduce_operator(op) \ - __m256
[clang] 7e84aa1 - Fix MSVC "not all control paths return a value" warnings. NFCI.
Author: Simon Pilgrim Date: 2020-12-20T11:32:40Z New Revision: 7e84aa1b81e72d44bcc58ffe1731bfc7abb73ce0 URL: https://github.com/llvm/llvm-project/commit/7e84aa1b81e72d44bcc58ffe1731bfc7abb73ce0 DIFF: https://github.com/llvm/llvm-project/commit/7e84aa1b81e72d44bcc58ffe1731bfc7abb73ce0.diff LOG: Fix MSVC "not all control paths return a value" warnings. NFCI. Add missing llvm_unreachable()'s after each all-enums switch statement. Added: Modified: clang/lib/Sema/SemaTemplate.cpp Removed: diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 74a31c0a1b65..9d31a8701241 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -7637,6 +7637,7 @@ static Expr *BuildExpressionFromNonTypeTemplateArgumentValue( auto *OVE = new (S.Context) OpaqueValueExpr(Loc, T, VK); return ConstantExpr::Create(S.Context, OVE, Val); } + llvm_unreachable("Unhandled APValue::ValueKind enum"); } ExprResult @@ -7666,6 +7667,7 @@ Sema::BuildExpressionFromNonTypeTemplateArgument(const TemplateArgument , return BuildExpressionFromNonTypeTemplateArgumentValue( *this, Arg.getUncommonValueType(), Arg.getAsUncommonValue(), Loc); } + llvm_unreachable("Unhandled TemplateArgument::ArgKind enum"); } /// Match two template parameters within template parameter lists. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 8930032 - Don't dereference a dyn_cast<> result - use cast<> instead. NFCI.
Author: Simon Pilgrim Date: 2020-11-08T13:06:07Z New Revision: 8930032f53322405ca2d06cac78b9503542e5b62 URL: https://github.com/llvm/llvm-project/commit/8930032f53322405ca2d06cac78b9503542e5b62 DIFF: https://github.com/llvm/llvm-project/commit/8930032f53322405ca2d06cac78b9503542e5b62.diff LOG: Don't dereference a dyn_cast<> result - use cast<> instead. NFCI. We were relying on the dyn_cast<> succeeding - better use cast<> and have it assert that its the correct type than dereference a null result. Added: Modified: clang/lib/CodeGen/CodeGenModule.cpp Removed: diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index ccf5d24bb9eb..d8b819cf5bee 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -372,7 +372,7 @@ void CodeGenModule::checkAliases() { for (const GlobalDecl : Aliases) { StringRef MangledName = getMangledName(GD); llvm::GlobalValue *Entry = GetGlobalValue(MangledName); -auto *Alias = dyn_cast(Entry); +auto *Alias = cast(Entry); Alias->replaceAllUsesWith(llvm::UndefValue::get(Alias->getType())); Alias->eraseFromParent(); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] defc597 - Add a llvm_unreachable to fix MSVC unhandled enum warning. NFCI.
Author: Simon Pilgrim Date: 2020-11-10T10:43:45Z New Revision: defc59734a00cc0f476f6a93c35fd0b313ed587a URL: https://github.com/llvm/llvm-project/commit/defc59734a00cc0f476f6a93c35fd0b313ed587a DIFF: https://github.com/llvm/llvm-project/commit/defc59734a00cc0f476f6a93c35fd0b313ed587a.diff LOG: Add a llvm_unreachable to fix MSVC unhandled enum warning. NFCI. Added: Modified: clang/lib/AST/ItaniumMangle.cpp Removed: diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index 2cf69d34d472..1cf178fdd988 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -5028,6 +5028,8 @@ static bool isZeroInitialized(QualType T, const APValue ) { case APValue::MemberPointer: return !V.getMemberPointerDecl(); } + + llvm_unreachable("Unhandled APValue::ValueKind enum"); } void CXXNameMangler::mangleValueInTemplateArg(QualType T, const APValue ) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 3e5533b - [CodeGen] Remove unused check prefixes
Author: Simon Pilgrim Date: 2020-11-11T14:57:38Z New Revision: 3e5533bafdc956c3ba04acfb430a68d8c13765ce URL: https://github.com/llvm/llvm-project/commit/3e5533bafdc956c3ba04acfb430a68d8c13765ce DIFF: https://github.com/llvm/llvm-project/commit/3e5533bafdc956c3ba04acfb430a68d8c13765ce.diff LOG: [CodeGen] Remove unused check prefixes Added: Modified: clang/test/CodeGen/arm-varargs.c clang/test/CodeGen/asan-static-odr.cpp clang/test/CodeGen/ms-barriers-intrinsics.c clang/test/CodeGen/ms-mixed-ptr-sizes.c clang/test/CodeGen/ppc-smmintrin.c Removed: diff --git a/clang/test/CodeGen/arm-varargs.c b/clang/test/CodeGen/arm-varargs.c index b4d629978e8a..40f562796acc 100644 --- a/clang/test/CodeGen/arm-varargs.c +++ b/clang/test/CodeGen/arm-varargs.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple arm-none-eabi -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-LE %s -// RUN: %clang_cc1 -triple armeb-none-eabi -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-BE %s +// RUN: %clang_cc1 -triple arm-none-eabi -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple armeb-none-eabi -emit-llvm -o - %s | FileCheck %s #include diff --git a/clang/test/CodeGen/asan-static-odr.cpp b/clang/test/CodeGen/asan-static-odr.cpp index 6b23b62e16fb..7ec3a306cd39 100644 --- a/clang/test/CodeGen/asan-static-odr.cpp +++ b/clang/test/CodeGen/asan-static-odr.cpp @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s --check-prefixes=CHECK,ALIAS1 +// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s // No alias on Windows but indicators should work. -// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple x86_64-windows-msvc %s | FileCheck %s --check-prefixes=CHECK,ALIAS0 +// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple x86_64-windows-msvc %s | FileCheck %s static int global; diff --git a/clang/test/CodeGen/ms-barriers-intrinsics.c b/clang/test/CodeGen/ms-barriers-intrinsics.c index 7f87c9017046..e0e948209e3e 100644 --- a/clang/test/CodeGen/ms-barriers-intrinsics.c +++ b/clang/test/CodeGen/ms-barriers-intrinsics.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \ // RUN: -triple i686--windows -emit-llvm %s -o - \ -// RUN: | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-I386 +// RUN: | FileCheck %s // RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \ // RUN: -triple x86_64--windows -emit-llvm %s -o - \ // RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-X64 diff --git a/clang/test/CodeGen/ms-mixed-ptr-sizes.c b/clang/test/CodeGen/ms-mixed-ptr-sizes.c index 111d29b4bb03..08e4a5f81cff 100644 --- a/clang/test/CodeGen/ms-mixed-ptr-sizes.c +++ b/clang/test/CodeGen/ms-mixed-ptr-sizes.c @@ -1,7 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-windows-msvc -fms-extensions -emit-llvm -O2 \ -// RUN: < %s | FileCheck %s --check-prefixes=X64,CHECK -// RUN: %clang_cc1 -triple i386-pc-win32 -fms-extensions -emit-llvm -O2 \ -// RUN: < %s | FileCheck %s --check-prefixes=X86,CHECK +// RUN: %clang_cc1 -triple x86_64-windows-msvc -fms-extensions -emit-llvm -O2 < %s | FileCheck %s --check-prefix=X64 +// RUN: %clang_cc1 -triple i386-pc-win32 -fms-extensions -emit-llvm -O2 < %s | FileCheck %s --check-prefix=X86 struct Foo { int * __ptr32 p32; diff --git a/clang/test/CodeGen/ppc-smmintrin.c b/clang/test/CodeGen/ppc-smmintrin.c index 8deec9ee650a..644037f03afb 100644 --- a/clang/test/CodeGen/ppc-smmintrin.c +++ b/clang/test/CodeGen/ppc-smmintrin.c @@ -2,9 +2,9 @@ // REQUIRES: powerpc-registered-target // RUN: %clang -S -emit-llvm -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \ -// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,LE +// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s // RUN: %clang -S -emit-llvm -target powerpc64-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \ -// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,BE +// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s #include ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 8cb97fb - [CodeGen] Fix check prefix mismatch on neon-immediate-ubsan.c tests
Author: Simon Pilgrim Date: 2020-11-11T14:57:37Z New Revision: 8cb97fb9c9c76878afcd6678ab5311ee2766530d URL: https://github.com/llvm/llvm-project/commit/8cb97fb9c9c76878afcd6678ab5311ee2766530d DIFF: https://github.com/llvm/llvm-project/commit/8cb97fb9c9c76878afcd6678ab5311ee2766530d.diff LOG: [CodeGen] Fix check prefix mismatch on neon-immediate-ubsan.c tests Noticed while fixing unused prefix warnings, Added: Modified: clang/test/CodeGen/neon-immediate-ubsan.c Removed: diff --git a/clang/test/CodeGen/neon-immediate-ubsan.c b/clang/test/CodeGen/neon-immediate-ubsan.c index aacf76a6338b..69a54c846421 100644 --- a/clang/test/CodeGen/neon-immediate-ubsan.c +++ b/clang/test/CodeGen/neon-immediate-ubsan.c @@ -1,12 +1,12 @@ // RUN: %clang_cc1 -triple armv7s-linux-gnu -target-abi apcs-gnu -emit-llvm -o - %s \ // RUN: -target-feature +neon -target-cpu cortex-a8 \ // RUN: -fsanitize=signed-integer-overflow \ -// RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=ARMV7 +// RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-ARMV7 // RUN: %clang_cc1 -triple aarch64-unknown-unknown -emit-llvm -o - %s \ // RUN: -target-feature +neon -target-cpu cortex-a53 \ // RUN: -fsanitize=signed-integer-overflow \ -// RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=AARCH64 +// RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-AARCH64 // Verify we emit constants for "immediate" builtin arguments. // Emitting a scalar expression can make the immediate be generated as ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] c1e3d38 - [CodeGenOpenCL] Fix check prefix typo on convergent.cl test
Author: Simon Pilgrim Date: 2020-11-11T15:44:59Z New Revision: c1e3d38301c305357debcedbda4999335fd727cc URL: https://github.com/llvm/llvm-project/commit/c1e3d38301c305357debcedbda4999335fd727cc DIFF: https://github.com/llvm/llvm-project/commit/c1e3d38301c305357debcedbda4999335fd727cc.diff LOG: [CodeGenOpenCL] Fix check prefix typo on convergent.cl test Noticed while fixing unused prefix warnings - there isn't actually any diff in the loop unrolled ir between old/new pass managers any more, so the broken checks were superfluous Added: Modified: clang/test/CodeGenOpenCL/convergent.cl Removed: diff --git a/clang/test/CodeGenOpenCL/convergent.cl b/clang/test/CodeGenOpenCL/convergent.cl index f7d4cea8373d..ffcd8f495dbe 100644 --- a/clang/test/CodeGenOpenCL/convergent.cl +++ b/clang/test/CodeGenOpenCL/convergent.cl @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm %s -o - -fno-experimental-new-pass-manager | opt -instnamer -S | FileCheck -enable-var-scope %s --check-prefixes=CHECK,CHECK-LEGACY -// RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm %s -o - -fexperimental-new-pass-manager | opt -instnamer -S | FileCheck -enable-var-scope %s --check-prefixes=CHECK,CHECK-NEWPM +// RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm %s -o - -fno-experimental-new-pass-manager | opt -instnamer -S | FileCheck -enable-var-scope %s +// RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm %s -o - -fexperimental-new-pass-manager | opt -instnamer -S | FileCheck -enable-var-scope %s // This is initially assumed convergent, but can be deduced to not require it. @@ -118,12 +118,7 @@ void test_unroll() { // CHECK: [[for_body]]: // CHECK: tail call spir_func void @nodupfun() #[[attr5:[0-9]+]] // CHECK-NOT: call spir_func void @nodupfun() - -// The new PM produces a slightly diff erent IR for the loop from the legacy PM, -// but the test still checks that the loop is not unrolled. -// CHECK-LEGACY: br i1 %{{.+}}, label %[[for_body]], label %[[for_cond_cleanup]] -// CHECK-NEW: br i1 %{{.+}}, label %[[for_body_crit_edge:.+]], label %[[for_cond_cleanup]] -// CHECK-NEW: [[for_body_crit_edge]]: +// CHECK: br i1 %{{.+}}, label %[[for_body]], label %[[for_cond_cleanup]] void test_not_unroll() { for (int i = 0; i < 10; i++) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fc80931 - [CodeGenCUDA] Fix check prefix typo on device-stub.cu tests
Author: Simon Pilgrim Date: 2020-11-11T15:44:57Z New Revision: fc80931b87661ade91502d5301ae90f06560343b URL: https://github.com/llvm/llvm-project/commit/fc80931b87661ade91502d5301ae90f06560343b DIFF: https://github.com/llvm/llvm-project/commit/fc80931b87661ade91502d5301ae90f06560343b.diff LOG: [CodeGenCUDA] Fix check prefix typo on device-stub.cu tests Noticed while fixing unused prefix warnings Added: Modified: clang/test/CodeGenCUDA/device-stub.cu Removed: diff --git a/clang/test/CodeGenCUDA/device-stub.cu b/clang/test/CodeGenCUDA/device-stub.cu index 16bbef6cfad5..6770c1e6e0ea 100644 --- a/clang/test/CodeGenCUDA/device-stub.cu +++ b/clang/test/CodeGenCUDA/device-stub.cu @@ -28,11 +28,11 @@ // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm %s \ // RUN: -target-sdk-version=9.2 -fgpu-rdc -fcuda-include-gpubinary %t -o - \ // RUN: | FileCheck %s -allow-deprecated-dag-overlap \ -// RUN: --check-prefixes=ALL,LNX,RDC,CUDA,CUDARDC,CUDA_NEW +// RUN: --check-prefixes=ALL,LNX,RDC,CUDA,CUDARDC,CUDA-NEW // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm %s -std=c++17 \ // RUN: -target-sdk-version=9.2 -fgpu-rdc -fcuda-include-gpubinary %t -o - \ // RUN: | FileCheck %s -allow-deprecated-dag-overlap \ -// RUN: --check-prefixes=ALL,LNX,RDC,CUDA,CUDARDC,CUDA_NEW,LNX_17 +// RUN: --check-prefixes=ALL,LNX,RDC,CUDA,CUDARDC,CUDA-NEW,LNX_17 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm %s \ // RUN: -target-sdk-version=9.2 -o - \ // RUN: | FileCheck -allow-deprecated-dag-overlap %s -check-prefix=NOGPUBIN ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 10fc39b - [CodeGenObjC] Remove unused check prefixes
Author: Simon Pilgrim Date: 2020-11-11T15:44:58Z New Revision: 10fc39b29171cce5629bf5da09224ae5ac33d7ed URL: https://github.com/llvm/llvm-project/commit/10fc39b29171cce5629bf5da09224ae5ac33d7ed DIFF: https://github.com/llvm/llvm-project/commit/10fc39b29171cce5629bf5da09224ae5ac33d7ed.diff LOG: [CodeGenObjC] Remove unused check prefixes Added: Modified: clang/test/CodeGenObjC/arc-captured-block-var-inlined-layout.m clang/test/CodeGenObjC/mrr-captured-block-var-inlined-layout.m Removed: diff --git a/clang/test/CodeGenObjC/arc-captured-block-var-inlined-layout.m b/clang/test/CodeGenObjC/arc-captured-block-var-inlined-layout.m index 07b194da9435..022b0969a7eb 100644 --- a/clang/test/CodeGenObjC/arc-captured-block-var-inlined-layout.m +++ b/clang/test/CodeGenObjC/arc-captured-block-var-inlined-layout.m @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -triple x86_64-apple-darwin -print-ivar-layout -emit-llvm -o /dev/null %s > %t-64.layout -// RUN: FileCheck -check-prefix=CHECK -check-prefix=CHECK-64 --input-file=%t-64.layout %s +// RUN: FileCheck --input-file=%t-64.layout %s // RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -triple i386-apple-darwin -print-ivar-layout -emit-llvm -o /dev/null %s > %t-32.layout -// RUN: FileCheck -check-prefix=CHECK -check-prefix=CHECK-32 --input-file=%t-32.layout %s +// RUN: FileCheck --input-file=%t-32.layout %s // rdar://12184410 void x(id y) {} diff --git a/clang/test/CodeGenObjC/mrr-captured-block-var-inlined-layout.m b/clang/test/CodeGenObjC/mrr-captured-block-var-inlined-layout.m index 76b7cfd118b5..c196e5d3531a 100644 --- a/clang/test/CodeGenObjC/mrr-captured-block-var-inlined-layout.m +++ b/clang/test/CodeGenObjC/mrr-captured-block-var-inlined-layout.m @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fblocks -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin -print-ivar-layout -emit-llvm -o /dev/null %s > %t-64.layout -// RUN: FileCheck -check-prefix=CHECK -check-prefix=CHECK-64 --input-file=%t-64.layout %s +// RUN: FileCheck --input-file=%t-64.layout %s // RUN: %clang_cc1 -fblocks -fobjc-runtime-has-weak -fobjc-arc -triple i386-apple-darwin -print-ivar-layout -emit-llvm -o /dev/null %s > %t-32.layout -// RUN: FileCheck -check-prefix=CHECK -check-prefix=CHECK-32 --input-file=%t-32.layout %s +// RUN: FileCheck --input-file=%t-32.layout %s // rdar://12184410 // rdar://12184410 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] deb543a - [Driver] hip-toolchain-device-only.hip - remove unused check prefix
Author: Simon Pilgrim Date: 2020-11-11T18:00:03Z New Revision: deb543ae70810ec458eb1ea43d15343b4cfad506 URL: https://github.com/llvm/llvm-project/commit/deb543ae70810ec458eb1ea43d15343b4cfad506 DIFF: https://github.com/llvm/llvm-project/commit/deb543ae70810ec458eb1ea43d15343b4cfad506.diff LOG: [Driver] hip-toolchain-device-only.hip - remove unused check prefix Just use default CHECK Added: Modified: clang/test/Driver/hip-toolchain-device-only.hip Removed: diff --git a/clang/test/Driver/hip-toolchain-device-only.hip b/clang/test/Driver/hip-toolchain-device-only.hip index 19afeca113ba..e05447f426bd 100644 --- a/clang/test/Driver/hip-toolchain-device-only.hip +++ b/clang/test/Driver/hip-toolchain-device-only.hip @@ -3,7 +3,7 @@ // RUN: %clang -### -target x86_64-linux-gnu \ // RUN: --offload-arch=gfx803 --offload-arch=gfx900 \ // RUN: --cuda-device-only -nogpuinc -nogpulib -c \ -// RUN: %s 2>&1 | FileCheck -check-prefixes=CHECK,LINK %s +// RUN: %s 2>&1 | FileCheck %s // CHECK-NOT: error: ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] e3b64eb - [CodeGenCXX] Remove unused check prefixes
Author: Simon Pilgrim Date: 2020-11-11T16:19:53Z New Revision: e3b64eb31c0e9a9f1ac4891b834d71532e545cad URL: https://github.com/llvm/llvm-project/commit/e3b64eb31c0e9a9f1ac4891b834d71532e545cad DIFF: https://github.com/llvm/llvm-project/commit/e3b64eb31c0e9a9f1ac4891b834d71532e545cad.diff LOG: [CodeGenCXX] Remove unused check prefixes Added: Modified: clang/test/CodeGenCXX/aix-static-init-debug-info.cpp clang/test/CodeGenCXX/attr-cpuspecific.cpp clang/test/CodeGenCXX/bitfield-layout.cpp clang/test/CodeGenCXX/catch-implicit-integer-sign-changes-true-negatives.cpp clang/test/CodeGenCXX/catch-implicit-integer-truncations.cpp clang/test/CodeGenCXX/conditional-temporaries.cpp clang/test/CodeGenCXX/dllexport.cpp clang/test/CodeGenCXX/dllimport.cpp clang/test/CodeGenCXX/exceptions-seh-filter-captures.cpp clang/test/CodeGenCXX/inheriting-constructor.cpp clang/test/CodeGenCXX/lifetime-sanitizer.cpp clang/test/CodeGenCXX/mangle-ms-cxx17.cpp clang/test/CodeGenCXX/member-function-pointer-calls.cpp clang/test/CodeGenCXX/runtime-dllstorage.cpp clang/test/CodeGenCXX/ubsan-vtable-checks.cpp Removed: diff --git a/clang/test/CodeGenCXX/aix-static-init-debug-info.cpp b/clang/test/CodeGenCXX/aix-static-init-debug-info.cpp index 222956a223d2..7a98d56ca0d9 100644 --- a/clang/test/CodeGenCXX/aix-static-init-debug-info.cpp +++ b/clang/test/CodeGenCXX/aix-static-init-debug-info.cpp @@ -1,10 +1,10 @@ // RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -emit-llvm -x c++ \ // RUN: -debug-info-kind=limited < %s | \ -// RUN: FileCheck --check-prefixes=CHECK,CHECK64 %s +// RUN: FileCheck %s // RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -emit-llvm -x c++ \ // RUN: -debug-info-kind=limited < %s | \ -// RUN: FileCheck --check-prefixes=CHECK,CHECK64 %s +// RUN: FileCheck %s struct X { X(); diff --git a/clang/test/CodeGenCXX/attr-cpuspecific.cpp b/clang/test/CodeGenCXX/attr-cpuspecific.cpp index efe6921ec11e..f934f4f19164 100644 --- a/clang/test/CodeGenCXX/attr-cpuspecific.cpp +++ b/clang/test/CodeGenCXX/attr-cpuspecific.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,LINUX -// RUN: %clang_cc1 -triple x86_64-windows-pc -fms-compatibility -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,WINDOWS +// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s --check-prefix=LINUX +// RUN: %clang_cc1 -triple x86_64-windows-pc -fms-compatibility -emit-llvm -o - %s | FileCheck %s --check-prefix=WINDOWS struct S { __attribute__((cpu_specific(atom))) diff --git a/clang/test/CodeGenCXX/bitfield-layout.cpp b/clang/test/CodeGenCXX/bitfield-layout.cpp index d8f8c87eb28b..c0bd2aa8b779 100644 --- a/clang/test/CodeGenCXX/bitfield-layout.cpp +++ b/clang/test/CodeGenCXX/bitfield-layout.cpp @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -O3 | FileCheck -check-prefix=CHECK-LP64 -check-prefix=CHECK %s -// RUN: %clang_cc1 %s -triple=i386-apple-darwin10 -emit-llvm -o - -O3 | FileCheck -check-prefix CHECK-LP32 -check-prefix=CHECK %s -// RUN: %clang_cc1 %s -triple=aarch64_be-none-eabi -emit-llvm -o - -O3 | FileCheck -check-prefix CHECK-A64BE -check-prefix=CHECK %s -// RUN: %clang_cc1 %s -triple=thumbv7_be-none-eabi -emit-llvm -o - -O3 | FileCheck -check-prefix CHECK-A32BE -check-prefix=CHECK %s +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -O3 | FileCheck -check-prefix=CHECK -check-prefix=CHECK-LP64 %s +// RUN: %clang_cc1 %s -triple=i386-apple-darwin10 -emit-llvm -o - -O3 | FileCheck %s +// RUN: %clang_cc1 %s -triple=aarch64_be-none-eabi -emit-llvm -o - -O3 | FileCheck %s +// RUN: %clang_cc1 %s -triple=thumbv7_be-none-eabi -emit-llvm -o - -O3 | FileCheck %s // CHECK-LP64: %union.Test1 = type { i32, [4 x i8] } union Test1 { diff --git a/clang/test/CodeGenCXX/catch-implicit-integer-sign-changes-true-negatives.cpp b/clang/test/CodeGenCXX/catch-implicit-integer-sign-changes-true-negatives.cpp index 95349387b3b4..c9398c710707 100644 --- a/clang/test/CodeGenCXX/catch-implicit-integer-sign-changes-true-negatives.cpp +++ b/clang/test/CodeGenCXX/catch-implicit-integer-sign-changes-true-negatives.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK -// RUN: %clang_cc1 -fsanitize=implicit-integer-sign-change -fno-sanitize-recover=implicit-integer-sign-change -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-ANYRECOVER,CHECK-SANITIZE-NORECOVER -// RUN: %clang_cc1 -fsanitize=implicit-integer-sign-change -fsanitize-recover=implicit-integer-sign-change -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s
[clang] 2f1fe9a - [clang][CodeGen] Move riscv specific tests to RISCV subtarget folder
Author: Simon Pilgrim Date: 2020-11-20T12:03:28Z New Revision: 2f1fe9a3a60d6f18998c5f3b7e643d4cbaa4e65d URL: https://github.com/llvm/llvm-project/commit/2f1fe9a3a60d6f18998c5f3b7e643d4cbaa4e65d DIFF: https://github.com/llvm/llvm-project/commit/2f1fe9a3a60d6f18998c5f3b7e643d4cbaa4e65d.diff LOG: [clang][CodeGen] Move riscv specific tests to RISCV subtarget folder Minor cleanup to move more target specific tests out of the root codegen test folder Added: clang/test/CodeGen/RISCV/riscv-atomics.c clang/test/CodeGen/RISCV/riscv-inline-asm.c clang/test/CodeGen/RISCV/riscv-metadata.c clang/test/CodeGen/RISCV/riscv-sdata-module-flag.c clang/test/CodeGen/RISCV/riscv32-ilp32-abi.c clang/test/CodeGen/RISCV/riscv32-ilp32-ilp32f-abi.c clang/test/CodeGen/RISCV/riscv32-ilp32-ilp32f-ilp32d-abi.c clang/test/CodeGen/RISCV/riscv32-ilp32d-abi.c clang/test/CodeGen/RISCV/riscv32-ilp32f-abi.c clang/test/CodeGen/RISCV/riscv32-ilp32f-ilp32d-abi.c clang/test/CodeGen/RISCV/riscv64-lp64-abi.c clang/test/CodeGen/RISCV/riscv64-lp64-lp64f-abi.c clang/test/CodeGen/RISCV/riscv64-lp64-lp64f-lp64d-abi.c clang/test/CodeGen/RISCV/riscv64-lp64d-abi.c clang/test/CodeGen/RISCV/riscv64-lp64f-lp64d-abi.c Modified: Removed: clang/test/CodeGen/riscv-atomics.c clang/test/CodeGen/riscv-inline-asm.c clang/test/CodeGen/riscv-metadata.c clang/test/CodeGen/riscv-sdata-module-flag.c clang/test/CodeGen/riscv32-ilp32-abi.c clang/test/CodeGen/riscv32-ilp32-ilp32f-abi.c clang/test/CodeGen/riscv32-ilp32-ilp32f-ilp32d-abi.c clang/test/CodeGen/riscv32-ilp32d-abi.c clang/test/CodeGen/riscv32-ilp32f-abi.c clang/test/CodeGen/riscv32-ilp32f-ilp32d-abi.c clang/test/CodeGen/riscv64-lp64-abi.c clang/test/CodeGen/riscv64-lp64-lp64f-abi.c clang/test/CodeGen/riscv64-lp64-lp64f-lp64d-abi.c clang/test/CodeGen/riscv64-lp64d-abi.c clang/test/CodeGen/riscv64-lp64f-lp64d-abi.c diff --git a/clang/test/CodeGen/riscv-atomics.c b/clang/test/CodeGen/RISCV/riscv-atomics.c similarity index 100% rename from clang/test/CodeGen/riscv-atomics.c rename to clang/test/CodeGen/RISCV/riscv-atomics.c diff --git a/clang/test/CodeGen/riscv-inline-asm.c b/clang/test/CodeGen/RISCV/riscv-inline-asm.c similarity index 100% rename from clang/test/CodeGen/riscv-inline-asm.c rename to clang/test/CodeGen/RISCV/riscv-inline-asm.c diff --git a/clang/test/CodeGen/riscv-metadata.c b/clang/test/CodeGen/RISCV/riscv-metadata.c similarity index 100% rename from clang/test/CodeGen/riscv-metadata.c rename to clang/test/CodeGen/RISCV/riscv-metadata.c diff --git a/clang/test/CodeGen/riscv-sdata-module-flag.c b/clang/test/CodeGen/RISCV/riscv-sdata-module-flag.c similarity index 100% rename from clang/test/CodeGen/riscv-sdata-module-flag.c rename to clang/test/CodeGen/RISCV/riscv-sdata-module-flag.c diff --git a/clang/test/CodeGen/riscv32-ilp32-abi.c b/clang/test/CodeGen/RISCV/riscv32-ilp32-abi.c similarity index 100% rename from clang/test/CodeGen/riscv32-ilp32-abi.c rename to clang/test/CodeGen/RISCV/riscv32-ilp32-abi.c diff --git a/clang/test/CodeGen/riscv32-ilp32-ilp32f-abi.c b/clang/test/CodeGen/RISCV/riscv32-ilp32-ilp32f-abi.c similarity index 100% rename from clang/test/CodeGen/riscv32-ilp32-ilp32f-abi.c rename to clang/test/CodeGen/RISCV/riscv32-ilp32-ilp32f-abi.c diff --git a/clang/test/CodeGen/riscv32-ilp32-ilp32f-ilp32d-abi.c b/clang/test/CodeGen/RISCV/riscv32-ilp32-ilp32f-ilp32d-abi.c similarity index 100% rename from clang/test/CodeGen/riscv32-ilp32-ilp32f-ilp32d-abi.c rename to clang/test/CodeGen/RISCV/riscv32-ilp32-ilp32f-ilp32d-abi.c diff --git a/clang/test/CodeGen/riscv32-ilp32d-abi.c b/clang/test/CodeGen/RISCV/riscv32-ilp32d-abi.c similarity index 100% rename from clang/test/CodeGen/riscv32-ilp32d-abi.c rename to clang/test/CodeGen/RISCV/riscv32-ilp32d-abi.c diff --git a/clang/test/CodeGen/riscv32-ilp32f-abi.c b/clang/test/CodeGen/RISCV/riscv32-ilp32f-abi.c similarity index 100% rename from clang/test/CodeGen/riscv32-ilp32f-abi.c rename to clang/test/CodeGen/RISCV/riscv32-ilp32f-abi.c diff --git a/clang/test/CodeGen/riscv32-ilp32f-ilp32d-abi.c b/clang/test/CodeGen/RISCV/riscv32-ilp32f-ilp32d-abi.c similarity index 100% rename from clang/test/CodeGen/riscv32-ilp32f-ilp32d-abi.c rename to clang/test/CodeGen/RISCV/riscv32-ilp32f-ilp32d-abi.c diff --git a/clang/test/CodeGen/riscv64-lp64-abi.c b/clang/test/CodeGen/RISCV/riscv64-lp64-abi.c similarity index 100% rename from clang/test/CodeGen/riscv64-lp64-abi.c rename to clang/test/CodeGen/RISCV/riscv64-lp64-abi.c diff --git a/clang/test/CodeGen/riscv64-lp64-lp64f-abi.c b/clang/test/CodeGen/RISCV/riscv64-lp64-lp64f-abi.c similarity index 100% rename from clang/test/CodeGen/riscv64-lp64-lp64f-abi.c rename to clang/test/CodeGen/RISCV/riscv64-lp64-lp64f-abi.c diff --git
[clang] 822c5c5 - [clang][CodeGen] Move WebAssembly specific tests to WebAssembly subtarget folder
Author: Simon Pilgrim Date: 2020-11-20T12:03:28Z New Revision: 822c5c50849a1f762c920d59baaa6a6edbb657ee URL: https://github.com/llvm/llvm-project/commit/822c5c50849a1f762c920d59baaa6a6edbb657ee DIFF: https://github.com/llvm/llvm-project/commit/822c5c50849a1f762c920d59baaa6a6edbb657ee.diff LOG: [clang][CodeGen] Move WebAssembly specific tests to WebAssembly subtarget folder Minor cleanup to move more target specific tests out of the root codegen test folder Added: clang/test/CodeGen/WebAssembly/wasm-arguments.c clang/test/CodeGen/WebAssembly/wasm-call-main.c clang/test/CodeGen/WebAssembly/wasm-export-name.c clang/test/CodeGen/WebAssembly/wasm-import-module.c clang/test/CodeGen/WebAssembly/wasm-import-name.c clang/test/CodeGen/WebAssembly/wasm-main.c clang/test/CodeGen/WebAssembly/wasm-main_argc_argv.c clang/test/CodeGen/WebAssembly/wasm-regparm.c clang/test/CodeGen/WebAssembly/wasm-varargs.c Modified: Removed: clang/test/CodeGen/wasm-arguments.c clang/test/CodeGen/wasm-call-main.c clang/test/CodeGen/wasm-export-name.c clang/test/CodeGen/wasm-import-module.c clang/test/CodeGen/wasm-import-name.c clang/test/CodeGen/wasm-main.c clang/test/CodeGen/wasm-main_argc_argv.c clang/test/CodeGen/wasm-regparm.c clang/test/CodeGen/wasm-varargs.c diff --git a/clang/test/CodeGen/wasm-arguments.c b/clang/test/CodeGen/WebAssembly/wasm-arguments.c similarity index 100% rename from clang/test/CodeGen/wasm-arguments.c rename to clang/test/CodeGen/WebAssembly/wasm-arguments.c diff --git a/clang/test/CodeGen/wasm-call-main.c b/clang/test/CodeGen/WebAssembly/wasm-call-main.c similarity index 100% rename from clang/test/CodeGen/wasm-call-main.c rename to clang/test/CodeGen/WebAssembly/wasm-call-main.c diff --git a/clang/test/CodeGen/wasm-export-name.c b/clang/test/CodeGen/WebAssembly/wasm-export-name.c similarity index 100% rename from clang/test/CodeGen/wasm-export-name.c rename to clang/test/CodeGen/WebAssembly/wasm-export-name.c diff --git a/clang/test/CodeGen/wasm-import-module.c b/clang/test/CodeGen/WebAssembly/wasm-import-module.c similarity index 100% rename from clang/test/CodeGen/wasm-import-module.c rename to clang/test/CodeGen/WebAssembly/wasm-import-module.c diff --git a/clang/test/CodeGen/wasm-import-name.c b/clang/test/CodeGen/WebAssembly/wasm-import-name.c similarity index 100% rename from clang/test/CodeGen/wasm-import-name.c rename to clang/test/CodeGen/WebAssembly/wasm-import-name.c diff --git a/clang/test/CodeGen/wasm-main.c b/clang/test/CodeGen/WebAssembly/wasm-main.c similarity index 100% rename from clang/test/CodeGen/wasm-main.c rename to clang/test/CodeGen/WebAssembly/wasm-main.c diff --git a/clang/test/CodeGen/wasm-main_argc_argv.c b/clang/test/CodeGen/WebAssembly/wasm-main_argc_argv.c similarity index 100% rename from clang/test/CodeGen/wasm-main_argc_argv.c rename to clang/test/CodeGen/WebAssembly/wasm-main_argc_argv.c diff --git a/clang/test/CodeGen/wasm-regparm.c b/clang/test/CodeGen/WebAssembly/wasm-regparm.c similarity index 100% rename from clang/test/CodeGen/wasm-regparm.c rename to clang/test/CodeGen/WebAssembly/wasm-regparm.c diff --git a/clang/test/CodeGen/wasm-varargs.c b/clang/test/CodeGen/WebAssembly/wasm-varargs.c similarity index 100% rename from clang/test/CodeGen/wasm-varargs.c rename to clang/test/CodeGen/WebAssembly/wasm-varargs.c ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] 44c96be - Fix MSVC "not all control paths return a value" warnings. NFCI.
Author: Simon Pilgrim Date: 2020-11-20T11:41:20Z New Revision: 44c96becc9734fa23b7f38688a8f5c72e1f2e891 URL: https://github.com/llvm/llvm-project/commit/44c96becc9734fa23b7f38688a8f5c72e1f2e891 DIFF: https://github.com/llvm/llvm-project/commit/44c96becc9734fa23b7f38688a8f5c72e1f2e891.diff LOG: Fix MSVC "not all control paths return a value" warnings. NFCI. Added: Modified: clang-tools-extra/clangd/DumpAST.cpp Removed: diff --git a/clang-tools-extra/clangd/DumpAST.cpp b/clang-tools-extra/clangd/DumpAST.cpp index f9371ecf6374..9ea17e876de7 100644 --- a/clang-tools-extra/clangd/DumpAST.cpp +++ b/clang-tools-extra/clangd/DumpAST.cpp @@ -145,6 +145,7 @@ class DumpVisitor : public RecursiveASTVisitor { TEMPLATE_ARGUMENT_KIND(TemplateExpansion); #undef TEMPLATE_ARGUMENT_KIND } +llvm_unreachable("Unhandled ArgKind enum"); } std::string getKind(const NestedNameSpecifierLoc ) { assert(NNSL.getNestedNameSpecifier()); @@ -161,6 +162,7 @@ class DumpVisitor : public RecursiveASTVisitor { NNS_KIND(NamespaceAlias); #undef NNS_KIND } +llvm_unreachable("Unhandled SpecifierKind enum"); } std::string getKind(const CXXCtorInitializer *CCI) { if (CCI->isBaseInitializer()) @@ -185,6 +187,7 @@ class DumpVisitor : public RecursiveASTVisitor { TEMPLATE_KIND(SubstTemplateTemplateParmPack); #undef TEMPLATE_KIND } +llvm_unreachable("Unhandled NameKind enum"); } std::string getKind(const Attr *A) { switch (A->getKind()) { @@ -194,6 +197,7 @@ class DumpVisitor : public RecursiveASTVisitor { #include "clang/Basic/AttrList.inc" #undef ATTR } +llvm_unreachable("Unhandled attr::Kind enum"); } std::string getKind(const CXXBaseSpecifier ) { // There aren't really any variants of CXXBaseSpecifier. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 0415cf4 - Fix unused variable warning. NFCI.
Author: Simon Pilgrim Date: 2020-11-18T16:50:51Z New Revision: 0415cf470bfbf16a06938424c3cad30c12cc2284 URL: https://github.com/llvm/llvm-project/commit/0415cf470bfbf16a06938424c3cad30c12cc2284 DIFF: https://github.com/llvm/llvm-project/commit/0415cf470bfbf16a06938424c3cad30c12cc2284.diff LOG: Fix unused variable warning. NFCI. We're just performing a null pointer check, we don't need the actual variable. Added: Modified: clang/lib/AST/APValue.cpp Removed: diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp index f8df221f5705..c249e778db48 100644 --- a/clang/lib/AST/APValue.cpp +++ b/clang/lib/AST/APValue.cpp @@ -1062,7 +1062,7 @@ LinkageInfo LinkageComputer::getLVForValue(const APValue , } case APValue::Union: -if (const auto *FD = V.getUnionField()) +if (V.getUnionField()) Merge(V.getUnionValue()); break; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 0627140 - [clang][driver] Fix definition/declaration argument name mismatches. NFCI.
Author: Simon Pilgrim Date: 2020-11-17T12:39:45Z New Revision: 0627140cd593e20b89b55e309c35c82ef618190e URL: https://github.com/llvm/llvm-project/commit/0627140cd593e20b89b55e309c35c82ef618190e DIFF: https://github.com/llvm/llvm-project/commit/0627140cd593e20b89b55e309c35c82ef618190e.diff LOG: [clang][driver] Fix definition/declaration argument name mismatches. NFCI. AddCXXStdlibLibArgs args were using the names for the clang equivalent methods. Silences cppcheck warnings. Added: Modified: clang/lib/Driver/ToolChains/AIX.cpp clang/lib/Driver/ToolChains/CrossWindows.cpp Removed: diff --git a/clang/lib/Driver/ToolChains/AIX.cpp b/clang/lib/Driver/ToolChains/AIX.cpp index 7b5d7da8c873..36fe578fcb3d 100644 --- a/clang/lib/Driver/ToolChains/AIX.cpp +++ b/clang/lib/Driver/ToolChains/AIX.cpp @@ -216,11 +216,11 @@ void AIX::AddClangSystemIncludeArgs(const ArgList , addSystemInclude(DriverArgs, CC1Args, UP.str()); } -void AIX::AddCXXStdlibLibArgs(const llvm::opt::ArgList , - llvm::opt::ArgStringList ) const { - switch (GetCXXStdlibType(DriverArgs)) { +void AIX::AddCXXStdlibLibArgs(const llvm::opt::ArgList , + llvm::opt::ArgStringList ) const { + switch (GetCXXStdlibType(Args)) { case ToolChain::CST_Libcxx: -CC1Args.push_back("-lc++"); +CmdArgs.push_back("-lc++"); return; case ToolChain::CST_Libstdcxx: llvm::report_fatal_error("linking libstdc++ unimplemented on AIX"); diff --git a/clang/lib/Driver/ToolChains/CrossWindows.cpp b/clang/lib/Driver/ToolChains/CrossWindows.cpp index 28ad6c59c655..07abf4f83f7d 100644 --- a/clang/lib/Driver/ToolChains/CrossWindows.cpp +++ b/clang/lib/Driver/ToolChains/CrossWindows.cpp @@ -271,10 +271,10 @@ AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList , } void CrossWindowsToolChain:: -AddCXXStdlibLibArgs(const llvm::opt::ArgList , -llvm::opt::ArgStringList ) const { - if (GetCXXStdlibType(DriverArgs) == ToolChain::CST_Libcxx) -CC1Args.push_back("-lc++"); +AddCXXStdlibLibArgs(const llvm::opt::ArgList , +llvm::opt::ArgStringList ) const { + if (GetCXXStdlibType(Args) == ToolChain::CST_Libcxx) +CmdArgs.push_back("-lc++"); } clang::SanitizerMask CrossWindowsToolChain::getSupportedSanitizers() const { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 5e373b2 - [Sema] Use isa<> instead of dyn_cast<> as pointer is never dereferenced. NFCI.
Author: Simon Pilgrim Date: 2020-11-15T12:58:36Z New Revision: 5e373b2e94d714a7250e961029a58bae5585f33e URL: https://github.com/llvm/llvm-project/commit/5e373b2e94d714a7250e961029a58bae5585f33e DIFF: https://github.com/llvm/llvm-project/commit/5e373b2e94d714a7250e961029a58bae5585f33e.diff LOG: [Sema] Use isa<> instead of dyn_cast<> as pointer is never dereferenced. NFCI. We are only checking for the class type. Fixes Wshadow warnings. Added: Modified: clang/lib/Sema/CodeCompleteConsumer.cpp Removed: diff --git a/clang/lib/Sema/CodeCompleteConsumer.cpp b/clang/lib/Sema/CodeCompleteConsumer.cpp index f1ad8aeaacbb..678a09ba1003 100644 --- a/clang/lib/Sema/CodeCompleteConsumer.cpp +++ b/clang/lib/Sema/CodeCompleteConsumer.cpp @@ -356,8 +356,7 @@ const char *CodeCompletionAllocator::CopyString(const Twine ) { } StringRef CodeCompletionTUInfo::getParentName(const DeclContext *DC) { - const NamedDecl *ND = dyn_cast(DC); - if (!ND) + if (!isa(DC)) return {}; // Check whether we've already cached the parent name. @@ -470,8 +469,7 @@ void CodeCompletionBuilder::addParentContext(const DeclContext *DC) { if (DC->isFunctionOrMethod()) return; - const NamedDecl *ND = dyn_cast(DC); - if (!ND) + if (!isa(DC)) return; ParentName = getCodeCompletionTUInfo().getParentName(DC); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 365f46e - [CodeGen][X86] Remove unused check-prefix in movdir tests
Author: Simon Pilgrim Date: 2020-10-30T16:23:08Z New Revision: 365f46efebe09378af57628f38bfe55018451d17 URL: https://github.com/llvm/llvm-project/commit/365f46efebe09378af57628f38bfe55018451d17 DIFF: https://github.com/llvm/llvm-project/commit/365f46efebe09378af57628f38bfe55018451d17.diff LOG: [CodeGen][X86] Remove unused check-prefix in movdir tests Added: Modified: clang/test/CodeGen/X86/builtin-movdir.c Removed: diff --git a/clang/test/CodeGen/X86/builtin-movdir.c b/clang/test/CodeGen/X86/builtin-movdir.c index e13cc776edd6..f1f104db87b4 100644 --- a/clang/test/CodeGen/X86/builtin-movdir.c +++ b/clang/test/CodeGen/X86/builtin-movdir.c @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -ffreestanding -Wall -pedantic -fno-experimental-new-pass-manager -triple x86_64-unknown-unknown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefix=X86_64 --check-prefix=CHECK -// RUN: %clang_cc1 -ffreestanding -Wall -pedantic -fno-experimental-new-pass-manager -triple i386-unknown-unknown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefix=X86 --check-prefix=CHECK -// RUN: %clang_cc1 -ffreestanding -Wall -pedantic -fexperimental-new-pass-manager -triple x86_64-unknown-unknown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefix=X86_64 --check-prefix=CHECK -// RUN: %clang_cc1 -ffreestanding -Wall -pedantic -fexperimental-new-pass-manager -triple i386-unknown-unknown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefix=X86 --check-prefix=CHECK +// RUN: %clang_cc1 -ffreestanding -Wall -pedantic -fno-experimental-new-pass-manager -triple x86_64-unknown-unknown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,X86_64 +// RUN: %clang_cc1 -ffreestanding -Wall -pedantic -fno-experimental-new-pass-manager -triple i386-unknown-unknown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK +// RUN: %clang_cc1 -ffreestanding -Wall -pedantic -fexperimental-new-pass-manager -triple x86_64-unknown-unknown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,X86_64 +// RUN: %clang_cc1 -ffreestanding -Wall -pedantic -fexperimental-new-pass-manager -triple i386-unknown-unknown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK #include #include ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 973317c - [CodeGen][X86] Remove unused check-prefix in constrained fma tests
Author: Simon Pilgrim Date: 2020-10-30T16:23:08Z New Revision: 973317cc5e4612a85e39dc1ffb20423c96bc9db2 URL: https://github.com/llvm/llvm-project/commit/973317cc5e4612a85e39dc1ffb20423c96bc9db2 DIFF: https://github.com/llvm/llvm-project/commit/973317cc5e4612a85e39dc1ffb20423c96bc9db2.diff LOG: [CodeGen][X86] Remove unused check-prefix in constrained fma tests Added: Modified: clang/test/CodeGen/X86/fma-builtins-constrained.c Removed: diff --git a/clang/test/CodeGen/X86/fma-builtins-constrained.c b/clang/test/CodeGen/X86/fma-builtins-constrained.c index e5c22ec8b80d..6d280a237432 100644 --- a/clang/test/CodeGen/X86/fma-builtins-constrained.c +++ b/clang/test/CodeGen/X86/fma-builtins-constrained.c @@ -1,8 +1,8 @@ // REQUIRES: x86-registered-target -// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -O2 -emit-llvm -o - | FileCheck --check-prefix=COMMON --check-prefix=COMMONIR --check-prefix=UNCONSTRAINED %s -// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -ffp-exception-behavior=strict -O2 -emit-llvm -o - | FileCheck --check-prefix=COMMON --check-prefix=COMMONIR --check-prefix=CONSTRAINED %s -// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -O2 -S -o - | FileCheck --check-prefix=COMMON --check-prefix=CHECK-ASM --check-prefix=CHECK-ASM-UNCONSTRAINED %s -// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -O2 -ffp-exception-behavior=strict -S -o - | FileCheck --check-prefix=COMMON --check-prefix=CHECK-ASM --check-prefix=CHECK-ASM-CONSTRAINED %s +// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -O2 -emit-llvm -o - | FileCheck %s --check-prefixes=COMMON,COMMONIR,UNCONSTRAINED +// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -ffp-exception-behavior=strict -O2 -emit-llvm -o - | FileCheck %s --check-prefixes=COMMON,COMMONIR,CONSTRAINED +// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -O2 -S -o - | FileCheck %s --check-prefixes=COMMON,CHECK-ASM +// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -O2 -ffp-exception-behavior=strict -S -o - | FileCheck %s --check-prefixes=COMMON,CHECK-ASM #include ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] bbe055d - [CodeGen][X86] Remove unused check-prefix in amx inline asm tests
Author: Simon Pilgrim Date: 2020-10-30T16:13:45Z New Revision: bbe055dd73cf3f87e6e6481b5aa36bcc875cbe23 URL: https://github.com/llvm/llvm-project/commit/bbe055dd73cf3f87e6e6481b5aa36bcc875cbe23 DIFF: https://github.com/llvm/llvm-project/commit/bbe055dd73cf3f87e6e6481b5aa36bcc875cbe23.diff LOG: [CodeGen][X86] Remove unused check-prefix in amx inline asm tests Added: Modified: clang/test/CodeGen/X86/amx_inline_asm.c Removed: diff --git a/clang/test/CodeGen/X86/amx_inline_asm.c b/clang/test/CodeGen/X86/amx_inline_asm.c index 9d828f8ac94e..24788adfd2cb 100644 --- a/clang/test/CodeGen/X86/amx_inline_asm.c +++ b/clang/test/CodeGen/X86/amx_inline_asm.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -ffreestanding -triple=x86_64-unknown-unknown -target-feature +amx-int8 -target-feature +amx-bf16 -emit-llvm -o - -Wall -Werror -pedantic | FileCheck %s --check-prefixes=CHECK,X86_64 +// RUN: %clang_cc1 %s -ffreestanding -triple=x86_64-unknown-unknown -target-feature +amx-int8 -target-feature +amx-bf16 -emit-llvm -o - -Wall -Werror -pedantic | FileCheck %s void f_tilemul(short a) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fe3d765 - [CodeGen][X86] Tidyup CHECKs on bitscan tests
Author: Simon Pilgrim Date: 2020-10-30T16:13:52Z New Revision: fe3d765ac72ed58cc81cc93d5a1bf0f61491f80d URL: https://github.com/llvm/llvm-project/commit/fe3d765ac72ed58cc81cc93d5a1bf0f61491f80d DIFF: https://github.com/llvm/llvm-project/commit/fe3d765ac72ed58cc81cc93d5a1bf0f61491f80d.diff LOG: [CodeGen][X86] Tidyup CHECKs on bitscan tests Added: Modified: clang/test/CodeGen/X86/bitscan-builtins.c Removed: diff --git a/clang/test/CodeGen/X86/bitscan-builtins.c b/clang/test/CodeGen/X86/bitscan-builtins.c index 1035d1840852..a5a7808a82a2 100644 --- a/clang/test/CodeGen/X86/bitscan-builtins.c +++ b/clang/test/CodeGen/X86/bitscan-builtins.c @@ -8,18 +8,18 @@ #include int test_bit_scan_forward(int a) { - return _bit_scan_forward(a); // CHECK-LABEL: test_bit_scan_forward // CHECK: %[[call:.*]] = call i32 @llvm.cttz.i32(i32 %{{.*}}, i1 true) // CHECK: ret i32 %[[call]] + return _bit_scan_forward(a); } int test_bit_scan_reverse(int a) { - return _bit_scan_reverse(a); // CHECK-LABEL: test_bit_scan_reverse // CHECK: %[[call:.*]] = call i32 @llvm.ctlz.i32(i32 %{{.*}}, i1 true) // CHECK: %[[sub:.*]] = sub nsw i32 31, %[[call]] // CHECK: ret i32 %[[sub]] + return _bit_scan_reverse(a); } int test__bsfd(int X) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 5cdd470 - [CodeGen][X86] Remove unused check-prefix in bitscan tests
Author: Simon Pilgrim Date: 2020-10-30T16:13:50Z New Revision: 5cdd47050408d826d7fb324d9a130cf8e74298e2 URL: https://github.com/llvm/llvm-project/commit/5cdd47050408d826d7fb324d9a130cf8e74298e2 DIFF: https://github.com/llvm/llvm-project/commit/5cdd47050408d826d7fb324d9a130cf8e74298e2.diff LOG: [CodeGen][X86] Remove unused check-prefix in bitscan tests Added: Modified: clang/test/CodeGen/X86/bitscan-builtins.c Removed: diff --git a/clang/test/CodeGen/X86/bitscan-builtins.c b/clang/test/CodeGen/X86/bitscan-builtins.c index 2fcebf477846..1035d1840852 100644 --- a/clang/test/CodeGen/X86/bitscan-builtins.c +++ b/clang/test/CodeGen/X86/bitscan-builtins.c @@ -1,49 +1,48 @@ -// RUN: %clang_cc1 -x c -ffreestanding %s -triple=x86_64-unknown-unknown -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECKC -// RUN: %clang_cc1 -x c++ -std=c++11 -ffreestanding %s -triple=x86_64-unknown-unknown -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECKCPP - +// RUN: %clang_cc1 -x c -ffreestanding %s -triple=x86_64-unknown-unknown -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -x c++ -std=c++11 -ffreestanding %s -triple=x86_64-unknown-unknown -emit-llvm -o - | FileCheck %s // PR33722 -// RUN: %clang_cc1 -x c -ffreestanding %s -triple x86_64-unknown-unknown -fms-extensions -fms-compatibility-version=19.00 -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECKC -// RUN: %clang_cc1 -x c++ -ffreestanding %s -triple x86_64-unknown-unknown -fms-extensions -fms-compatibility-version=19.00 -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECKCPP +// RUN: %clang_cc1 -x c -ffreestanding %s -triple x86_64-unknown-unknown -fms-extensions -fms-compatibility-version=19.00 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -x c++ -ffreestanding %s -triple x86_64-unknown-unknown -fms-extensions -fms-compatibility-version=19.00 -emit-llvm -o - | FileCheck %s #include int test_bit_scan_forward(int a) { return _bit_scan_forward(a); -// CHECKC-LABEL: @test_bit_scan_forward +// CHECK-LABEL: test_bit_scan_forward // CHECK: %[[call:.*]] = call i32 @llvm.cttz.i32(i32 %{{.*}}, i1 true) // CHECK: ret i32 %[[call]] } int test_bit_scan_reverse(int a) { return _bit_scan_reverse(a); -// CHECKC-LABEL: @test_bit_scan_reverse +// CHECK-LABEL: test_bit_scan_reverse // CHECK: %[[call:.*]] = call i32 @llvm.ctlz.i32(i32 %{{.*}}, i1 true) // CHECK: %[[sub:.*]] = sub nsw i32 31, %[[call]] // CHECK: ret i32 %[[sub]] } int test__bsfd(int X) { -// CHECKC-LABEL: @test__bsfd +// CHECK-LABEL: test__bsfd // CHECK: %[[call:.*]] = call i32 @llvm.cttz.i32(i32 %{{.*}}, i1 true) return __bsfd(X); } int test__bsfq(long long X) { -// CHECKC-LABEL: @test__bsfq +// CHECK-LABEL: test__bsfq // CHECK: %[[call:.*]] = call i64 @llvm.cttz.i64(i64 %{{.*}}, i1 true) return __bsfq(X); } int test__bsrd(int X) { -// CHECKC-LABEL: @test__bsrd +// CHECK-LABEL: test__bsrd // CHECK: %[[call:.*]] = call i32 @llvm.ctlz.i32(i32 %{{.*}}, i1 true) // CHECK: %[[sub:.*]] = sub nsw i32 31, %[[call]] return __bsrd(X); } int test__bsrq(long long X) { -// CHECKC-LABEL: @test__bsrq +// CHECK-LABEL: test__bsrq // CHECK: %[[call:.*]] = call i64 @llvm.ctlz.i64(i64 %{{.*}}, i1 true) // CHECK: %[[cast:.*]] = trunc i64 %[[call]] to i32 // CHECK: %[[sub:.*]] = sub nsw i32 63, %[[cast]] ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 0ff9d8c - [CodeGen][X86] Remove unused check-prefix in bswap tests
Author: Simon Pilgrim Date: 2020-10-30T16:13:49Z New Revision: 0ff9d8c8baa317f4135e08cfe8d64e4b824b7c49 URL: https://github.com/llvm/llvm-project/commit/0ff9d8c8baa317f4135e08cfe8d64e4b824b7c49 DIFF: https://github.com/llvm/llvm-project/commit/0ff9d8c8baa317f4135e08cfe8d64e4b824b7c49.diff LOG: [CodeGen][X86] Remove unused check-prefix in bswap tests Added: Modified: clang/test/CodeGen/X86/x86-bswap.c Removed: diff --git a/clang/test/CodeGen/X86/x86-bswap.c b/clang/test/CodeGen/X86/x86-bswap.c index e952e4f5b127..fb4852c52408 100644 --- a/clang/test/CodeGen/X86/x86-bswap.c +++ b/clang/test/CodeGen/X86/x86-bswap.c @@ -1,28 +1,28 @@ -// RUN: %clang_cc1 -x c -ffreestanding %s -triple=x86_64-apple-darwin -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECKC -// RUN: %clang_cc1 -x c++ -std=c++11 -ffreestanding %s -triple=x86_64-apple-darwin -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECKCPP +// RUN: %clang_cc1 -x c -ffreestanding %s -triple=x86_64-apple-darwin -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -x c++ -std=c++11 -ffreestanding %s -triple=x86_64-apple-darwin -emit-llvm -o - | FileCheck %s #include int test__bswapd(int X) { -// CHECKC-LABEL: @test__bswapd +// CHECK-LABEL: test__bswapd // CHECK: call i32 @llvm.bswap.i32 return __bswapd(X); } int test_bswap(int X) { -// CHECKC-LABEL: @test_bswap +// CHECK-LABEL: test_bswap // CHECK: call i32 @llvm.bswap.i32 return _bswap(X); } long test__bswapq(long long X) { -// CHECKC-LABEL: @test__bswapq +// CHECK-LABEL: test__bswapq // CHECK: call i64 @llvm.bswap.i64 return __bswapq(X); } long test_bswap64(long long X) { -// CHECKC-LABEL: @test_bswap64 +// CHECK-LABEL: test_bswap64 // CHECK: call i64 @llvm.bswap.i64 return _bswap64(X); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] d7389f0 - [CodeGen][X86] Cleanup + remove unused check-prefixes in avx union tests
Author: Simon Pilgrim Date: 2020-10-30T16:13:47Z New Revision: d7389f05ee27e703ac9c0873d3ac183d8d9cf0c5 URL: https://github.com/llvm/llvm-project/commit/d7389f05ee27e703ac9c0873d3ac183d8d9cf0c5 DIFF: https://github.com/llvm/llvm-project/commit/d7389f05ee27e703ac9c0873d3ac183d8d9cf0c5.diff LOG: [CodeGen][X86] Cleanup + remove unused check-prefixes in avx union tests Added: Modified: clang/test/CodeGen/X86/avx-union.c Removed: diff --git a/clang/test/CodeGen/X86/avx-union.c b/clang/test/CodeGen/X86/avx-union.c index 17ffb77300ff..b4f7dc08dfee 100644 --- a/clang/test/CodeGen/X86/avx-union.c +++ b/clang/test/CodeGen/X86/avx-union.c @@ -1,10 +1,10 @@ -// RUN: %clang_cc1 -w -ffreestanding -triple x86_64-linux-gnu -target-feature +avx -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK --check-prefix=AVX -// RUN: %clang_cc1 -w -ffreestanding -triple x86_64-linux-gnu -target-feature +avx512f -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512 +// RUN: %clang_cc1 -w -ffreestanding -triple x86_64-linux-gnu -target-feature +avx -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,AVX +// RUN: %clang_cc1 -w -ffreestanding -triple x86_64-linux-gnu -target-feature +avx512f -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,AVX512 // Test Clang 11 and earlier behavior -// RUN: %clang_cc1 -w -ffreestanding -triple x86_64-linux-gnu -target-feature +avx -fclang-abi-compat=10.0 -emit-llvm -o - %s | FileCheck %s --check-prefix=AVX --check-prefix=CHECK-LEGACY -// RUN: %clang_cc1 -w -ffreestanding -triple x86_64-linux-gnu -target-feature +avx512f -fclang-abi-compat=11.0 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-LEGACY --check-prefix=AVX512-LEGACY -// RUN: %clang_cc1 -w -ffreestanding -triple x86_64-scei-ps4 -target-feature +avx -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-LEGACY --check-prefix=AVX-LEGACY +// RUN: %clang_cc1 -w -ffreestanding -triple x86_64-linux-gnu -target-feature +avx -fclang-abi-compat=10.0 -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK-LEGACY,AVX +// RUN: %clang_cc1 -w -ffreestanding -triple x86_64-linux-gnu -target-feature +avx512f -fclang-abi-compat=11.0 -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK-LEGACY,AVX512-LEGACY +// RUN: %clang_cc1 -w -ffreestanding -triple x86_64-scei-ps4 -target-feature +avx -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-LEGACY // This tests verifies that a union parameter should pass by a vector regitster whose first eightbyte is SSE and the other eightbytes are SSEUP. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] c44846f - [CodeGen][X86] Cleanup + fix unused check-prefixes in bmi tests
Author: Simon Pilgrim Date: 2020-10-30T16:13:54Z New Revision: c44846f537efb4f996becc6f665af828051a08f6 URL: https://github.com/llvm/llvm-project/commit/c44846f537efb4f996becc6f665af828051a08f6 DIFF: https://github.com/llvm/llvm-project/commit/c44846f537efb4f996becc6f665af828051a08f6.diff LOG: [CodeGen][X86] Cleanup + fix unused check-prefixes in bmi tests Added: Modified: clang/test/CodeGen/X86/bmi-builtins.c Removed: diff --git a/clang/test/CodeGen/X86/bmi-builtins.c b/clang/test/CodeGen/X86/bmi-builtins.c index 409dd40c4a33..81405429b9b6 100644 --- a/clang/test/CodeGen/X86/bmi-builtins.c +++ b/clang/test/CodeGen/X86/bmi-builtins.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +bmi -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,CHECK_TZCNT -// RUN: %clang_cc1 -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 -ffreestanding %s -triple=x86_64-windows-msvc -emit-llvm -o - -Wall -Werror -DTEST_TZCNT | FileCheck %s --check-prefix=CHECK-TZCNT +// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +bmi -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,TZCNT +// RUN: %clang_cc1 -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 -ffreestanding %s -triple=x86_64-windows-msvc -emit-llvm -o - -Wall -Werror -DTEST_TZCNT | FileCheck %s --check-prefix=TZCNT #include @@ -15,122 +15,122 @@ // intrinsics are diff erent! unsigned short test_tzcnt_u16(unsigned short __X) { - // CHECK-TZCNT-LABEL: test_tzcnt_u16 - // CHECK-TZCNT: i16 @llvm.cttz.i16(i16 %{{.*}}, i1 false) +// TZCNT-LABEL: test_tzcnt_u16 +// TZCNT: i16 @llvm.cttz.i16(i16 %{{.*}}, i1 false) return _tzcnt_u16(__X); } unsigned short test__tzcnt_u16(unsigned short __X) { - // CHECK-TZCNT-LABEL: test__tzcnt_u16 - // CHECK-TZCNT: i16 @llvm.cttz.i16(i16 %{{.*}}, i1 false) +// TZCNT-LABEL: test__tzcnt_u16 +// TZCNT: i16 @llvm.cttz.i16(i16 %{{.*}}, i1 false) return __tzcnt_u16(__X); } unsigned int test__tzcnt_u32(unsigned int __X) { - // CHECK-TZCNT-LABEL: test__tzcnt_u32 - // CHECK-TZCNT: i32 @llvm.cttz.i32(i32 %{{.*}}, i1 false) +// TZCNT-LABEL: test__tzcnt_u32 +// TZCNT: i32 @llvm.cttz.i32(i32 %{{.*}}, i1 false) return __tzcnt_u32(__X); } int test_mm_tzcnt_32(unsigned int __X) { - // CHECK-TZCNT-LABEL: test_mm_tzcnt_32 - // CHECK-TZCNT: i32 @llvm.cttz.i32(i32 %{{.*}}, i1 false) +// TZCNT-LABEL: test_mm_tzcnt_32 +// TZCNT: i32 @llvm.cttz.i32(i32 %{{.*}}, i1 false) return _mm_tzcnt_32(__X); } unsigned int test_tzcnt_u32(unsigned int __X) { - // CHECK-TZCNT-LABEL: test_tzcnt_u32 - // CHECK-TZCNT: i32 @llvm.cttz.i32(i32 %{{.*}}, i1 false) +// TZCNT-LABEL: test_tzcnt_u32 +// TZCNT: i32 @llvm.cttz.i32(i32 %{{.*}}, i1 false) return _tzcnt_u32(__X); } #ifdef __x86_64__ unsigned long long test__tzcnt_u64(unsigned long long __X) { - // CHECK-TZCNT-LABEL: test__tzcnt_u64 - // CHECK-TZCNT: i64 @llvm.cttz.i64(i64 %{{.*}}, i1 false) +// TZCNT-LABEL: test__tzcnt_u64 +// TZCNT: i64 @llvm.cttz.i64(i64 %{{.*}}, i1 false) return __tzcnt_u64(__X); } long long test_mm_tzcnt_64(unsigned long long __X) { - // CHECK-TZCNT-LABEL: test_mm_tzcnt_64 - // CHECK-TZCNT: i64 @llvm.cttz.i64(i64 %{{.*}}, i1 false) +// TZCNT-LABEL: test_mm_tzcnt_64 +// TZCNT: i64 @llvm.cttz.i64(i64 %{{.*}}, i1 false) return _mm_tzcnt_64(__X); } unsigned long long test_tzcnt_u64(unsigned long long __X) { - // CHECK-TZCNT-LABEL: test_tzcnt_u64 - // CHECK-TZCNT: i64 @llvm.cttz.i64(i64 %{{.*}}, i1 false) +// TZCNT-LABEL: test_tzcnt_u64 +// TZCNT: i64 @llvm.cttz.i64(i64 %{{.*}}, i1 false) return _tzcnt_u64(__X); } #endif #if !defined(TEST_TZCNT) unsigned int test__andn_u32(unsigned int __X, unsigned int __Y) { - // CHECK-LABEL: test__andn_u32 - // CHECK: xor i32 %{{.*}}, -1 - // CHECK: and i32 %{{.*}}, %{{.*}} +// CHECK-LABEL: test__andn_u32 +// CHECK: xor i32 %{{.*}}, -1 +// CHECK: and i32 %{{.*}}, %{{.*}} return __andn_u32(__X, __Y); } unsigned int test__bextr_u32(unsigned int __X, unsigned int __Y) { - // CHECK-LABEL: test__bextr_u32 - // CHECK: i32 @llvm.x86.bmi.bextr.32(i32 %{{.*}}, i32 %{{.*}}) +// CHECK-LABEL: test__bextr_u32 +// CHECK: i32 @llvm.x86.bmi.bextr.32(i32 %{{.*}}, i32 %{{.*}}) return __bextr_u32(__X, __Y); } unsigned int test__blsi_u32(unsigned int __X) { - // CHECK-LABEL: test__blsi_u32 - // CHECK: sub i32 0, %{{.*}} - // CHECK: and i32 %{{.*}}, %{{.*}} +// CHECK-LABEL: test__blsi_u32 +// CHECK: sub i32 0, %{{.*}} +// CHECK: and i32 %{{.*}}, %{{.*}} return __blsi_u32(__X); } unsigned int test__blsmsk_u32(unsigned int __X) { - // CHECK-LABEL: test__blsmsk_u32 - // CHECK: sub i32 %{{.*}}, 1 - // CHECK: xor i32 %{{.*}}, %{{.*}} +// CHECK-LABEL: test__blsmsk_u32 +// CHECK: sub i32 %{{.*}}, 1 +// CHECK: xor i32 %{{.*}},
[clang-tools-extra] 888969f - [clangd] Fix MSVC implicit capture build failure.
Author: Simon Pilgrim Date: 2020-10-30T11:36:59Z New Revision: 888969f62abe6df9c9bafd593a6ba345577198b3 URL: https://github.com/llvm/llvm-project/commit/888969f62abe6df9c9bafd593a6ba345577198b3 DIFF: https://github.com/llvm/llvm-project/commit/888969f62abe6df9c9bafd593a6ba345577198b3.diff LOG: [clangd] Fix MSVC implicit capture build failure. MSVC builds were failing because the constexpr wasn't couldn't be captured by the lamdba. Fix an implicit double to float truncation warning as well. Added: Modified: clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp Removed: diff --git a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp index b2534bdf9c19..a7e1c6c48143 100644 --- a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp +++ b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp @@ -196,10 +196,10 @@ TEST(DecisionForestRankingModel, ReferencesAffectRanking) { TEST(DecisionForestRankingModel, DecisionForestScorerCallbackTest) { clangd::CodeCompleteOptions Opts; - constexpr float MagicNumber = 1234.5678; + constexpr float MagicNumber = 1234.5678f; Opts.RankingModel = CodeCompleteOptions::DecisionForest; - Opts.DecisionForestScorer = [](const SymbolQualitySignals &, - const SymbolRelevanceSignals &, float Base) { + Opts.DecisionForestScorer = [&](const SymbolQualitySignals &, + const SymbolRelevanceSignals &, float Base) { DecisionForestScores Scores; Scores.Total = MagicNumber; Scores.ExcludingName = MagicNumber; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 6725860 - Sema::BuildCallExpr - use cast<> instead of dyn_cast<> for dereferenced pointer. NFCI.
Author: Simon Pilgrim Date: 2021-01-05T09:34:00Z New Revision: 6725860d21a03741d6c3331ab0560416bb19e068 URL: https://github.com/llvm/llvm-project/commit/6725860d21a03741d6c3331ab0560416bb19e068 DIFF: https://github.com/llvm/llvm-project/commit/6725860d21a03741d6c3331ab0560416bb19e068.diff LOG: Sema::BuildCallExpr - use cast<> instead of dyn_cast<> for dereferenced pointer. NFCI. We're immediately dereferencing the casted pointer, so use cast<> which will assert instead of dyn_cast<> which can return null. Fixes static analyzer warning. Added: Modified: clang/lib/Sema/SemaExpr.cpp Removed: diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 3992a373f721..28f4c5bbf19b 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -6484,7 +6484,7 @@ ExprResult Sema::BuildCallExpr(Scope *Scope, Expr *Fn, SourceLocation LParenLoc, "should only occur in error-recovery path."); QualType ReturnType = llvm::isa_and_nonnull(NDecl) -? dyn_cast(NDecl)->getCallResultType() +? cast(NDecl)->getCallResultType() : Context.DependentTy; return CallExpr::Create(Context, Fn, ArgExprs, ReturnType, Expr::getValueKindForType(ReturnType), RParenLoc, ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 55488bd - CGExpr - EmitMatrixSubscriptExpr - fix getAs<> null-dereference static analyzer warning. NFCI.
Author: Simon Pilgrim Date: 2021-01-05T17:08:11Z New Revision: 55488bd3cd1a468941e26ad4cf94f2bad887fc02 URL: https://github.com/llvm/llvm-project/commit/55488bd3cd1a468941e26ad4cf94f2bad887fc02 DIFF: https://github.com/llvm/llvm-project/commit/55488bd3cd1a468941e26ad4cf94f2bad887fc02.diff LOG: CGExpr - EmitMatrixSubscriptExpr - fix getAs<> null-dereference static analyzer warning. NFCI. getAs<> can return null if the cast is invalid, which can lead to null pointer deferences. Use castAs<> instead which will assert that the cast is valid. Added: Modified: clang/lib/CodeGen/CGExpr.cpp Removed: diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 3013fffcbf6d..a3f90449bb4c 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -3858,7 +3858,7 @@ LValue CodeGenFunction::EmitMatrixSubscriptExpr(const MatrixSubscriptExpr *E) { llvm::Value *ColIdx = EmitScalarExpr(E->getColumnIdx()); llvm::Value *NumRows = Builder.getIntN( RowIdx->getType()->getScalarSizeInBits(), - E->getBase()->getType()->getAs()->getNumRows()); + E->getBase()->getType()->castAs()->getNumRows()); llvm::Value *FinalIdx = Builder.CreateAdd(Builder.CreateMul(ColIdx, NumRows), RowIdx); return LValue::MakeMatrixElt( ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 9f8c0d1 - DeclCXX - Fix getAs<> null-dereference static analyzer warnings. NFCI.
Author: Simon Pilgrim Date: 2021-01-04T15:12:55Z New Revision: 9f8c0d15c7f706a124ba29e8f40dc1937cd5bd49 URL: https://github.com/llvm/llvm-project/commit/9f8c0d15c7f706a124ba29e8f40dc1937cd5bd49 DIFF: https://github.com/llvm/llvm-project/commit/9f8c0d15c7f706a124ba29e8f40dc1937cd5bd49.diff LOG: DeclCXX - Fix getAs<> null-dereference static analyzer warnings. NFCI. getAs<> can return null if the cast is invalid, which can lead to null pointer deferences. Use castAs<> instead which will assert that the cast is valid. Added: Modified: clang/lib/AST/DeclCXX.cpp Removed: diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp index 16eb8206dba2..b806adf36bfb 100644 --- a/clang/lib/AST/DeclCXX.cpp +++ b/clang/lib/AST/DeclCXX.cpp @@ -1508,7 +1508,7 @@ CXXMethodDecl *CXXRecordDecl::getLambdaCallOperator() const { CXXMethodDecl* CXXRecordDecl::getLambdaStaticInvoker() const { CXXMethodDecl *CallOp = getLambdaCallOperator(); - CallingConv CC = CallOp->getType()->getAs()->getCallConv(); + CallingConv CC = CallOp->getType()->castAs()->getCallConv(); return getLambdaStaticInvoker(CC); } @@ -1532,8 +1532,8 @@ CXXMethodDecl *CXXRecordDecl::getLambdaStaticInvoker(CallingConv CC) const { DeclContext::lookup_result Invoker = getLambdaStaticInvokers(*this); for (NamedDecl *ND : Invoker) { -const FunctionType *FTy = -cast(ND->getAsFunction())->getType()->getAs(); +const auto *FTy = + cast(ND->getAsFunction())->getType()->castAs(); if (FTy->getCallConv() == CC) return getInvokerAsMethod(ND); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 8b58092 - ExternalASTSource.h - remove unused StringRef and includes. NFCI.
Author: Simon Pilgrim Date: 2021-06-07T12:28:31+01:00 New Revision: 8b58092de49b8be964e760c161585665e8d8c48f URL: https://github.com/llvm/llvm-project/commit/8b58092de49b8be964e760c161585665e8d8c48f DIFF: https://github.com/llvm/llvm-project/commit/8b58092de49b8be964e760c161585665e8d8c48f.diff LOG: ExternalASTSource.h - remove unused StringRef and includes. NFCI. Added: Modified: clang/include/clang/AST/ExternalASTSource.h Removed: diff --git a/clang/include/clang/AST/ExternalASTSource.h b/clang/include/clang/AST/ExternalASTSource.h index 6ec6edb858e9..b1851afcda37 100644 --- a/clang/include/clang/AST/ExternalASTSource.h +++ b/clang/include/clang/AST/ExternalASTSource.h @@ -24,14 +24,12 @@ #include "llvm/ADT/PointerUnion.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" -#include "llvm/ADT/StringRef.h" #include "llvm/ADT/iterator.h" #include "llvm/Support/PointerLikeTypeTraits.h" #include #include #include #include -#include #include namespace clang { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] d806d11 - Interp.h - AddSubMulHelper - avoid APSInt::toString std::string wrapper. NFCI
Author: Simon Pilgrim Date: 2021-06-09T11:09:31+01:00 New Revision: d806d11b14e1db7d5c5986d563e74ca972f0e5e6 URL: https://github.com/llvm/llvm-project/commit/d806d11b14e1db7d5c5986d563e74ca972f0e5e6 DIFF: https://github.com/llvm/llvm-project/commit/d806d11b14e1db7d5c5986d563e74ca972f0e5e6.diff LOG: Interp.h - AddSubMulHelper - avoid APSInt::toString std::string wrapper. NFCI Pulled out of D103888 - use the underlying SmallString version directly Added: Modified: clang/lib/AST/Interp/Interp.h Removed: diff --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h index a63c5a871ba33..e2f7bf0dc26a4 100644 --- a/clang/lib/AST/Interp/Interp.h +++ b/clang/lib/AST/Interp/Interp.h @@ -118,7 +118,8 @@ bool AddSubMulHelper(InterpState , CodePtr OpPC, unsigned Bits, const T , const Expr *E = S.Current->getExpr(OpPC); QualType Type = E->getType(); if (S.checkingForUndefinedBehavior()) { -auto Trunc = Value.trunc(Result.bitWidth()).toString(10); +SmallString<32> Trunc; +Value.trunc(Result.bitWidth()).toString(Trunc, 10); auto Loc = E->getExprLoc(); S.report(Loc, diag::warn_integer_constant_overflow) << Trunc << Type; return true; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] f3fd36e - JSONNodeDumper.cpp - VisitIntegerLiteral - avoid APSInt::toString std::string wrapper. NFCI
Author: Simon Pilgrim Date: 2021-06-09T11:09:32+01:00 New Revision: f3fd36e590f4ca36e466801bee40497714df895c URL: https://github.com/llvm/llvm-project/commit/f3fd36e590f4ca36e466801bee40497714df895c DIFF: https://github.com/llvm/llvm-project/commit/f3fd36e590f4ca36e466801bee40497714df895c.diff LOG: JSONNodeDumper.cpp - VisitIntegerLiteral - avoid APSInt::toString std::string wrapper. NFCI Pulled out of D103888 - use the underlying SmallString version directly Added: Modified: clang/lib/AST/JSONNodeDumper.cpp Removed: diff --git a/clang/lib/AST/JSONNodeDumper.cpp b/clang/lib/AST/JSONNodeDumper.cpp index d2835583a0f2..038aceea54ff 100644 --- a/clang/lib/AST/JSONNodeDumper.cpp +++ b/clang/lib/AST/JSONNodeDumper.cpp @@ -1414,9 +1414,10 @@ void JSONNodeDumper::VisitCXXDependentScopeMemberExpr( } void JSONNodeDumper::VisitIntegerLiteral(const IntegerLiteral *IL) { - JOS.attribute("value", -IL->getValue().toString( -/*Radix=*/10, IL->getType()->isSignedIntegerType())); + llvm::SmallString<16> Buffer; + IL->getValue().toString(Buffer, + /*Radix=*/10, IL->getType()->isSignedIntegerType()); + JOS.attribute("value", Buffer); } void JSONNodeDumper::VisitCharacterLiteral(const CharacterLiteral *CL) { // FIXME: This should probably print the character literal as a string, ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 206a66d - Sanitizers.h - remove MathExtras.h include dependency
Author: Simon Pilgrim Date: 2021-06-09T14:38:20+01:00 New Revision: 206a66de5902b2b6dc0c62c4a25526d7e7f24186 URL: https://github.com/llvm/llvm-project/commit/206a66de5902b2b6dc0c62c4a25526d7e7f24186 DIFF: https://github.com/llvm/llvm-project/commit/206a66de5902b2b6dc0c62c4a25526d7e7f24186.diff LOG: Sanitizers.h - remove MathExtras.h include dependency The MathExtras.h header is included purely for the countPopulation() method - by moving this into Sanitizers.cpp we can remove the use of this costly header. We only ever use isPowerOf2() / countPopulation() inside asserts so this shouldn't have any performance effects on production code. Differential Revision: https://reviews.llvm.org/D103953 Added: Modified: clang/include/clang/Basic/Sanitizers.h clang/lib/Basic/Sanitizers.cpp Removed: diff --git a/clang/include/clang/Basic/Sanitizers.h b/clang/include/clang/Basic/Sanitizers.h index 1acce0a6e09e..82e5a73dee2e 100644 --- a/clang/include/clang/Basic/Sanitizers.h +++ b/clang/include/clang/Basic/Sanitizers.h @@ -16,7 +16,6 @@ #include "clang/Basic/LLVM.h" #include "llvm/ADT/StringRef.h" -#include "llvm/Support/MathExtras.h" #include "llvm/Transforms/Instrumentation/AddressSanitizerOptions.h" #include #include @@ -60,12 +59,7 @@ class SanitizerMask { return SanitizerMask(mask1, mask2); } - unsigned countPopulation() const { -unsigned total = 0; -for (const auto : maskLoToHigh) - total += llvm::countPopulation(Val); -return total; - } + unsigned countPopulation() const; void flipAllBits() { for (auto : maskLoToHigh) diff --git a/clang/lib/Basic/Sanitizers.cpp b/clang/lib/Basic/Sanitizers.cpp index d8de850485eb..3a3b24a62e11 100644 --- a/clang/lib/Basic/Sanitizers.cpp +++ b/clang/lib/Basic/Sanitizers.cpp @@ -14,6 +14,7 @@ #include "llvm/ADT/Hashing.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringSwitch.h" +#include "llvm/Support/MathExtras.h" using namespace clang; @@ -57,6 +58,13 @@ llvm::hash_code SanitizerMask::hash_value() const { } namespace clang { +unsigned SanitizerMask::countPopulation() const { + unsigned total = 0; + for (const auto : maskLoToHigh) +total += llvm::countPopulation(Val); + return total; +} + llvm::hash_code hash_value(const clang::SanitizerMask ) { return Arg.hash_value(); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] 0ce61d4 - Add explicit braces to silence warning about ambiguous 'else' inside the EXPECT_EQ macro. NFCI.
Author: Simon Pilgrim Date: 2021-06-10T10:55:24+01:00 New Revision: 0ce61d47c03df280ce41e226527f8c72fcfa4b13 URL: https://github.com/llvm/llvm-project/commit/0ce61d47c03df280ce41e226527f8c72fcfa4b13 DIFF: https://github.com/llvm/llvm-project/commit/0ce61d47c03df280ce41e226527f8c72fcfa4b13.diff LOG: Add explicit braces to silence warning about ambiguous 'else' inside the EXPECT_EQ macro. NFCI. Added: Modified: clang-tools-extra/clangd/unittests/SelectionTests.cpp Removed: diff --git a/clang-tools-extra/clangd/unittests/SelectionTests.cpp b/clang-tools-extra/clangd/unittests/SelectionTests.cpp index a063c84a6a4ca..85b7d9fb541a1 100644 --- a/clang-tools-extra/clangd/unittests/SelectionTests.cpp +++ b/clang-tools-extra/clangd/unittests/SelectionTests.cpp @@ -659,10 +659,11 @@ TEST(SelectionTest, CreateAll) { AST.getASTContext(), AST.getTokens(), Test.point("ambiguous"), Test.point("ambiguous"), [&](SelectionTree T) { // Expect to see the right-biased tree first. -if (Seen == 0) +if (Seen == 0) { EXPECT_EQ("BinaryOperator", nodeKind(T.commonAncestor())); -else if (Seen == 1) +} else if (Seen == 1) { EXPECT_EQ("IntegerLiteral", nodeKind(T.commonAncestor())); +} ++Seen; return false; }); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 7d7e913 - SValExplainer.h - get APSInt values by const reference instead of value. NFCI.
Author: Simon Pilgrim Date: 2021-06-13T13:05:17+01:00 New Revision: 7d7e913e096a915038dd41d0bfe5dd8827da1f60 URL: https://github.com/llvm/llvm-project/commit/7d7e913e096a915038dd41d0bfe5dd8827da1f60 DIFF: https://github.com/llvm/llvm-project/commit/7d7e913e096a915038dd41d0bfe5dd8827da1f60.diff LOG: SValExplainer.h - get APSInt values by const reference instead of value. NFCI. Avoid unnecessary copies. Added: Modified: clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h Removed: diff --git a/clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h b/clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h index 0f33909daec0d..31a4ed50a7230 100644 --- a/clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h +++ b/clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h @@ -65,7 +65,7 @@ class SValExplainer : public FullSValVisitor { } std::string VisitLocConcreteInt(loc::ConcreteInt V) { -llvm::APSInt I = V.getValue(); +const llvm::APSInt = V.getValue(); std::string Str; llvm::raw_string_ostream OS(Str); OS << "concrete memory address '" << I << "'"; @@ -77,7 +77,7 @@ class SValExplainer : public FullSValVisitor { } std::string VisitNonLocConcreteInt(nonloc::ConcreteInt V) { -llvm::APSInt I = V.getValue(); +const llvm::APSInt = V.getValue(); std::string Str; llvm::raw_string_ostream OS(Str); OS << (I.isSigned() ? "signed " : "unsigned ") << I.getBitWidth() ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] 61cdaf6 - [ADT] Remove APInt/APSInt toString() std::string variants
Author: Simon Pilgrim Date: 2021-06-11T13:19:15+01:00 New Revision: 61cdaf66fe22be2b5942ddee4f46a998b4f3ee29 URL: https://github.com/llvm/llvm-project/commit/61cdaf66fe22be2b5942ddee4f46a998b4f3ee29 DIFF: https://github.com/llvm/llvm-project/commit/61cdaf66fe22be2b5942ddee4f46a998b4f3ee29.diff LOG: [ADT] Remove APInt/APSInt toString() std::string variants is currently the highest impact header in a clang+llvm build: https://commondatastorage.googleapis.com/chromium-browser-clang/llvm-include-analysis.html One of the most common places this is being included is the APInt.h header, which needs it for an old toString() implementation that returns std::string - an inefficient method compared to the SmallString versions that it actually wraps. This patch replaces these APInt/APSInt methods with a pair of llvm::toString() helpers inside StringExtras.h, adjusts users accordingly and removes the from APInt.h - I was hoping that more of these users could be converted to use the SmallString methods, but it appears that most end up creating a std::string anyhow. I avoided trying to use the raw_ostream << operators as well as I didn't want to lose having the integer radix explicit in the code. Differential Revision: https://reviews.llvm.org/D103888 Added: Modified: clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp clang-tools-extra/clangd/DumpAST.cpp clang-tools-extra/clangd/Hover.cpp clang/include/clang/ASTMatchers/ASTMatchers.h clang/lib/AST/ASTDiagnostic.cpp clang/lib/AST/ASTStructuralEquivalence.cpp clang/lib/AST/ExprConstant.cpp clang/lib/AST/StmtPrinter.cpp clang/lib/AST/TemplateBase.cpp clang/lib/AST/TextNodeDumper.cpp clang/lib/Analysis/ThreadSafetyCommon.cpp clang/lib/CodeGen/CGBuiltin.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/Frontend/CompilerInvocation.cpp clang/lib/Frontend/InitPreprocessor.cpp clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp clang/lib/Lex/PPExpressions.cpp clang/lib/Sema/SemaCast.cpp clang/lib/Sema/SemaChecking.cpp clang/lib/Sema/SemaConcept.cpp clang/lib/Sema/SemaDecl.cpp clang/lib/Sema/SemaDeclAttr.cpp clang/lib/Sema/SemaDeclCXX.cpp clang/lib/Sema/SemaExpr.cpp clang/lib/Sema/SemaExprCXX.cpp clang/lib/Sema/SemaInit.cpp clang/lib/Sema/SemaOpenMP.cpp clang/lib/Sema/SemaStmt.cpp clang/lib/Sema/SemaStmtAsm.cpp clang/lib/Sema/SemaTemplate.cpp clang/lib/Sema/SemaType.cpp clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp clang/unittests/StaticAnalyzer/RangeSetTest.cpp clang/unittests/Tooling/RecursiveASTVisitorTestPostOrderVisitor.cpp clang/unittests/Tooling/RecursiveASTVisitorTests/CallbacksCommon.h llvm/include/llvm/ADT/APInt.h llvm/include/llvm/ADT/APSInt.h llvm/include/llvm/ADT/StringExtras.h llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp llvm/lib/Support/APInt.cpp llvm/lib/Target/X86/X86MCInstLower.cpp llvm/lib/Transforms/IPO/OpenMPOpt.cpp llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp llvm/tools/llvm-pdbutil/MinimalTypeDumper.cpp llvm/unittests/ADT/APIntTest.cpp llvm/unittests/ADT/StringExtrasTest.cpp Removed: diff --git a/clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp b/clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp index 125812f4f3a81..84c7a9fa92471 100644 --- a/clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp +++ b/clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp @@ -208,7 +208,7 @@ stripFloatLiteralFraction(const MatchFinder::MatchResult , if (const auto *LitFloat = llvm::dyn_cast()) // Attempt to simplify a `Duration` factory call with a literal argument. if (llvm::Optional IntValue = truncateIfIntegral(*LitFloat)) - return IntValue->toString(/*radix=*/10); + return toString(*IntValue, /*radix=*/10); return llvm::None; } diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp index 1826e955f6a93..450b56135a78b 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp @@ -99,7 +99,7 @@ void ProBoundsConstantArrayIndexCheck::check( if (Index->isSigned() && Index->isNegative()) { diag(Matched->getExprLoc(), "std::array<> index %0 is negative") -<< Index->toString(10); +<< toString(*Index, 10); return; } @@ -118,7 +118,7 @@ void ProBoundsConstantArrayIndexCheck::check( diag(Matched->getExprLoc(),
[clang] f7bc9db - Fix Wdocumentation missing parameter warnings. NFCI.
Author: Simon Pilgrim Date: 2021-06-11T14:32:35+01:00 New Revision: f7bc9db95aba77157f10b627a4dea32c3174e148 URL: https://github.com/llvm/llvm-project/commit/f7bc9db95aba77157f10b627a4dea32c3174e148 DIFF: https://github.com/llvm/llvm-project/commit/f7bc9db95aba77157f10b627a4dea32c3174e148.diff LOG: Fix Wdocumentation missing parameter warnings. NFCI. Added: Modified: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h Removed: diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h index 17a8e7859a54..047b2072bbcd 100644 --- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h +++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h @@ -317,8 +317,7 @@ class StoreHandler { /// Handle the given store and produce the node. /// - /// \param E The expression value which we are tracking - /// \param N A node where the evaluation of \c E actually happens. + /// \param SI The information fully describing the store. /// \param Opts Tracking options specifying how we are tracking the value. /// /// \return the produced note, null if the handler doesn't support this kind @@ -346,8 +345,7 @@ class TrackingBugReporterVisitor : public BugReporterVisitor { /// \param N A node "downstream" from the evaluation of the statement. /// \param E The expression value which we are tracking /// \param R The bug report to which visitors should be attached. -/// \param EnableNullFPSuppression Whether we should employ false positive -/// suppression (inlined defensive checks, returned null). +/// \param Opts Tracking options specifying how we are tracking the value. /// /// \return Whether or not the function was able to add visitors for this /// statement. Note that returning \c true does not actually imply ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] b89e09a - Silence "Undefined or garbage value returned to caller" static analysis warning. NFCI.
Author: Simon Pilgrim Date: 2021-05-17T14:08:27+01:00 New Revision: b89e09a19f9b60dfa9477b24a404a7ae5522f898 URL: https://github.com/llvm/llvm-project/commit/b89e09a19f9b60dfa9477b24a404a7ae5522f898 DIFF: https://github.com/llvm/llvm-project/commit/b89e09a19f9b60dfa9477b24a404a7ae5522f898.diff LOG: Silence "Undefined or garbage value returned to caller" static analysis warning. NFCI. Added: Modified: clang/lib/Driver/Driver.cpp Removed: diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 1086887a8de5..25af909d9bd2 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -3449,7 +3449,7 @@ class OffloadingActionBuilder final { return nullptr; // Let builders add host linking actions. -Action* HA; +Action* HA = nullptr; for (DeviceActionBuilder *SB : SpecializedBuilders) { if (!SB->isValid()) continue; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 72390f0 - DirectoryWatcher-linux.cpp - add missing implicit MathExtras.h header dependency. NFCI.
Author: Simon Pilgrim Date: 2021-06-06T09:40:20+01:00 New Revision: 72390f0c28dddffc53c20ba0ec765b8de4e05383 URL: https://github.com/llvm/llvm-project/commit/72390f0c28dddffc53c20ba0ec765b8de4e05383 DIFF: https://github.com/llvm/llvm-project/commit/72390f0c28dddffc53c20ba0ec765b8de4e05383.diff LOG: DirectoryWatcher-linux.cpp - add missing implicit MathExtras.h header dependency. NFCI. Added: Modified: clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp Removed: diff --git a/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp b/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp index 176d6d6abf33b..963256f268bbb 100644 --- a/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp +++ b/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp @@ -14,6 +14,7 @@ #include "llvm/Support/AlignOf.h" #include "llvm/Support/Errno.h" #include "llvm/Support/Error.h" +#include "llvm/Support/MathExtras.h" #include "llvm/Support/Path.h" #include #include ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 30a89a7 - ASTConcept.h - remove unused include. NFCI.
Author: Simon Pilgrim Date: 2021-06-07T10:58:32+01:00 New Revision: 30a89a754af4a7bc8afd485021f9e68d5d70 URL: https://github.com/llvm/llvm-project/commit/30a89a754af4a7bc8afd485021f9e68d5d70 DIFF: https://github.com/llvm/llvm-project/commit/30a89a754af4a7bc8afd485021f9e68d5d70.diff LOG: ASTConcept.h - remove unused include. NFCI. Added: Modified: clang/include/clang/AST/ASTConcept.h Removed: diff --git a/clang/include/clang/AST/ASTConcept.h b/clang/include/clang/AST/ASTConcept.h index 71bf14a87865..d0526f4fa5c5 100644 --- a/clang/include/clang/AST/ASTConcept.h +++ b/clang/include/clang/AST/ASTConcept.h @@ -14,12 +14,13 @@ #ifndef LLVM_CLANG_AST_ASTCONCEPT_H #define LLVM_CLANG_AST_ASTCONCEPT_H + #include "clang/AST/Expr.h" #include "clang/Basic/SourceLocation.h" #include "llvm/ADT/PointerUnion.h" #include "llvm/ADT/SmallVector.h" -#include #include + namespace clang { class ConceptDecl; class ConceptSpecializationExpr; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 769e782 - Fix MSVC "truncation from 'int' to 'bool'" warning. NFCI.
Author: Simon Pilgrim Date: 2021-07-08T18:08:24+01:00 New Revision: 769e782793391a1ee0d257c8b0c6f43a02321e22 URL: https://github.com/llvm/llvm-project/commit/769e782793391a1ee0d257c8b0c6f43a02321e22 DIFF: https://github.com/llvm/llvm-project/commit/769e782793391a1ee0d257c8b0c6f43a02321e22.diff LOG: Fix MSVC "truncation from 'int' to 'bool'" warning. NFCI. Added: Modified: clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp Removed: diff --git a/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp b/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp index cb4f50ee1ed46..a0e52b1931520 100644 --- a/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp +++ b/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp @@ -1144,7 +1144,7 @@ static Error UnbundleArchive() { StringRef IFName = InputFileNames.front(); ErrorOr> BufOrErr = - MemoryBuffer::getFileOrSTDIN(IFName, -1, false); + MemoryBuffer::getFileOrSTDIN(IFName, true, false); if (std::error_code EC = BufOrErr.getError()) return createFileError(InputFileNames.front(), EC); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] edc8f0b - TypeMismatchCheck.cpp - fix Wdocumentation warning. NFCI.
Author: Simon Pilgrim Date: 2021-02-05T10:57:39Z New Revision: edc8f0b407a1ca5373f72af6a5ed658929603be9 URL: https://github.com/llvm/llvm-project/commit/edc8f0b407a1ca5373f72af6a5ed658929603be9 DIFF: https://github.com/llvm/llvm-project/commit/edc8f0b407a1ca5373f72af6a5ed658929603be9.diff LOG: TypeMismatchCheck.cpp - fix Wdocumentation warning. NFCI. Added: Modified: clang-tools-extra/clang-tidy/mpi/TypeMismatchCheck.cpp Removed: diff --git a/clang-tools-extra/clang-tidy/mpi/TypeMismatchCheck.cpp b/clang-tools-extra/clang-tidy/mpi/TypeMismatchCheck.cpp index 2d8da68cd6a7..cc60ea365c2f 100644 --- a/clang-tools-extra/clang-tidy/mpi/TypeMismatchCheck.cpp +++ b/clang-tools-extra/clang-tidy/mpi/TypeMismatchCheck.cpp @@ -228,7 +228,7 @@ static bool isTypedefTypeMatching(const TypedefType *const Typedef, /// Get the unqualified, dereferenced type of an argument. /// /// \param CE call expression -/// \param idx argument index +/// \param Idx argument index /// /// \returns type of the argument static const Type *argumentType(const CallExpr *const CE, const size_t Idx) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 2901dc7 - Don't directly dereference getAs<> casts to avoid potential null dereferences. NFCI.
Author: Simon Pilgrim Date: 2021-04-06T12:24:19+01:00 New Revision: 2901dc7575873ed4bdfa1d7a0e79020e7a9ffb3d URL: https://github.com/llvm/llvm-project/commit/2901dc7575873ed4bdfa1d7a0e79020e7a9ffb3d DIFF: https://github.com/llvm/llvm-project/commit/2901dc7575873ed4bdfa1d7a0e79020e7a9ffb3d.diff LOG: Don't directly dereference getAs<> casts to avoid potential null dereferences. NFCI. Replace with castAs<> which asserts the cast is valid. Fixes a number of static analyzer warnings. Added: Modified: clang/lib/AST/ExprConstant.cpp clang/lib/Analysis/CalledOnceCheck.cpp clang/lib/CodeGen/CGBuiltin.cpp clang/lib/CodeGen/CGCUDANV.cpp clang/lib/CodeGen/CGExprScalar.cpp clang/lib/Sema/SemaDecl.cpp clang/lib/Sema/SemaDeclCXX.cpp clang/lib/Sema/SemaExpr.cpp clang/lib/Sema/SemaExprMember.cpp clang/lib/Sema/SemaOverload.cpp clang/lib/Sema/SemaTemplateDeduction.cpp clang/unittests/AST/ASTImporterTest.cpp Removed: diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 624b1bfde4e64..b42f3b695ec57 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -10307,10 +10307,10 @@ bool VectorExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) { "Must both be vector types"); // Checking JUST the types are the same would be fine, except shifts don't // need to have their types be the same (since you always shift by an int). - assert(LHS->getType()->getAs()->getNumElements() == - E->getType()->getAs()->getNumElements() && - RHS->getType()->getAs()->getNumElements() == - E->getType()->getAs()->getNumElements() && + assert(LHS->getType()->castAs()->getNumElements() == + E->getType()->castAs()->getNumElements() && + RHS->getType()->castAs()->getNumElements() == + E->getType()->castAs()->getNumElements() && "All operands must be the same size."); APValue LHSValue; diff --git a/clang/lib/Analysis/CalledOnceCheck.cpp b/clang/lib/Analysis/CalledOnceCheck.cpp index 00bb51a1c0d3d..9fa8ac30404c3 100644 --- a/clang/lib/Analysis/CalledOnceCheck.cpp +++ b/clang/lib/Analysis/CalledOnceCheck.cpp @@ -983,9 +983,9 @@ class CalledOnceChecker : public ConstStmtVisitor { return false; } -QualType BlockType = Ty->getAs()->getPointeeType(); +QualType BlockType = Ty->castAs()->getPointeeType(); // Completion handlers should have a block type with void return type. -return BlockType->getAs()->getReturnType()->isVoidType(); +return BlockType->castAs()->getReturnType()->isVoidType(); } /// Return true if the only parameter of the function is conventional. diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 6b43a8de218e2..a38176af390d4 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -8760,7 +8760,7 @@ Value *CodeGenFunction::EmitSVEMaskedLoad(const CallExpr *E, bool IsZExtReturn) { QualType LangPTy = E->getArg(1)->getType(); llvm::Type *MemEltTy = CGM.getTypes().ConvertType( - LangPTy->getAs()->getPointeeType()); + LangPTy->castAs()->getPointeeType()); // The vector type that is returned may be diff erent from the // eventual type loaded from memory. @@ -8785,7 +8785,7 @@ Value *CodeGenFunction::EmitSVEMaskedStore(const CallExpr *E, unsigned BuiltinID) { QualType LangPTy = E->getArg(1)->getType(); llvm::Type *MemEltTy = CGM.getTypes().ConvertType( - LangPTy->getAs()->getPointeeType()); + LangPTy->castAs()->getPointeeType()); // The vector type that is stored may be diff erent from the // eventual type stored to memory. diff --git a/clang/lib/CodeGen/CGCUDANV.cpp b/clang/lib/CodeGen/CGCUDANV.cpp index d53a623b258c1..b224de7c197ae 100644 --- a/clang/lib/CodeGen/CGCUDANV.cpp +++ b/clang/lib/CodeGen/CGCUDANV.cpp @@ -1027,9 +1027,8 @@ void CGNVCUDARuntime::handleVarRegistration(const VarDecl *D, D->getType()->isCUDADeviceBuiltinTextureType()) { // Builtin surfaces and textures and their template arguments are // also registered with CUDA runtime. -const ClassTemplateSpecializationDecl *TD = -cast( -D->getType()->getAs()->getDecl()); +const auto *TD = cast( +D->getType()->castAs()->getDecl()); const TemplateArgumentList = TD->getTemplateArgs(); if (TD->hasAttr()) { assert(Args.size() == 2 && diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index ef3e27ecec997..c4d49d3ac6958 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -1729,7 +1729,7 @@ Value *ScalarExprEmitter::VisitMatrixSubscriptExpr(MatrixSubscriptExpr *E) {
[clang] d53866f - Fix MSVC "result of 32-bit shift implicitly converted to 64 bits" warnings. NFCI.
Author: Simon Pilgrim Date: 2021-03-11T10:29:14Z New Revision: d53866ff473d4023b0e3db68a1b91cfa59aacbb9 URL: https://github.com/llvm/llvm-project/commit/d53866ff473d4023b0e3db68a1b91cfa59aacbb9 DIFF: https://github.com/llvm/llvm-project/commit/d53866ff473d4023b0e3db68a1b91cfa59aacbb9.diff LOG: Fix MSVC "result of 32-bit shift implicitly converted to 64 bits" warnings. NFCI. Added: Modified: clang/utils/TableGen/RISCVVEmitter.cpp Removed: diff --git a/clang/utils/TableGen/RISCVVEmitter.cpp b/clang/utils/TableGen/RISCVVEmitter.cpp index 49574e45d5bd..ba96396c780d 100644 --- a/clang/utils/TableGen/RISCVVEmitter.cpp +++ b/clang/utils/TableGen/RISCVVEmitter.cpp @@ -244,8 +244,8 @@ LMULType::LMULType(int NewLog2LMUL) { std::string LMULType::str() const { if (Log2LMUL < 0) -return "mf" + utostr(1 << (-Log2LMUL)); - return "m" + utostr(1 << Log2LMUL); +return "mf" + utostr(1ULL << (-Log2LMUL)); + return "m" + utostr(1ULL << Log2LMUL); } VScaleVal LMULType::getScale(unsigned ElementBitwidth) const { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] df2a6ee - [Sema] Use castAs<> instead getAs<> for dereferenced pointer casts. NFCI.
Author: Simon Pilgrim Date: 2021-03-11T14:51:25Z New Revision: df2a6ee3247c9d00b42c14ea924fd25cc45bda87 URL: https://github.com/llvm/llvm-project/commit/df2a6ee3247c9d00b42c14ea924fd25cc45bda87 DIFF: https://github.com/llvm/llvm-project/commit/df2a6ee3247c9d00b42c14ea924fd25cc45bda87.diff LOG: [Sema] Use castAs<> instead getAs<> for dereferenced pointer casts. NFCI. getAs<> returns null for missed casts, resulting in null dereferences - use castAs<> instead which will assert the cast is correct. Added: Modified: clang/lib/Sema/SemaDeclAttr.cpp Removed: diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index c309f0436437..459343637318 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -2836,8 +2836,10 @@ static void handleSentinelAttr(Sema , Decl *D, const ParsedAttr ) { QualType Ty = V->getType(); if (Ty->isBlockPointerType() || Ty->isFunctionPointerType()) { const FunctionType *FT = Ty->isFunctionPointerType() - ? D->getFunctionType() - : Ty->castAs()->getPointeeType()->getAs(); + ? D->getFunctionType() + : Ty->castAs() + ->getPointeeType() + ->castAs(); if (!cast(FT)->isVariadic()) { int m = Ty->isFunctionPointerType() ? 0 : 1; S.Diag(AL.getLoc(), diag::warn_attribute_sentinel_not_variadic) << m; @@ -5836,7 +5838,7 @@ static void checkSwiftAsyncErrorBlock(Sema , Decl *D, // handleSwiftAsyncAttr already verified the type is correct, so no need to // double-check it here. const auto *FuncTy = HandlerParam->getType() - ->getAs() + ->castAs() ->getPointeeType() ->getAs(); ArrayRef BlockParams; @@ -6313,8 +6315,8 @@ static void handleSwiftAsyncAttr(Sema , Decl *D, const ParsedAttr ) { return; } QualType BlockTy = -CompletionBlockType->getAs()->getPointeeType(); -if (!BlockTy->getAs()->getReturnType()->isVoidType()) { +CompletionBlockType->castAs()->getPointeeType(); +if (!BlockTy->castAs()->getReturnType()->isVoidType()) { S.Diag(CompletionBlock->getLocation(), diag::err_swift_async_bad_block_type) << CompletionBlock->getType(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 731b3d7 - [clang] Use Constant::getAllOnesValue helper. NFCI.
Author: Simon Pilgrim Date: 2021-03-12T15:16:36Z New Revision: 731b3d766420ce05726174ff0e1527dca8a63791 URL: https://github.com/llvm/llvm-project/commit/731b3d766420ce05726174ff0e1527dca8a63791 DIFF: https://github.com/llvm/llvm-project/commit/731b3d766420ce05726174ff0e1527dca8a63791.diff LOG: [clang] Use Constant::getAllOnesValue helper. NFCI. Avoid -1ULL which MSVC tends to complain about Added: Modified: clang/lib/CodeGen/CGExprScalar.cpp Removed: diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 4774f92a2eed..ef3e27ecec99 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -3125,7 +3125,7 @@ void ScalarExprEmitter::EmitUndefinedBehaviorIntegerDivAndRemCheck( llvm::Value *IntMin = Builder.getInt(llvm::APInt::getSignedMinValue(Ty->getBitWidth())); -llvm::Value *NegOne = llvm::ConstantInt::get(Ty, -1ULL); +llvm::Value *NegOne = llvm::Constant::getAllOnesValue(Ty); llvm::Value *LHSCmp = Builder.CreateICmpNE(Ops.LHS, IntMin); llvm::Value *RHSCmp = Builder.CreateICmpNE(Ops.RHS, NegOne); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fdae557 - [clang] DeltaTree::AddDelta - fix "initialization is never read" clang-tidy warning. NFCI.
Author: Simon Pilgrim Date: 2021-03-02T15:01:34Z New Revision: fdae5573f54dd5f790630f5bba7f08bb00d62846 URL: https://github.com/llvm/llvm-project/commit/fdae5573f54dd5f790630f5bba7f08bb00d62846 DIFF: https://github.com/llvm/llvm-project/commit/fdae5573f54dd5f790630f5bba7f08bb00d62846.diff LOG: [clang] DeltaTree::AddDelta - fix "initialization is never read" clang-tidy warning. NFCI. Added: Modified: clang/lib/Rewrite/DeltaTree.cpp Removed: diff --git a/clang/lib/Rewrite/DeltaTree.cpp b/clang/lib/Rewrite/DeltaTree.cpp index d27795c2f479..61467f84928f 100644 --- a/clang/lib/Rewrite/DeltaTree.cpp +++ b/clang/lib/Rewrite/DeltaTree.cpp @@ -458,7 +458,10 @@ void DeltaTree::AddDelta(unsigned FileIndex, int Delta) { DeltaTreeNode::InsertResult InsertRes; if (MyRoot->DoInsertion(FileIndex, Delta, )) { -Root = MyRoot = new DeltaTreeInteriorNode(InsertRes); +Root = new DeltaTreeInteriorNode(InsertRes); +#ifdef VERIFY_TREE +MyRoot = Root; +#endif } #ifdef VERIFY_TREE ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 67a3260 - Fix Wdocumentation parameter warning. NFCI.
Author: Simon Pilgrim Date: 2021-02-23T11:44:45Z New Revision: 67a326098c7c32f3d6eeea7357d83eac4ff996be URL: https://github.com/llvm/llvm-project/commit/67a326098c7c32f3d6eeea7357d83eac4ff996be DIFF: https://github.com/llvm/llvm-project/commit/67a326098c7c32f3d6eeea7357d83eac4ff996be.diff LOG: Fix Wdocumentation parameter warning. NFCI. Added: Modified: clang/include/clang/AST/OpenMPClause.h Removed: diff --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h index d1ef052967ff..9c6bbe6082fb 100644 --- a/clang/include/clang/AST/OpenMPClause.h +++ b/clang/include/clang/AST/OpenMPClause.h @@ -833,7 +833,7 @@ class OMPSizesClause final /// Build an empty 'sizes' AST node for deserialization. /// /// \param C Context of the AST. - /// \param Sizes Number of items in the clause. + /// \param NumSizes Number of items in the clause. static OMPSizesClause *CreateEmpty(const ASTContext , unsigned NumSizes); /// Sets the location of '('. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] ed95129 - Fix Wdocumentation unknown parameter warning. NFCI.
Author: Simon Pilgrim Date: 2021-03-05T15:58:20Z New Revision: ed951293affca9abd92c886432115f35065cad3c URL: https://github.com/llvm/llvm-project/commit/ed951293affca9abd92c886432115f35065cad3c DIFF: https://github.com/llvm/llvm-project/commit/ed951293affca9abd92c886432115f35065cad3c.diff LOG: Fix Wdocumentation unknown parameter warning. NFCI. Added: Modified: clang/lib/Sema/SemaOpenMP.cpp Removed: diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 6fcb472cd60cc..8f7cf57fb9112 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -5187,7 +5187,7 @@ static VarDecl *precomputeExpr(Sema , /// \param Rel Comparison operator of the loop condition. /// \param StartExpr Value of the loop counter at the first iteration. /// \param StopExpr Expression the loop counter is compared against in the loop -/// condition. \param Step Amount of increment after each iteration. +/// condition. \param StepExpr Amount of increment after each iteration. /// /// \return Closure (CapturedStmt) of the distance calculation. static CapturedStmt *buildDistanceFunc(Sema , QualType LogicalTy, ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 5d7cb79 - RISCVABIInfo::classifyArgumentType: Fix static analyzer warnings with uninitialized variables warnings - NFCI
Author: Soumi Manna Date: 2021-04-09T15:23:32+01:00 New Revision: 5d7cb79416adee00cf52be12ee42692dd19d4acb URL: https://github.com/llvm/llvm-project/commit/5d7cb79416adee00cf52be12ee42692dd19d4acb DIFF: https://github.com/llvm/llvm-project/commit/5d7cb79416adee00cf52be12ee42692dd19d4acb.diff LOG: RISCVABIInfo::classifyArgumentType: Fix static analyzer warnings with uninitialized variables warnings - NFCI Differential Revision: https://reviews.llvm.org/D100172 Added: Modified: clang/lib/CodeGen/TargetInfo.cpp Removed: diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index c3df36fc1ea2..de3d3f86fe9b 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -10700,8 +10700,8 @@ ABIArgInfo RISCVABIInfo::classifyArgumentType(QualType Ty, bool IsFixed, llvm::Type *Field2Ty = nullptr; CharUnits Field1Off = CharUnits::Zero(); CharUnits Field2Off = CharUnits::Zero(); -int NeededArgGPRs; -int NeededArgFPRs; +int NeededArgGPRs = 0; +int NeededArgFPRs = 0; bool IsCandidate = detectFPCCEligibleStruct(Ty, Field1Ty, Field1Off, Field2Ty, Field2Off, NeededArgGPRs, NeededArgFPRs); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fce8c10 - Fix Wdocumentation warning by consistently using '///' comment blocks. NFCI.
Author: Simon Pilgrim Date: 2021-04-20T12:37:00+01:00 New Revision: fce8c10b6813ef283b68275b0dabc813f0310958 URL: https://github.com/llvm/llvm-project/commit/fce8c10b6813ef283b68275b0dabc813f0310958 DIFF: https://github.com/llvm/llvm-project/commit/fce8c10b6813ef283b68275b0dabc813f0310958.diff LOG: Fix Wdocumentation warning by consistently using '///' comment blocks. NFCI. Added: Modified: clang/include/clang/Format/Format.h Removed: diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h index 104b9346cf529..98d2f16e2eefb 100644 --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -1918,19 +1918,19 @@ struct FormatStyle { /// \code /// struct foo { /// private: -// +/// /// int i; /// protected: -// +/// /// int j; /// /* comment */ /// public: -// +/// /// foo() {} /// private: /// /// protected: -// +/// /// }; /// \endcode ELAAMS_Always, ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 7f48bd3 - CGBuiltin.cpp - pass SVETypeFlags by const reference. NFC.
Author: Simon Pilgrim Date: 2021-08-22T12:13:17+01:00 New Revision: 7f48bd3bed9540cc4c72091dfb38e40dfac24aa4 URL: https://github.com/llvm/llvm-project/commit/7f48bd3bed9540cc4c72091dfb38e40dfac24aa4 DIFF: https://github.com/llvm/llvm-project/commit/7f48bd3bed9540cc4c72091dfb38e40dfac24aa4.diff LOG: CGBuiltin.cpp - pass SVETypeFlags by const reference. NFC. Don't pass the struct by value. Added: Modified: clang/lib/CodeGen/CGBuiltin.cpp clang/lib/CodeGen/CodeGenFunction.h Removed: diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 789c446940ce..e930840d16da 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -8379,7 +8379,7 @@ Value *CodeGenFunction::vectorWrapScalar16(Value *Op) { /// SVEBuiltinMemEltTy - Returns the memory element type for this memory /// access builtin. Only required if it can't be inferred from the base pointer /// operand. -llvm::Type *CodeGenFunction::SVEBuiltinMemEltTy(SVETypeFlags TypeFlags) { +llvm::Type *CodeGenFunction::SVEBuiltinMemEltTy(const SVETypeFlags ) { switch (TypeFlags.getMemEltType()) { case SVETypeFlags::MemEltTyDefault: return getEltType(TypeFlags); @@ -8395,7 +8395,7 @@ llvm::Type *CodeGenFunction::SVEBuiltinMemEltTy(SVETypeFlags TypeFlags) { llvm_unreachable("Unknown MemEltType"); } -llvm::Type *CodeGenFunction::getEltType(SVETypeFlags TypeFlags) { +llvm::Type *CodeGenFunction::getEltType(const SVETypeFlags ) { switch (TypeFlags.getEltType()) { default: llvm_unreachable("Invalid SVETypeFlag!"); @@ -8430,7 +8430,7 @@ llvm::Type *CodeGenFunction::getEltType(SVETypeFlags TypeFlags) { // Return the llvm predicate vector type corresponding to the specified element // TypeFlags. llvm::ScalableVectorType * -CodeGenFunction::getSVEPredType(SVETypeFlags TypeFlags) { +CodeGenFunction::getSVEPredType(const SVETypeFlags ) { switch (TypeFlags.getEltType()) { default: llvm_unreachable("Unhandled SVETypeFlag!"); @@ -8499,7 +8499,8 @@ CodeGenFunction::getSVEType(const SVETypeFlags ) { } } -llvm::Value *CodeGenFunction::EmitSVEAllTruePred(SVETypeFlags TypeFlags) { +llvm::Value * +CodeGenFunction::EmitSVEAllTruePred(const SVETypeFlags ) { Function *Ptrue = CGM.getIntrinsic(Intrinsic::aarch64_sve_ptrue, getSVEPredType(TypeFlags)); return Builder.CreateCall(Ptrue, {Builder.getInt32(/*SV_ALL*/ 31)}); @@ -8543,7 +8544,7 @@ Value *CodeGenFunction::EmitSVEPredicateCast(Value *Pred, return C; } -Value *CodeGenFunction::EmitSVEGatherLoad(SVETypeFlags TypeFlags, +Value *CodeGenFunction::EmitSVEGatherLoad(const SVETypeFlags , SmallVectorImpl , unsigned IntID) { auto *ResultTy = getSVEType(TypeFlags); @@ -8595,7 +8596,7 @@ Value *CodeGenFunction::EmitSVEGatherLoad(SVETypeFlags TypeFlags, : Builder.CreateSExt(Call, ResultTy); } -Value *CodeGenFunction::EmitSVEScatterStore(SVETypeFlags TypeFlags, +Value *CodeGenFunction::EmitSVEScatterStore(const SVETypeFlags , SmallVectorImpl , unsigned IntID) { auto *SrcDataTy = getSVEType(TypeFlags); @@ -8650,7 +8651,7 @@ Value *CodeGenFunction::EmitSVEScatterStore(SVETypeFlags TypeFlags, return Builder.CreateCall(F, Ops); } -Value *CodeGenFunction::EmitSVEGatherPrefetch(SVETypeFlags TypeFlags, +Value *CodeGenFunction::EmitSVEGatherPrefetch(const SVETypeFlags , SmallVectorImpl , unsigned IntID) { // The gather prefetches are overloaded on the vector input - this can either @@ -8683,7 +8684,7 @@ Value *CodeGenFunction::EmitSVEGatherPrefetch(SVETypeFlags TypeFlags, return Builder.CreateCall(F, Ops); } -Value *CodeGenFunction::EmitSVEStructLoad(SVETypeFlags TypeFlags, +Value *CodeGenFunction::EmitSVEStructLoad(const SVETypeFlags , SmallVectorImpl , unsigned IntID) { llvm::ScalableVectorType *VTy = getSVEType(TypeFlags); @@ -8717,7 +8718,7 @@ Value *CodeGenFunction::EmitSVEStructLoad(SVETypeFlags TypeFlags, return Builder.CreateCall(F, { Predicate, BasePtr }); } -Value *CodeGenFunction::EmitSVEStructStore(SVETypeFlags TypeFlags, +Value *CodeGenFunction::EmitSVEStructStore(const SVETypeFlags , SmallVectorImpl , unsigned IntID) { llvm::ScalableVectorType *VTy = getSVEType(TypeFlags); @@ -8764,7 +8765,7 @@ Value *CodeGenFunction::EmitSVEStructStore(SVETypeFlags TypeFlags, // SVE2's svpmullb and svpmullt builtins are similar to the svpmullb_pair and // svpmullt_pair intrinsics, with the exception that
[clang-tools-extra] b2aa470 - [clangd] detectClangPath() - remove (dead) return. NFC.
Author: Simon Pilgrim Date: 2021-08-20T12:41:38+01:00 New Revision: b2aa470faeb7aaedfa63cb192a710fbe086f15c1 URL: https://github.com/llvm/llvm-project/commit/b2aa470faeb7aaedfa63cb192a710fbe086f15c1 DIFF: https://github.com/llvm/llvm-project/commit/b2aa470faeb7aaedfa63cb192a710fbe086f15c1.diff LOG: [clangd] detectClangPath() - remove (dead) return. NFC. Added: Modified: clang-tools-extra/clangd/CompileCommands.cpp Removed: diff --git a/clang-tools-extra/clangd/CompileCommands.cpp b/clang-tools-extra/clangd/CompileCommands.cpp index 57933169f9119..f9e283beca64c 100644 --- a/clang-tools-extra/clangd/CompileCommands.cpp +++ b/clang-tools-extra/clangd/CompileCommands.cpp @@ -127,7 +127,6 @@ const llvm::Optional detectSysroot() { if (::getenv("SDKROOT")) return llvm::None; return queryXcrun({"xcrun", "--show-sdk-path"}); - return llvm::None; } std::string detectStandardResourceDir() { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 5b72fb8 - [AST] getDeclLocForCommentSearch - remove dead return. NFC.
Author: Simon Pilgrim Date: 2021-08-20T12:32:29+01:00 New Revision: 5b72fb866c16d63a3403848f0a4f04f522da8ba3 URL: https://github.com/llvm/llvm-project/commit/5b72fb866c16d63a3403848f0a4f04f522da8ba3 DIFF: https://github.com/llvm/llvm-project/commit/5b72fb866c16d63a3403848f0a4f04f522da8ba3.diff LOG: [AST] getDeclLocForCommentSearch - remove dead return. NFC. Don't use an else-block as the previous if-block always returns, and remove the (now more obvious) dead return {}. Added: Modified: clang/lib/AST/ASTContext.cpp Removed: diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 4c9dc42c5b5dd..cf5be0c3219a6 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -172,29 +172,28 @@ static SourceLocation getDeclLocForCommentSearch(const Decl *D, // Allow association with Y across {} in `typedef struct X {} Y`. isa(D)) return D->getBeginLoc(); - else { -const SourceLocation DeclLoc = D->getLocation(); -if (DeclLoc.isMacroID()) { - if (isa(D)) { -// If location of the typedef name is in a macro, it is because being -// declared via a macro. Try using declaration's starting location as -// the "declaration location". -return D->getBeginLoc(); - } else if (const auto *TD = dyn_cast(D)) { -// If location of the tag decl is inside a macro, but the spelling of -// the tag name comes from a macro argument, it looks like a special -// macro like NS_ENUM is being used to define the tag decl. In that -// case, adjust the source location to the expansion loc so that we can -// attach the comment to the tag decl. -if (SourceMgr.isMacroArgExpansion(DeclLoc) && -TD->isCompleteDefinition()) - return SourceMgr.getExpansionLoc(DeclLoc); - } + + const SourceLocation DeclLoc = D->getLocation(); + if (DeclLoc.isMacroID()) { +if (isa(D)) { + // If location of the typedef name is in a macro, it is because being + // declared via a macro. Try using declaration's starting location as + // the "declaration location". + return D->getBeginLoc(); +} + +if (const auto *TD = dyn_cast(D)) { + // If location of the tag decl is inside a macro, but the spelling of + // the tag name comes from a macro argument, it looks like a special + // macro like NS_ENUM is being used to define the tag decl. In that + // case, adjust the source location to the expansion loc so that we can + // attach the comment to the tag decl. + if (SourceMgr.isMacroArgExpansion(DeclLoc) && TD->isCompleteDefinition()) +return SourceMgr.getExpansionLoc(DeclLoc); } -return DeclLoc; } - return {}; + return DeclLoc; } RawComment *ASTContext::getRawCommentForDeclNoCacheImpl( ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 62f4c90 - [Sema] Remove dead return immediately after another return. NFC.
Author: Simon Pilgrim Date: 2021-08-20T12:11:23+01:00 New Revision: 62f4c90aaf1eb418f69e73cbbf170264a02c2688 URL: https://github.com/llvm/llvm-project/commit/62f4c90aaf1eb418f69e73cbbf170264a02c2688 DIFF: https://github.com/llvm/llvm-project/commit/62f4c90aaf1eb418f69e73cbbf170264a02c2688.diff LOG: [Sema] Remove dead return immediately after another return. NFC. Added: Modified: clang/lib/Sema/SemaExpr.cpp Removed: diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 5bde87d02877..daf924b1b199 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -18350,7 +18350,6 @@ static ExprResult rebuildPotentialResultsAsNonOdrUsed(Sema , Expr *E, ME->getQualifierLoc(), ME->getTemplateKeywordLoc(), ME->getMemberDecl(), ME->getFoundDecl(), ME->getMemberNameInfo(), CopiedTemplateArgs(ME), ME->getType(), ME->getValueKind(), ME->getObjectKind(), NOUR); -return ExprEmpty(); } case Expr::BinaryOperatorClass: { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] c94f4a9 - ClangOffloadBundler - getCompatibleOffloadTargets - Fix unknown parameter Wdocumentation warnings. NFC.
Author: Simon Pilgrim Date: 2021-08-20T14:31:11+01:00 New Revision: c94f4a9c5d8ca826986c9490e668ba66afad3419 URL: https://github.com/llvm/llvm-project/commit/c94f4a9c5d8ca826986c9490e668ba66afad3419 DIFF: https://github.com/llvm/llvm-project/commit/c94f4a9c5d8ca826986c9490e668ba66afad3419.diff LOG: ClangOffloadBundler - getCompatibleOffloadTargets - Fix unknown parameter Wdocumentation warnings. NFC. Added: Modified: clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp Removed: diff --git a/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp b/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp index 43f7091c97f3..49275ec198c2 100644 --- a/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp +++ b/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp @@ -1099,8 +1099,8 @@ bool isCodeObjectCompatible(OffloadTargetInfo , /// @brief Computes a list of targets among all given targets which are /// compatible with this code object -/// @param [in] Code Object \p CodeObject -/// @param [out] List of all compatible targets \p CompatibleTargets among all +/// @param [in] CodeObjectInfo Code Object +/// @param [out] CompatibleTargets List of all compatible targets among all /// given targets /// @return false, if no compatible target is found. static bool ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 8bc72de - [Clang][AST][NFC] Resolve FIXME: Remove unused QualType ElementType member from the ASTContext class.
Author: Alfsonso Gregory Date: 2021-08-16T19:07:50+01:00 New Revision: 8bc72dede68ccbbf828c0421276d962d369ba70f URL: https://github.com/llvm/llvm-project/commit/8bc72dede68ccbbf828c0421276d962d369ba70f DIFF: https://github.com/llvm/llvm-project/commit/8bc72dede68ccbbf828c0421276d962d369ba70f.diff LOG: [Clang][AST][NFC] Resolve FIXME: Remove unused QualType ElementType member from the ASTContext class. It is completely unused and not needed to be kept, so let us remove it. Differential Revision: https://reviews.llvm.org/D107719 Added: Modified: clang/include/clang/AST/Type.h Removed: diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index 4238667b8b076..fc83c895afa2e 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -3455,10 +3455,6 @@ class ConstantMatrixType final : public MatrixType { protected: friend class ASTContext; - /// The element type of the matrix. - // FIXME: Appears to be unused? There is also MatrixType::ElementType... - QualType ElementType; - /// Number of rows and columns. unsigned NumRows; unsigned NumColumns; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] b0bf0b2 - [Clang][AST][NFC] Resolve FIXME: Make CXXRecordDecl *Record const.
Author: Alfsonso Gregory Date: 2021-08-19T16:36:32+01:00 New Revision: b0bf0b2e79e848ae502d7efc00a0bac37a96aedb URL: https://github.com/llvm/llvm-project/commit/b0bf0b2e79e848ae502d7efc00a0bac37a96aedb DIFF: https://github.com/llvm/llvm-project/commit/b0bf0b2e79e848ae502d7efc00a0bac37a96aedb.diff LOG: [Clang][AST][NFC] Resolve FIXME: Make CXXRecordDecl *Record const. Differential Revision: https://reviews.llvm.org/D107477 Added: Modified: clang/include/clang/AST/ComparisonCategories.h Removed: diff --git a/clang/include/clang/AST/ComparisonCategories.h b/clang/include/clang/AST/ComparisonCategories.h index b41e934142ee4..fb648b322b61c 100644 --- a/clang/include/clang/AST/ComparisonCategories.h +++ b/clang/include/clang/AST/ComparisonCategories.h @@ -115,8 +115,7 @@ class ComparisonCategoryInfo { public: /// The declaration for the comparison category type from the /// standard library. - // FIXME: Make this const - CXXRecordDecl *Record = nullptr; + const CXXRecordDecl *Record = nullptr; /// The Kind of the comparison category type ComparisonCategoryType Kind; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] f22e586 - [Sema] CheckObjCBridgeNSCast - fix dead code warning. NFCI.
Author: Simon Pilgrim Date: 2021-08-18T11:53:27+01:00 New Revision: f22e5869a012af09e130d804bba441eff261b1fe URL: https://github.com/llvm/llvm-project/commit/f22e5869a012af09e130d804bba441eff261b1fe DIFF: https://github.com/llvm/llvm-project/commit/f22e5869a012af09e130d804bba441eff261b1fe.diff LOG: [Sema] CheckObjCBridgeNSCast - fix dead code warning. NFCI. Target is only ever non-null when we find an existing type, so move its declaration inside that case, and remove the dead code where Target was always null. Added: Modified: clang/lib/Sema/SemaExprObjC.cpp Removed: diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index 8a9c933fc93f..9e46801ea508 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -4015,12 +4015,11 @@ static bool CheckObjCBridgeNSCast(Sema , QualType castType, Expr *castExpr, if (Parm->isStr("id")) return true; -NamedDecl *Target = nullptr; // Check for an existing type with this name. LookupResult R(S, DeclarationName(Parm), SourceLocation(), Sema::LookupOrdinaryName); if (S.LookupName(R, S.TUScope)) { - Target = R.getFoundDecl(); + NamedDecl *Target = R.getFoundDecl(); if (Target && isa(Target)) { ObjCInterfaceDecl *ExprClass = cast(Target); if (const ObjCObjectPointerType *InterfacePointerType = @@ -4056,8 +4055,6 @@ static bool CheckObjCBridgeNSCast(Sema , QualType castType, Expr *castExpr, diag::err_objc_cf_bridged_not_interface) << castExpr->getType() << Parm; S.Diag(TDNDecl->getBeginLoc(), diag::note_declared_at); - if (Target) -S.Diag(Target->getBeginLoc(), diag::note_declared_at); } return true; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] caa282a - Fix unknown parameter Wdocumentation warning. NFC.
Author: Simon Pilgrim Date: 2021-08-19T15:40:09+01:00 New Revision: caa282a4490332034809bd0baf3e7a2ed1b080ae URL: https://github.com/llvm/llvm-project/commit/caa282a4490332034809bd0baf3e7a2ed1b080ae DIFF: https://github.com/llvm/llvm-project/commit/caa282a4490332034809bd0baf3e7a2ed1b080ae.diff LOG: Fix unknown parameter Wdocumentation warning. NFC. Added: Modified: clang/lib/Sema/SemaStmt.cpp Removed: diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index f4f7e353a2c1..dc93e9e1c51c 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -3316,7 +3316,7 @@ Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) { /// being thrown, or being co_returned from a coroutine. This expression /// might be modified by the implementation. /// -/// \param ForceCXX2b Overrides detection of current language mode +/// \param Mode Overrides detection of current language mode /// and uses the rules for C++2b. /// /// \returns An aggregate which contains the Candidate and isMoveEligible ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fd37ead - Fix unknown parameter Wdocumentation warning. NFC.
Author: Simon Pilgrim Date: 2021-08-19T15:40:10+01:00 New Revision: fd37ead38659dec3e63b1b560d43e81249f3e3ce URL: https://github.com/llvm/llvm-project/commit/fd37ead38659dec3e63b1b560d43e81249f3e3ce DIFF: https://github.com/llvm/llvm-project/commit/fd37ead38659dec3e63b1b560d43e81249f3e3ce.diff LOG: Fix unknown parameter Wdocumentation warning. NFC. Added: Modified: clang/lib/Frontend/PrintPreprocessedOutput.cpp Removed: diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp index 1a820ad985a4..5c5fc751179d 100644 --- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp @@ -182,7 +182,7 @@ class PrintPPOutputPPCallbacks : public PPCallbacks { /// implicitly when at the beginning of the file. /// /// @param Tok Token where to move to. - /// @param RequiresStartOfLine Whether the next line depends on being in the + /// @param RequireStartOfLine Whether the next line depends on being in the ///first column, such as a directive. /// /// @return Whether column adjustments are necessary. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] ae69164 - Fix unknown parameter Wdocumentation warning. NFC.
Author: Simon Pilgrim Date: 2021-08-19T15:40:10+01:00 New Revision: ae691648b47091313a5c2f964800d53e60b635ea URL: https://github.com/llvm/llvm-project/commit/ae691648b47091313a5c2f964800d53e60b635ea DIFF: https://github.com/llvm/llvm-project/commit/ae691648b47091313a5c2f964800d53e60b635ea.diff LOG: Fix unknown parameter Wdocumentation warning. NFC. Added: Modified: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp Removed: diff --git a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp index 2c54bffabc43..ecd9b649c4f4 100644 --- a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -1175,7 +1175,7 @@ class StoreSiteFinder final : public TrackingBugReporterVisitor { public: /// \param V We're searching for the store where \c R received this value. /// \param R The region we're tracking. - /// \param TKind May limit the amount of notes added to the bug report. + /// \param Options Tracking behavior options. /// \param OriginSFC Only adds notes when the last store happened in a /// diff erent stackframe to this one. Disregarded if the tracking kind ///is thorough. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 55d9396 - [X86] Move _mm256_set_m128* intrinsics before _mm256_loadu2_m128* intrinsics. NFC.
Author: Simon Pilgrim Date: 2021-09-09T11:23:50+01:00 New Revision: 55d939627823a196f78f0e6279fa0ca14d0ae0f8 URL: https://github.com/llvm/llvm-project/commit/55d939627823a196f78f0e6279fa0ca14d0ae0f8 DIFF: https://github.com/llvm/llvm-project/commit/55d939627823a196f78f0e6279fa0ca14d0ae0f8.diff LOG: [X86] Move _mm256_set_m128* intrinsics before _mm256_loadu2_m128* intrinsics. NFC. This is necessary for PR51796 where we'll update _mm256_loadu2_m128* to use _mm256_set_m128* Added: Modified: clang/lib/Headers/avxintrin.h Removed: diff --git a/clang/lib/Headers/avxintrin.h b/clang/lib/Headers/avxintrin.h index 7f4e9761f1e2c..8709d753dced1 100644 --- a/clang/lib/Headers/avxintrin.h +++ b/clang/lib/Headers/avxintrin.h @@ -4748,6 +4748,135 @@ _mm256_zextsi128_si256(__m128i __a) #define _mm256_extractf128_si256(V, M) \ ((__m128i)__builtin_ia32_vextractf128_si256((__v8si)(__m256i)(V), (int)(M))) +/// Constructs a 256-bit floating-point vector of [8 x float] by +///concatenating two 128-bit floating-point vectors of [4 x float]. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the VINSERTF128 instruction. +/// +/// \param __hi +///A 128-bit floating-point vector of [4 x float] to be copied to the upper +///128 bits of the result. +/// \param __lo +///A 128-bit floating-point vector of [4 x float] to be copied to the lower +///128 bits of the result. +/// \returns A 256-bit floating-point vector of [8 x float] containing the +///concatenated result. +static __inline __m256 __DEFAULT_FN_ATTRS +_mm256_set_m128 (__m128 __hi, __m128 __lo) +{ + return (__m256) __builtin_shufflevector((__v4sf)__lo, (__v4sf)__hi, 0, 1, 2, 3, 4, 5, 6, 7); +} + +/// Constructs a 256-bit floating-point vector of [4 x double] by +///concatenating two 128-bit floating-point vectors of [2 x double]. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the VINSERTF128 instruction. +/// +/// \param __hi +///A 128-bit floating-point vector of [2 x double] to be copied to the upper +///128 bits of the result. +/// \param __lo +///A 128-bit floating-point vector of [2 x double] to be copied to the lower +///128 bits of the result. +/// \returns A 256-bit floating-point vector of [4 x double] containing the +///concatenated result. +static __inline __m256d __DEFAULT_FN_ATTRS +_mm256_set_m128d (__m128d __hi, __m128d __lo) +{ + return (__m256d) __builtin_shufflevector((__v2df)__lo, (__v2df)__hi, 0, 1, 2, 3); +} + +/// Constructs a 256-bit integer vector by concatenating two 128-bit +///integer vectors. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the VINSERTF128 instruction. +/// +/// \param __hi +///A 128-bit integer vector to be copied to the upper 128 bits of the +///result. +/// \param __lo +///A 128-bit integer vector to be copied to the lower 128 bits of the +///result. +/// \returns A 256-bit integer vector containing the concatenated result. +static __inline __m256i __DEFAULT_FN_ATTRS +_mm256_set_m128i (__m128i __hi, __m128i __lo) +{ + return (__m256i) __builtin_shufflevector((__v2di)__lo, (__v2di)__hi, 0, 1, 2, 3); +} + +/// Constructs a 256-bit floating-point vector of [8 x float] by +///concatenating two 128-bit floating-point vectors of [4 x float]. This is +///similar to _mm256_set_m128, but the order of the input parameters is +///swapped. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the VINSERTF128 instruction. +/// +/// \param __lo +///A 128-bit floating-point vector of [4 x float] to be copied to the lower +///128 bits of the result. +/// \param __hi +///A 128-bit floating-point vector of [4 x float] to be copied to the upper +///128 bits of the result. +/// \returns A 256-bit floating-point vector of [8 x float] containing the +///concatenated result. +static __inline __m256 __DEFAULT_FN_ATTRS +_mm256_setr_m128 (__m128 __lo, __m128 __hi) +{ + return _mm256_set_m128(__hi, __lo); +} + +/// Constructs a 256-bit floating-point vector of [4 x double] by +///concatenating two 128-bit floating-point vectors of [2 x double]. This is +///similar to _mm256_set_m128d, but the order of the input parameters is +///swapped. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the VINSERTF128 instruction. +/// +/// \param __lo +///A 128-bit floating-point vector of [2 x double] to be copied to the lower +///128 bits of the result. +/// \param __hi +///A 128-bit floating-point vector of [2 x double] to be copied to the upper +///128 bits of the result. +/// \returns A 256-bit floating-point vector of [4 x double] containing the +///concatenated result. +static __inline __m256d __DEFAULT_FN_ATTRS +_mm256_setr_m128d (__m128d __lo, __m128d __hi) +{ + return (__m256d)_mm256_set_m128d(__hi, __lo); +} + +/// Constructs a
[clang] ea685e1 - [X86][AVX] Update _mm256_loadu2_m128* intrinsics to use _mm256_set_m128* (PR51796)
Author: Simon Pilgrim Date: 2021-09-09T19:15:48+01:00 New Revision: ea685e1028c6fe9e2b0f9eb5858bcb867f75bdc8 URL: https://github.com/llvm/llvm-project/commit/ea685e1028c6fe9e2b0f9eb5858bcb867f75bdc8 DIFF: https://github.com/llvm/llvm-project/commit/ea685e1028c6fe9e2b0f9eb5858bcb867f75bdc8.diff LOG: [X86][AVX] Update _mm256_loadu2_m128* intrinsics to use _mm256_set_m128* (PR51796) As reported on PR51796, the _mm256_loadu2_m128i in particular was inserting bitcasts and shuffles with different types making it trickier for some combines, and prevented the value tracker from identifying the shuffle sequences as a single insert_subvector style concat_vectors pattern. This patch instead concatenate the 128-bit unaligned loads with _mm256_set_m128*, which was written to avoid the unnecessary bitcasts and only emits a single shuffle. Differential Revision: https://reviews.llvm.org/D109497 Added: Modified: clang/lib/Headers/avxintrin.h clang/test/CodeGen/X86/avx-builtins.c Removed: diff --git a/clang/lib/Headers/avxintrin.h b/clang/lib/Headers/avxintrin.h index 8709d753dced..17fe63691177 100644 --- a/clang/lib/Headers/avxintrin.h +++ b/clang/lib/Headers/avxintrin.h @@ -4902,8 +4902,7 @@ _mm256_setr_m128i (__m128i __lo, __m128i __hi) static __inline __m256 __DEFAULT_FN_ATTRS _mm256_loadu2_m128(float const *__addr_hi, float const *__addr_lo) { - __m256 __v256 = _mm256_castps128_ps256(_mm_loadu_ps(__addr_lo)); - return _mm256_insertf128_ps(__v256, _mm_loadu_ps(__addr_hi), 1); + return _mm256_set_m128(_mm_loadu_ps(__addr_hi), _mm_loadu_ps(__addr_lo)); } /// Loads two 128-bit floating-point vectors of [2 x double] from @@ -4930,8 +4929,7 @@ _mm256_loadu2_m128(float const *__addr_hi, float const *__addr_lo) static __inline __m256d __DEFAULT_FN_ATTRS _mm256_loadu2_m128d(double const *__addr_hi, double const *__addr_lo) { - __m256d __v256 = _mm256_castpd128_pd256(_mm_loadu_pd(__addr_lo)); - return _mm256_insertf128_pd(__v256, _mm_loadu_pd(__addr_hi), 1); + return _mm256_set_m128d(_mm_loadu_pd(__addr_hi), _mm_loadu_pd(__addr_lo)); } /// Loads two 128-bit integer vectors from unaligned memory locations and @@ -4955,8 +4953,7 @@ _mm256_loadu2_m128d(double const *__addr_hi, double const *__addr_lo) static __inline __m256i __DEFAULT_FN_ATTRS _mm256_loadu2_m128i(__m128i_u const *__addr_hi, __m128i_u const *__addr_lo) { - __m256i __v256 = _mm256_castsi128_si256(_mm_loadu_si128(__addr_lo)); - return _mm256_insertf128_si256(__v256, _mm_loadu_si128(__addr_hi), 1); + return _mm256_set_m128i(_mm_loadu_si128(__addr_hi), _mm_loadu_si128(__addr_lo)); } /* SIMD store ops (unaligned) */ diff --git a/clang/test/CodeGen/X86/avx-builtins.c b/clang/test/CodeGen/X86/avx-builtins.c index 4118d6c00b37..261beb3b0d25 100644 --- a/clang/test/CodeGen/X86/avx-builtins.c +++ b/clang/test/CodeGen/X86/avx-builtins.c @@ -1233,30 +1233,24 @@ __m256i test_mm256_loadu_si256(__m256i* A) { __m256 test_mm256_loadu2_m128(float* A, float* B) { // CHECK-LABEL: test_mm256_loadu2_m128 // CHECK: load <4 x float>, <4 x float>* %{{.*}}, align 1{{$}} - // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <8 x i32> // CHECK: load <4 x float>, <4 x float>* %{{.*}}, align 1{{$}} - // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> poison, <8 x i32> - // CHECK: shufflevector <8 x float> %{{.*}}, <8 x float> %{{.*}}, <8 x i32> + // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <8 x i32> return _mm256_loadu2_m128(A, B); } __m256d test_mm256_loadu2_m128d(double* A, double* B) { // CHECK-LABEL: test_mm256_loadu2_m128d // CHECK: load <2 x double>, <2 x double>* %{{.*}}, align 1{{$}} - // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <4 x i32> // CHECK: load <2 x double>, <2 x double>* %{{.*}}, align 1{{$}} - // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> poison, <4 x i32> - // CHECK: shufflevector <4 x double> %{{.*}}, <4 x double> %{{.*}}, <4 x i32> + // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <4 x i32> return _mm256_loadu2_m128d(A, B); } __m256i test_mm256_loadu2_m128i(__m128i* A, __m128i* B) { // CHECK-LABEL: test_mm256_loadu2_m128i // CHECK: load <2 x i64>, <2 x i64>* %{{.*}}, align 1{{$}} - // CHECK: shufflevector <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <4 x i32> // CHECK: load <2 x i64>, <2 x i64>* %{{.*}}, align 1{{$}} - // CHECK: shufflevector <4 x i32> %{{.*}}, <4 x i32> poison, <8 x i32> - // CHECK: shufflevector <8 x i32> %{{.*}}, <8 x i32> %{{.*}}, <8 x i32> + // CHECK: shufflevector <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <4 x i32> return _mm256_loadu2_m128i(A, B); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 7562f3d - InvalidPtrChecker - don't dereference a dyn_cast<> - use cast<> instead.
Author: Simon Pilgrim Date: 2021-10-20T18:06:00+01:00 New Revision: 7562f3df89066ab92a816dc23005c45fd642bdf9 URL: https://github.com/llvm/llvm-project/commit/7562f3df89066ab92a816dc23005c45fd642bdf9 DIFF: https://github.com/llvm/llvm-project/commit/7562f3df89066ab92a816dc23005c45fd642bdf9.diff LOG: InvalidPtrChecker - don't dereference a dyn_cast<> - use cast<> instead. Avoid dereferencing a nullptr returned by dyn_cast<>, by using cast<> instead which asserts that the cast is valid. Added: Modified: clang/lib/StaticAnalyzer/Checkers/cert/InvalidPtrChecker.cpp Removed: diff --git a/clang/lib/StaticAnalyzer/Checkers/cert/InvalidPtrChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/cert/InvalidPtrChecker.cpp index 18893c2fda15b..378d7ce8150af 100644 --- a/clang/lib/StaticAnalyzer/Checkers/cert/InvalidPtrChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/cert/InvalidPtrChecker.cpp @@ -146,7 +146,7 @@ void InvalidPtrChecker::postPreviousReturnInvalidatingCall( State = State->BindExpr(CE, LCtx, RetVal); // Remember to this region. - const auto *SymRegOfRetVal = dyn_cast(RetVal.getAsRegion()); + const auto *SymRegOfRetVal = cast(RetVal.getAsRegion()); const MemRegion *MR = const_cast(SymRegOfRetVal->getBaseRegion()); State = State->set(FD, MR); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] b577126 - [clang][sema] instantiateOMPDeclareVariantAttr - merge repeated VariantFuncRef.get() calls. NFCI.
Author: Simon Pilgrim Date: 2021-10-14T12:51:34+01:00 New Revision: b577126d626855fabc11a203e7a7e0187d48c227 URL: https://github.com/llvm/llvm-project/commit/b577126d626855fabc11a203e7a7e0187d48c227 DIFF: https://github.com/llvm/llvm-project/commit/b577126d626855fabc11a203e7a7e0187d48c227.diff LOG: [clang][sema] instantiateOMPDeclareVariantAttr - merge repeated VariantFuncRef.get() calls. NFCI. Fixes scan-build warning about dead initialization Added: Modified: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp Removed: diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index 70c42a19978c..5ddac3c98c25 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -436,11 +436,11 @@ static void instantiateOMPDeclareVariantAttr( return; Expr *E = VariantFuncRef.get(); + // Check function/variant ref for `omp declare variant` but not for `omp // begin declare variant` (which use implicit attributes). Optional> DeclVarData = - S.checkOpenMPDeclareVariantFunction(S.ConvertDeclToDeclGroup(New), - VariantFuncRef.get(), TI, + S.checkOpenMPDeclareVariantFunction(S.ConvertDeclToDeclGroup(New), E, TI, Attr.getRange()); if (!DeclVarData) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 3b3509b - [Sema] haveSameParameterTypes - replace repeated isNull() test with assertions
Author: Simon Pilgrim Date: 2021-10-18T12:36:44+01:00 New Revision: 3b3509b3cba272c98d2235a8664ae9625ac729f8 URL: https://github.com/llvm/llvm-project/commit/3b3509b3cba272c98d2235a8664ae9625ac729f8 DIFF: https://github.com/llvm/llvm-project/commit/3b3509b3cba272c98d2235a8664ae9625ac729f8.diff LOG: [Sema] haveSameParameterTypes - replace repeated isNull() test with assertions As reported on https://pvs-studio.com/en/blog/posts/cpp/0771/ (Snippet 2) - (and mentioned on rGdc4259d5a38409) we are repeating the T1.isNull() check instead of checking T2.isNull() as well, and at this point neither should be null - so we're better off with an assertion. Differential Revision: https://reviews.llvm.org/D107347 Added: Modified: clang/lib/Sema/SemaOverload.cpp Removed: diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index d93fd9df0093e..a2af2ac6f7ee8 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -9586,7 +9586,8 @@ static bool haveSameParameterTypes(ASTContext , const FunctionDecl *F1, for (unsigned I = 0; I != NumParams; ++I) { QualType T1 = NextParam(F1, I1, I == 0); QualType T2 = NextParam(F2, I2, I == 0); -if (!T1.isNull() && !T1.isNull() && !Context.hasSameUnqualifiedType(T1, T2)) +assert(!T1.isNull() && !T2.isNull() && "Unexpected null param types"); +if (!Context.hasSameUnqualifiedType(T1, T2)) return false; } return true; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] 7674bd4 - [clang-tidy] Merges separate isa<>/assert/unreachable/dyn_cast<>/cast<> calls
Author: Simon Pilgrim Date: 2021-09-29T16:35:29+01:00 New Revision: 7674bd4d44921d2d110cfb56f2674d4e6e8a68e3 URL: https://github.com/llvm/llvm-project/commit/7674bd4d44921d2d110cfb56f2674d4e6e8a68e3 DIFF: https://github.com/llvm/llvm-project/commit/7674bd4d44921d2d110cfb56f2674d4e6e8a68e3.diff LOG: [clang-tidy] Merges separate isa<>/assert/unreachable/dyn_cast<>/cast<> calls We can directly use cast<> instead of separate dyn_cast<> with assertions as cast<> will perform this for us. Similarly we can replace a if(isa<>)+cast<>/dyn_cast<> with if(dyn_cast<>) Added: Modified: clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp Removed: diff --git a/clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp b/clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp index 40ba3913467f2..0290789e76bfe 100644 --- a/clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp +++ b/clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp @@ -120,9 +120,7 @@ bool UnrollLoopsCheck::hasKnownBounds(const Stmt *Statement, if (isa(Statement)) return false; // The last loop type is a for loop. - const auto *ForLoop = dyn_cast(Statement); - if (!ForLoop) -llvm_unreachable("Unknown loop"); + const auto *ForLoop = cast(Statement); const Stmt *Initializer = ForLoop->getInit(); const Expr *Conditional = ForLoop->getCond(); const Expr *Increment = ForLoop->getInc(); @@ -142,8 +140,7 @@ bool UnrollLoopsCheck::hasKnownBounds(const Stmt *Statement, if (!Op->isIncrementDecrementOp()) return false; - if (isa(Conditional)) { -const auto *BinaryOp = dyn_cast(Conditional); + if (const auto *BinaryOp = dyn_cast(Conditional)) { const Expr *LHS = BinaryOp->getLHS(); const Expr *RHS = BinaryOp->getRHS(); // If both sides are value dependent or constant, loop bounds are unknown. @@ -173,8 +170,7 @@ bool UnrollLoopsCheck::hasLargeNumIterations(const Stmt *Statement, assert(CXXLoopBound && "CXX ranged for loop has no loop bound"); return exprHasLargeNumIterations(CXXLoopBound, Context); } - const auto *ForLoop = dyn_cast(Statement); - assert(ForLoop && "Unknown loop"); + const auto *ForLoop = cast(Statement); const Stmt *Initializer = ForLoop->getInit(); const Expr *Conditional = ForLoop->getCond(); const Expr *Increment = ForLoop->getInc(); @@ -189,10 +185,9 @@ bool UnrollLoopsCheck::hasLargeNumIterations(const Stmt *Statement, InitValue = Evaluation->getInt().getExtValue(); } } - assert(isa(Conditional) && - "Conditional is not a binary operator"); + int EndValue; - const auto *BinaryOp = dyn_cast(Conditional); + const auto *BinaryOp = cast(Conditional); if (!extractValue(EndValue, BinaryOp, Context)) return true; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] b9b90bb - [clang] Replace report_fatal_error(std::string) uses with report_fatal_error(Twine)
Author: Simon Pilgrim Date: 2021-10-06T11:43:19+01:00 New Revision: b9b90bb5426ffc23cf90f133a90d1469d263522c URL: https://github.com/llvm/llvm-project/commit/b9b90bb5426ffc23cf90f133a90d1469d263522c DIFF: https://github.com/llvm/llvm-project/commit/b9b90bb5426ffc23cf90f133a90d1469d263522c.diff LOG: [clang] Replace report_fatal_error(std::string) uses with report_fatal_error(Twine) As described on D111049, we're trying to remove the dependency from error handling and replace uses of report_fatal_error(const std::string&) with the Twine() variant which can be forward declared. Added: Modified: clang-tools-extra/unittests/clang-tidy/ClangTidyTest.h clang/include/clang/Serialization/ASTRecordReader.h clang/lib/Basic/ProfileList.cpp clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp clang/lib/Serialization/ASTReaderDecl.cpp clang/lib/Tooling/CommonOptionsParser.cpp Removed: diff --git a/clang-tools-extra/unittests/clang-tidy/ClangTidyTest.h b/clang-tools-extra/unittests/clang-tidy/ClangTidyTest.h index b8ee9972f6f86..c0459cc80ca4c 100644 --- a/clang-tools-extra/unittests/clang-tidy/ClangTidyTest.h +++ b/clang-tools-extra/unittests/clang-tidy/ClangTidyTest.h @@ -141,7 +141,7 @@ runCheckOnCode(StringRef Code, std::vector *Errors = nullptr, for (const auto : DiagConsumer.take()) { ErrorText += Error.Message.Message + "\n"; } -llvm::report_fatal_error(ErrorText); +llvm::report_fatal_error(llvm::Twine(ErrorText)); } tooling::Replacements Fixes; diff --git a/clang/include/clang/Serialization/ASTRecordReader.h b/clang/include/clang/Serialization/ASTRecordReader.h index b85609bf4e05b..36179ec23408f 100644 --- a/clang/include/clang/Serialization/ASTRecordReader.h +++ b/clang/include/clang/Serialization/ASTRecordReader.h @@ -350,7 +350,7 @@ struct SavedStreamPosition { ~SavedStreamPosition() { if (llvm::Error Err = Cursor.JumpToBit(Offset)) llvm::report_fatal_error( - "Cursor should always be able to go back, failed: " + + llvm::Twine("Cursor should always be able to go back, failed: ") + toString(std::move(Err))); } diff --git a/clang/lib/Basic/ProfileList.cpp b/clang/lib/Basic/ProfileList.cpp index 2cb05c1c3c073..9c88559d1c333 100644 --- a/clang/lib/Basic/ProfileList.cpp +++ b/clang/lib/Basic/ProfileList.cpp @@ -58,7 +58,7 @@ ProfileSpecialCaseList::createOrDie(const std::vector , std::string Error; if (auto PSCL = create(Paths, VFS, Error)) return PSCL; - llvm::report_fatal_error(Error); + llvm::report_fatal_error(llvm::Twine(Error)); } } diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp index 1adf0ad9c0e5b..acfda02826672 100644 --- a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp +++ b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp @@ -264,7 +264,7 @@ class PCHContainerGenerator : public ASTConsumer { std::string Error; auto Triple = Ctx.getTargetInfo().getTriple(); if (!llvm::TargetRegistry::lookupTarget(Triple.getTriple(), Error)) - llvm::report_fatal_error(Error); + llvm::report_fatal_error(llvm::Twine(Error)); // Emit the serialized Clang AST into its own section. assert(Buffer->IsComplete && "serialization did not complete"); diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index 97db833d41ca6..d011d14612d13 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -3851,7 +3851,7 @@ Decl *ASTReader::ReadDeclRecord(DeclID ID) { Expected MaybeDeclCode = Record.readRecord(DeclsCursor, Code); if (!MaybeDeclCode) llvm::report_fatal_error( -"ASTReader::readDeclRecord failed reading decl code: " + +Twine("ASTReader::readDeclRecord failed reading decl code: ") + toString(MaybeDeclCode.takeError())); switch ((DeclCode)MaybeDeclCode.get()) { case DECL_CONTEXT_LEXICAL: @@ -4236,12 +4236,12 @@ void ASTReader::loadDeclUpdateRecords(PendingUpdateRecord ) { if (llvm::Error JumpFailed = Cursor.JumpToBit(Offset)) // FIXME don't do a fatal error. llvm::report_fatal_error( -"ASTReader::loadDeclUpdateRecords failed jumping: " + +Twine("ASTReader::loadDeclUpdateRecords failed jumping: ") + toString(std::move(JumpFailed))); Expected MaybeCode = Cursor.ReadCode(); if (!MaybeCode) llvm::report_fatal_error( -"ASTReader::loadDeclUpdateRecords failed reading code: " + +Twine("ASTReader::loadDeclUpdateRecords failed reading code: ") + toString(MaybeCode.takeError())); unsigned Code = MaybeCode.get(); ASTRecordReader Record(*this, *F); @@ -4250,7 +4250,7 @@ void
[clang] e463b69 - [Support] Change fatal_error_handler_t to take a const char* instead of std::string
Author: Simon Pilgrim Date: 2021-10-05T10:55:40+01:00 New Revision: e463b69736da8b0a950ecd937cf990401bdfcdeb URL: https://github.com/llvm/llvm-project/commit/e463b69736da8b0a950ecd937cf990401bdfcdeb DIFF: https://github.com/llvm/llvm-project/commit/e463b69736da8b0a950ecd937cf990401bdfcdeb.diff LOG: [Support] Change fatal_error_handler_t to take a const char* instead of std::string https://commondatastorage.googleapis.com/chromium-browser-clang/llvm-include-analysis.html Excessive use of the header has a massive impact on compile time; its most commonly included via the ErrorHandling.h header, which has to be included in many key headers, impacting many source files that have no need for std::string. As an initial step toward removing the include from ErrorHandling.h, this patch proposes to update the fatal_error_handler_t handler to just take a raw const char* instead. The next step will be to remove the report_fatal_error std::string variant, which will involve a lot of cleanup and better use of Twine/StringRef. Differential Revision: https://reviews.llvm.org/D111049 Added: Modified: clang/tools/clang-repl/ClangRepl.cpp clang/tools/driver/cc1_main.cpp clang/tools/driver/cc1as_main.cpp clang/tools/libclang/FatalErrorHandler.cpp llvm/include/llvm/Support/ErrorHandling.h llvm/lib/Support/ErrorHandling.cpp llvm/tools/llvm-as-fuzzer/llvm-as-fuzzer.cpp llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp llvm/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp Removed: diff --git a/clang/tools/clang-repl/ClangRepl.cpp b/clang/tools/clang-repl/ClangRepl.cpp index ba6bb11abc867..8e50418f705c2 100644 --- a/clang/tools/clang-repl/ClangRepl.cpp +++ b/clang/tools/clang-repl/ClangRepl.cpp @@ -32,7 +32,7 @@ static llvm::cl::list OptInputs(llvm::cl::Positional, llvm::cl::ZeroOrMore, llvm::cl::desc("[code to run]")); -static void LLVMErrorHandler(void *UserData, const std::string , +static void LLVMErrorHandler(void *UserData, const char *Message, bool GenCrashDiag) { auto = *static_cast(UserData); diff --git a/clang/tools/driver/cc1_main.cpp b/clang/tools/driver/cc1_main.cpp index 396d6ff529f31..13fb80fbad300 100644 --- a/clang/tools/driver/cc1_main.cpp +++ b/clang/tools/driver/cc1_main.cpp @@ -57,7 +57,7 @@ using namespace llvm::opt; // Main driver //===--===// -static void LLVMErrorHandler(void *UserData, const std::string , +static void LLVMErrorHandler(void *UserData, const char *Message, bool GenCrashDiag) { DiagnosticsEngine = *static_cast(UserData); diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp index 6549b132f6166..6816fd20e43ec 100644 --- a/clang/tools/driver/cc1as_main.cpp +++ b/clang/tools/driver/cc1as_main.cpp @@ -550,7 +550,7 @@ static bool ExecuteAssembler(AssemblerInvocation , return Failed; } -static void LLVMErrorHandler(void *UserData, const std::string , +static void LLVMErrorHandler(void *UserData, const char *Message, bool GenCrashDiag) { DiagnosticsEngine = *static_cast(UserData); diff --git a/clang/tools/libclang/FatalErrorHandler.cpp b/clang/tools/libclang/FatalErrorHandler.cpp index ef21569637f03..73864754c0655 100644 --- a/clang/tools/libclang/FatalErrorHandler.cpp +++ b/clang/tools/libclang/FatalErrorHandler.cpp @@ -11,11 +11,11 @@ #include "llvm/Support/ErrorHandling.h" #include -static void aborting_fatal_error_handler(void *, const std::string , +static void aborting_fatal_error_handler(void *, const char *reason, bool) { // Write the result out to stderr avoiding errs() because raw_ostreams can // call report_fatal_error. - fprintf(stderr, "LIBCLANG FATAL ERROR: %s\n", reason.c_str()); + fprintf(stderr, "LIBCLANG FATAL ERROR: %s\n", reason); ::abort(); } diff --git a/llvm/include/llvm/Support/ErrorHandling.h b/llvm/include/llvm/Support/ErrorHandling.h index 81cac477cb69b..260c76fadc95a 100644 --- a/llvm/include/llvm/Support/ErrorHandling.h +++ b/llvm/include/llvm/Support/ErrorHandling.h @@ -18,12 +18,12 @@ #include namespace llvm { -class StringRef; + class StringRef; class Twine; /// An error handler callback. typedef void (*fatal_error_handler_t)(void *user_data, -const std::string& reason, +const char *reason, bool gen_crash_diag); /// install_fatal_error_handler - Installs a new error handler to be used diff --git a/llvm/lib/Support/ErrorHandling.cpp b/llvm/lib/Support/ErrorHandling.cpp index
[clang] 9503ad3 - [clang] FatalErrorHandler.cpp - add explicit include
Author: Simon Pilgrim Date: 2021-10-05T17:03:17+01:00 New Revision: 9503ad3b533cb84b51cfc80c51d262da50435013 URL: https://github.com/llvm/llvm-project/commit/9503ad3b533cb84b51cfc80c51d262da50435013 DIFF: https://github.com/llvm/llvm-project/commit/9503ad3b533cb84b51cfc80c51d262da50435013.diff LOG: [clang] FatalErrorHandler.cpp - add explicit include Required for fprintf/stderr usage in the error handler, noticed while trying to remove the dependency described in D111049 Added: Modified: clang/tools/libclang/FatalErrorHandler.cpp Removed: diff --git a/clang/tools/libclang/FatalErrorHandler.cpp b/clang/tools/libclang/FatalErrorHandler.cpp index 73864754c065..506b047c1b13 100644 --- a/clang/tools/libclang/FatalErrorHandler.cpp +++ b/clang/tools/libclang/FatalErrorHandler.cpp @@ -9,6 +9,7 @@ #include "clang-c/FatalErrorHandler.h" #include "llvm/Support/ErrorHandling.h" +#include #include static void aborting_fatal_error_handler(void *, const char *reason, ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] 45617e1 - [clang-doc] Pass Record argument by const-ref. NFCI.
Author: Simon Pilgrim Date: 2021-09-24T10:06:13+01:00 New Revision: 45617e1dd8a1b9791f3bd15aee2614383e25b298 URL: https://github.com/llvm/llvm-project/commit/45617e1dd8a1b9791f3bd15aee2614383e25b298 DIFF: https://github.com/llvm/llvm-project/commit/45617e1dd8a1b9791f3bd15aee2614383e25b298.diff LOG: [clang-doc] Pass Record argument by const-ref. NFCI. Record is a SmallVector - we really need to avoid passing this by value. Avoid unnecessary big copies, reported by coverity. Added: Modified: clang-tools-extra/clang-doc/BitcodeReader.cpp Removed: diff --git a/clang-tools-extra/clang-doc/BitcodeReader.cpp b/clang-tools-extra/clang-doc/BitcodeReader.cpp index 8d551d376f08a..9e0ec99291732 100644 --- a/clang-tools-extra/clang-doc/BitcodeReader.cpp +++ b/clang-tools-extra/clang-doc/BitcodeReader.cpp @@ -17,13 +17,14 @@ namespace doc { using Record = llvm::SmallVector; -llvm::Error decodeRecord(Record R, llvm::SmallVectorImpl , +llvm::Error decodeRecord(const Record , llvm::SmallVectorImpl , llvm::StringRef Blob) { Field.assign(Blob.begin(), Blob.end()); return llvm::Error::success(); } -llvm::Error decodeRecord(Record R, SymbolID , llvm::StringRef Blob) { +llvm::Error decodeRecord(const Record , SymbolID , + llvm::StringRef Blob) { if (R[0] != BitCodeConstants::USRHashSize) return llvm::createStringError(llvm::inconvertibleErrorCode(), "incorrect USR size"); @@ -35,12 +36,12 @@ llvm::Error decodeRecord(Record R, SymbolID , llvm::StringRef Blob) { return llvm::Error::success(); } -llvm::Error decodeRecord(Record R, bool , llvm::StringRef Blob) { +llvm::Error decodeRecord(const Record , bool , llvm::StringRef Blob) { Field = R[0] != 0; return llvm::Error::success(); } -llvm::Error decodeRecord(Record R, int , llvm::StringRef Blob) { +llvm::Error decodeRecord(const Record , int , llvm::StringRef Blob) { if (R[0] > INT_MAX) return llvm::createStringError(llvm::inconvertibleErrorCode(), "integer too large to parse"); @@ -48,7 +49,7 @@ llvm::Error decodeRecord(Record R, int , llvm::StringRef Blob) { return llvm::Error::success(); } -llvm::Error decodeRecord(Record R, AccessSpecifier , +llvm::Error decodeRecord(const Record , AccessSpecifier , llvm::StringRef Blob) { switch (R[0]) { case AS_public: @@ -63,7 +64,8 @@ llvm::Error decodeRecord(Record R, AccessSpecifier , } } -llvm::Error decodeRecord(Record R, TagTypeKind , llvm::StringRef Blob) { +llvm::Error decodeRecord(const Record , TagTypeKind , + llvm::StringRef Blob) { switch (R[0]) { case TTK_Struct: case TTK_Interface: @@ -78,7 +80,7 @@ llvm::Error decodeRecord(Record R, TagTypeKind , llvm::StringRef Blob) { } } -llvm::Error decodeRecord(Record R, llvm::Optional , +llvm::Error decodeRecord(const Record , llvm::Optional , llvm::StringRef Blob) { if (R[0] > INT_MAX) return llvm::createStringError(llvm::inconvertibleErrorCode(), @@ -87,7 +89,8 @@ llvm::Error decodeRecord(Record R, llvm::Optional , return llvm::Error::success(); } -llvm::Error decodeRecord(Record R, InfoType , llvm::StringRef Blob) { +llvm::Error decodeRecord(const Record , InfoType , + llvm::StringRef Blob) { switch (auto IT = static_cast(R[0])) { case InfoType::IT_namespace: case InfoType::IT_record: @@ -101,7 +104,8 @@ llvm::Error decodeRecord(Record R, InfoType , llvm::StringRef Blob) { "invalid value for InfoType"); } -llvm::Error decodeRecord(Record R, FieldId , llvm::StringRef Blob) { +llvm::Error decodeRecord(const Record , FieldId , + llvm::StringRef Blob) { switch (auto F = static_cast(R[0])) { case FieldId::F_namespace: case FieldId::F_parent: @@ -117,14 +121,15 @@ llvm::Error decodeRecord(Record R, FieldId , llvm::StringRef Blob) { "invalid value for FieldId"); } -llvm::Error decodeRecord(Record R, +llvm::Error decodeRecord(const Record , llvm::SmallVectorImpl> , llvm::StringRef Blob) { Field.push_back(Blob); return llvm::Error::success(); } -llvm::Error decodeRecord(Record R, llvm::SmallVectorImpl , +llvm::Error decodeRecord(const Record , + llvm::SmallVectorImpl , llvm::StringRef Blob) { if (R[0] > INT_MAX) return llvm::createStringError(llvm::inconvertibleErrorCode(), @@ -133,7 +138,7 @@ llvm::Error decodeRecord(Record R, llvm::SmallVectorImpl , return llvm::Error::success(); } -llvm::Error parseRecord(Record R, unsigned ID, llvm::StringRef Blob, +llvm::Error parseRecord(const Record , unsigned ID, llvm::StringRef Blob,
[clang-tools-extra] dcc2014 - [clang-tidy] UseDefaultMemberInitCheck::checkDefaultInit - Use cast<> instead of dyn_cast<> to avoid dereference of nullptr
Author: Simon Pilgrim Date: 2022-01-12T15:35:37Z New Revision: dcc20143e170b912aa0831dbedb5c1de07958012 URL: https://github.com/llvm/llvm-project/commit/dcc20143e170b912aa0831dbedb5c1de07958012 DIFF: https://github.com/llvm/llvm-project/commit/dcc20143e170b912aa0831dbedb5c1de07958012.diff LOG: [clang-tidy] UseDefaultMemberInitCheck::checkDefaultInit - Use cast<> instead of dyn_cast<> to avoid dereference of nullptr The pointer is always dereferenced immediately below, so assert the cast is correct instead of returning nullptr Added: Modified: clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp Removed: diff --git a/clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp index d57a88d668832..6f8c984da2a8f 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp @@ -247,7 +247,7 @@ void UseDefaultMemberInitCheck::checkDefaultInit( // Check whether we have multiple hand-written constructors and bomb out, as // it is hard to reconcile their sets of member initializers. - const auto *ClassDecl = dyn_cast(Field->getParent()); + const auto *ClassDecl = cast(Field->getParent()); if (llvm::count_if(ClassDecl->ctors(), [](const CXXConstructorDecl *Ctor) { return !Ctor->isCopyOrMoveConstructor(); }) > 1) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 497a4b2 - CGBuiltin - Use castAs<> instead of getAs<> to avoid dereference of nullptr
Author: Simon Pilgrim Date: 2022-01-12T15:35:37Z New Revision: 497a4b26c487a9640847c485f9b0c36c110a8545 URL: https://github.com/llvm/llvm-project/commit/497a4b26c487a9640847c485f9b0c36c110a8545 DIFF: https://github.com/llvm/llvm-project/commit/497a4b26c487a9640847c485f9b0c36c110a8545.diff LOG: CGBuiltin - Use castAs<> instead of getAs<> to avoid dereference of nullptr The pointer is always dereferenced immediately below, so assert the cast is correct instead of returning nullptr Added: Modified: clang/lib/CodeGen/CGBuiltin.cpp Removed: diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index e9dd41a7daa1..91284baf123a 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -3223,7 +3223,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, *this, E, llvm::Intrinsic::vector_reduce_xor, "rdx.xor")); case Builtin::BI__builtin_matrix_transpose: { -const auto *MatrixTy = E->getArg(0)->getType()->getAs(); +auto *MatrixTy = E->getArg(0)->getType()->castAs(); Value *MatValue = EmitScalarExpr(E->getArg(0)); MatrixBuilder MB(Builder); Value *Result = MB.CreateMatrixTranspose(MatValue, MatrixTy->getNumRows(), ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] c61299e - [SemaOverload] Use castAs<> instead of getAs<> to avoid dereference of nullptr
Author: Simon Pilgrim Date: 2022-01-11T10:31:25Z New Revision: c61299e2b30627f327f5a9a198ad030092534496 URL: https://github.com/llvm/llvm-project/commit/c61299e2b30627f327f5a9a198ad030092534496 DIFF: https://github.com/llvm/llvm-project/commit/c61299e2b30627f327f5a9a198ad030092534496.diff LOG: [SemaOverload] Use castAs<> instead of getAs<> to avoid dereference of nullptr The pointer is always dereferenced inside BuildSimilarlyQualifiedPointerType, so assert the cast is correct instead of returning nullptr Added: Modified: clang/lib/Sema/SemaOverload.cpp Removed: diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 7b503103006d5..041fcee023a5b 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -2405,9 +2405,8 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType, if (FromType->isObjCObjectPointerType() && ToPointeeType->isVoidType() && !getLangOpts().ObjCAutoRefCount) { ConvertedType = BuildSimilarlyQualifiedPointerType( - FromType->getAs(), - ToPointeeType, - ToType, Context); +FromType->castAs(), ToPointeeType, ToType, +Context); return true; } const PointerType *FromTypePtr = FromType->getAs(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 2e52f76 - [SemaOverload] compareConversionFunctions - use castAs<> instead of getAs<> to avoid dereference of nullptr
Author: Simon Pilgrim Date: 2022-01-11T10:31:26Z New Revision: 2e52f76a722aa3ae5d655e0f15972b4f73db0150 URL: https://github.com/llvm/llvm-project/commit/2e52f76a722aa3ae5d655e0f15972b4f73db0150 DIFF: https://github.com/llvm/llvm-project/commit/2e52f76a722aa3ae5d655e0f15972b4f73db0150.diff LOG: [SemaOverload] compareConversionFunctions - use castAs<> instead of getAs<> to avoid dereference of nullptr The pointer is dereferenced immediately below, so assert the cast is correct instead of returning nullptr Added: Modified: clang/lib/Sema/SemaOverload.cpp Removed: diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 041fcee023a5..483247aaa7c5 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -3717,8 +3717,7 @@ compareConversionFunctions(Sema , FunctionDecl *Function1, CallingConv Conv2CC = Conv2FuncRet->getCallConv(); CXXMethodDecl *CallOp = Conv2->getParent()->getLambdaCallOperator(); -const FunctionProtoType *CallOpProto = -CallOp->getType()->getAs(); +const auto *CallOpProto = CallOp->getType()->castAs(); CallingConv CallOpCC = CallOp->getType()->castAs()->getCallConv(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fba8ad2 - [SemaTemplateInstantiate] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr
Author: Simon Pilgrim Date: 2022-01-11T11:29:38Z New Revision: fba8ad2b719c14e971dfe16458b3d18c08e0e40d URL: https://github.com/llvm/llvm-project/commit/fba8ad2b719c14e971dfe16458b3d18c08e0e40d DIFF: https://github.com/llvm/llvm-project/commit/fba8ad2b719c14e971dfe16458b3d18c08e0e40d.diff LOG: [SemaTemplateInstantiate] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr The pointer is always dereferenced immediately below, so assert the cast is correct instead of returning nullptr Added: Modified: clang/lib/Sema/SemaTemplateInstantiate.cpp Removed: diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 7d4c000e7e90..7c6bb4c8a5f8 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -2790,11 +2790,10 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, CurrentInstantiationScope = I->Scope; // Allow 'this' within late-parsed attributes. -NamedDecl *ND = dyn_cast(I->NewDecl); -CXXRecordDecl *ThisContext = -dyn_cast_or_null(ND->getDeclContext()); +auto *ND = cast(I->NewDecl); +auto *ThisContext = dyn_cast_or_null(ND->getDeclContext()); CXXThisScopeRAII ThisScope(*this, ThisContext, Qualifiers(), - ND && ND->isCXXInstanceMember()); + ND->isCXXInstanceMember()); Attr *NewAttr = instantiateTemplateAttribute(I->TmplAttr, Context, *this, TemplateArgs); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 4e77868 - [SemaDecl] Use castAs<> instead of getAs<> to avoid dereference of nullptr
Author: Simon Pilgrim Date: 2022-01-10T16:31:08Z New Revision: 4e77868c7c4ba79ed025b87f84ce66fc8dca25d6 URL: https://github.com/llvm/llvm-project/commit/4e77868c7c4ba79ed025b87f84ce66fc8dca25d6 DIFF: https://github.com/llvm/llvm-project/commit/4e77868c7c4ba79ed025b87f84ce66fc8dca25d6.diff LOG: [SemaDecl] Use castAs<> instead of getAs<> to avoid dereference of nullptr This will assert the cast is correct instead of returning nullptr Added: Modified: clang/lib/Sema/SemaDecl.cpp Removed: diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index d39d010f5eae4..1e6d4fd04604e 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -9921,7 +9921,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator , DeclContext *DC, << NewFD; // Turn this into a variadic function with no parameters. -const FunctionType *FT = NewFD->getType()->getAs(); +const auto *FT = NewFD->getType()->castAs(); FunctionProtoType::ExtProtoInfo EPI( Context.getDefaultCallingConvention(true, false)); EPI.Variadic = true; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 4b43209 - [clang][sema] Use castAs<> instead of getAs<> to avoid dereference of nullptr
Author: Simon Pilgrim Date: 2022-02-13T13:14:05Z New Revision: 4b432096839e719ec0b78cd0299e7950a59dce0b URL: https://github.com/llvm/llvm-project/commit/4b432096839e719ec0b78cd0299e7950a59dce0b DIFF: https://github.com/llvm/llvm-project/commit/4b432096839e719ec0b78cd0299e7950a59dce0b.diff LOG: [clang][sema] Use castAs<> instead of getAs<> to avoid dereference of nullptr The pointers are referenced immediately, so assert the cast is correct instead of returning nullptr Added: Modified: clang/lib/Sema/SemaExpr.cpp Removed: diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 6629f3e061f80..22b3f371afe79 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -3022,7 +3022,7 @@ Sema::PerformObjectMemberConversion(Expr *From, QualType QType = QualType(Qualifier->getAsType(), 0); assert(QType->isRecordType() && "lookup done with non-record type"); -QualType QRecordType = QualType(QType->getAs(), 0); +QualType QRecordType = QualType(QType->castAs(), 0); // In C++98, the qualifier type doesn't actually have to be a base // type of the object type, in which case we just ignore it. @@ -10035,7 +10035,7 @@ static bool tryGCCVectorConvertAndSplat(Sema , ExprResult *Scalar, ExprResult *Vector) { QualType ScalarTy = Scalar->get()->getType().getUnqualifiedType(); QualType VectorTy = Vector->get()->getType().getUnqualifiedType(); - const VectorType *VT = VectorTy->getAs(); + const auto *VT = VectorTy->castAs(); assert(!isa(VT) && "ExtVectorTypes should not be handled here!"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 4e4f839 - [X86] Use the unaligned vector typedefs for the lddqu intrinsics pointer arguments (PR20670)
Author: Simon Pilgrim Date: 2022-03-17T10:42:29Z New Revision: 4e4f839ac2a9002df504f1bed8383c2d7d72e86e URL: https://github.com/llvm/llvm-project/commit/4e4f839ac2a9002df504f1bed8383c2d7d72e86e DIFF: https://github.com/llvm/llvm-project/commit/4e4f839ac2a9002df504f1bed8383c2d7d72e86e.diff LOG: [X86] Use the unaligned vector typedefs for the lddqu intrinsics pointer arguments (PR20670) Extension to 4390c721cba09597037578100948bbc83cc41b16 - similar to the vanilla load/store intrinsics, _mm_lddqu_si128/_mm256_lddqu_si256 should take an unaligned pointer, but were using the aligned m128i/m256i types which can cause alignment warnings. The existing sse3-builtins.c and avx-builtins.c tests in llvm-project\clang\test\CodeGen\X86 should cover this. Differential Revision: https://reviews.llvm.org/D121815 Added: Modified: clang/lib/Headers/avxintrin.h clang/lib/Headers/pmmintrin.h Removed: diff --git a/clang/lib/Headers/avxintrin.h b/clang/lib/Headers/avxintrin.h index 17fe636911772..df2d1a2690d8e 100644 --- a/clang/lib/Headers/avxintrin.h +++ b/clang/lib/Headers/avxintrin.h @@ -3177,7 +3177,7 @@ _mm256_loadu_si256(__m256i_u const *__p) ///A pointer to a 256-bit integer vector containing integer values. /// \returns A 256-bit integer vector containing the moved values. static __inline __m256i __DEFAULT_FN_ATTRS -_mm256_lddqu_si256(__m256i const *__p) +_mm256_lddqu_si256(__m256i_u const *__p) { return (__m256i)__builtin_ia32_lddqu256((char const *)__p); } diff --git a/clang/lib/Headers/pmmintrin.h b/clang/lib/Headers/pmmintrin.h index eda83567cd058..ee660e95d2744 100644 --- a/clang/lib/Headers/pmmintrin.h +++ b/clang/lib/Headers/pmmintrin.h @@ -35,7 +35,7 @@ ///A pointer to a 128-bit integer vector containing integer values. /// \returns A 128-bit vector containing the moved values. static __inline__ __m128i __DEFAULT_FN_ATTRS -_mm_lddqu_si128(__m128i const *__p) +_mm_lddqu_si128(__m128i_u const *__p) { return (__m128i)__builtin_ia32_lddqu((char const *)__p); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 7262eac - Revert rG9c542a5a4e1ba36c24e48185712779df52b7f7a6 "Lower `@llvm.global_dtors` using `__cxa_atexit` on MachO"
Author: Simon Pilgrim Date: 2022-03-15T13:01:35Z New Revision: 7262eacd41997d7ca262d83367e28998662c1b21 URL: https://github.com/llvm/llvm-project/commit/7262eacd41997d7ca262d83367e28998662c1b21 DIFF: https://github.com/llvm/llvm-project/commit/7262eacd41997d7ca262d83367e28998662c1b21.diff LOG: Revert rG9c542a5a4e1ba36c24e48185712779df52b7f7a6 "Lower `@llvm.global_dtors` using `__cxa_atexit` on MachO" Mane of the build bots are complaining: Unknown command line argument '-lower-global-dtors' Added: llvm/lib/Target/WebAssembly/WebAssemblyLowerGlobalDtors.cpp Modified: clang/lib/CodeGen/BackendUtil.cpp llvm/docs/Passes.rst llvm/include/llvm/CodeGen/CommandFlags.h llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h llvm/include/llvm/InitializePasses.h llvm/include/llvm/LinkAllPasses.h llvm/include/llvm/Target/TargetOptions.h llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerOptions.h llvm/include/llvm/Transforms/Utils.h llvm/lib/CodeGen/CodeGen.cpp llvm/lib/CodeGen/CommandFlags.cpp llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp llvm/lib/CodeGen/TargetPassConfig.cpp llvm/lib/Passes/PassBuilder.cpp llvm/lib/Passes/PassRegistry.def llvm/lib/Target/WebAssembly/CMakeLists.txt llvm/lib/Target/WebAssembly/WebAssembly.h llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp llvm/lib/Transforms/Utils/CMakeLists.txt llvm/test/CodeGen/ARM/ctors_dtors.ll llvm/test/CodeGen/X86/2011-08-29-InitOrder.ll Removed: llvm/include/llvm/Transforms/Utils/LowerGlobalDtors.h llvm/lib/Transforms/Utils/LowerGlobalDtors.cpp llvm/test/Transforms/LowerGlobalDestructors/lower-global-dtors.ll diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 716a565ee7871..490f5b3de1ff3 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -546,8 +546,6 @@ static bool initTargetOptions(DiagnosticsEngine , Options.BinutilsVersion = llvm::TargetMachine::parseBinutilsVersion(CodeGenOpts.BinutilsVersion); Options.UseInitArray = CodeGenOpts.UseInitArray; - Options.LowerGlobalDtorsViaCxaAtExit = - CodeGenOpts.RegisterGlobalDtorsWithAtExit; Options.DisableIntegratedAS = CodeGenOpts.DisableIntegratedAS; Options.CompressDebugSections = CodeGenOpts.getCompressDebugSections(); Options.RelaxELFRelocations = CodeGenOpts.RelaxELFRelocations; diff --git a/llvm/docs/Passes.rst b/llvm/docs/Passes.rst index 7c0666992e8f5..92f06496b4ef9 100644 --- a/llvm/docs/Passes.rst +++ b/llvm/docs/Passes.rst @@ -876,14 +876,6 @@ This pass expects :ref:`LICM ` to be run before it to hoist invariant conditions out of the loop, to make the unswitching opportunity obvious. -``-lower-global-dtors``: Lower global destructors - - -This pass lowers global module destructors (``llvm.global_dtors``) by creating -wrapper functions that are registered as global constructors in -``llvm.global_ctors`` and which contain a call to ``__cxa_atexit`` to register -their destructor functions. - ``-loweratomic``: Lower atomic intrinsics to non-atomic form diff --git a/llvm/include/llvm/CodeGen/CommandFlags.h b/llvm/include/llvm/CodeGen/CommandFlags.h index 4424db4aa2e41..aa91367f65b80 100644 --- a/llvm/include/llvm/CodeGen/CommandFlags.h +++ b/llvm/include/llvm/CodeGen/CommandFlags.h @@ -95,8 +95,6 @@ std::string getTrapFuncName(); bool getUseCtors(); -bool getLowerGlobalDtorsViaCxaAtExit(); - bool getRelaxELFRelocations(); bool getDataSections(); diff --git a/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h b/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h index 26bda8d5d239d..2a35987507446 100644 --- a/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h +++ b/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h @@ -119,9 +119,6 @@ class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile { void Initialize(MCContext , const TargetMachine ) override; - MCSection *getStaticDtorSection(unsigned Priority, - const MCSymbol *KeySym) const override; - /// Emit the module flags that specify the garbage collection information. void emitModuleMetadata(MCStreamer , Module ) const override; diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h index 82aafe2744184..3a98bacef81d0 100644 --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -274,7 +274,6 @@ void initializeLowerAtomicLegacyPassPass(PassRegistry&); void initializeLowerConstantIntrinsicsPass(PassRegistry&); void initializeLowerEmuTLSPass(PassRegistry&); void initializeLowerExpectIntrinsicPass(PassRegistry&); -void
[clang] d258196 - [clang] ScalarExprEmitter::VisitCastExpr - use castAs<> instead of getAs<> to avoid dereference of nullptr
Author: Simon Pilgrim Date: 2022-03-09T11:40:37Z New Revision: d258196f5fddf510e785be68da803d5feae56855 URL: https://github.com/llvm/llvm-project/commit/d258196f5fddf510e785be68da803d5feae56855 DIFF: https://github.com/llvm/llvm-project/commit/d258196f5fddf510e785be68da803d5feae56855.diff LOG: [clang] ScalarExprEmitter::VisitCastExpr - use castAs<> instead of getAs<> to avoid dereference of nullptr The pointers are always dereferenced, so assert the cast is correct instead of returning nullptr Added: Modified: clang/lib/CodeGen/CGExprScalar.cpp Removed: diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 93fb7d37c3445..f0692a2266b74 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -2039,12 +2039,12 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { } if (CGF.SanOpts.has(SanitizerKind::CFIUnrelatedCast)) { - if (auto PT = DestTy->getAs()) { + if (auto *PT = DestTy->getAs()) { CGF.EmitVTablePtrCheckForCast( PT->getPointeeType(), Address(Src, CGF.ConvertTypeForMem( -E->getType()->getAs()->getPointeeType()), +E->getType()->castAs()->getPointeeType()), CGF.getPointerAlign()), /*MayBeNull=*/true, CodeGenFunction::CFITCK_UnrelatedCast, CE->getBeginLoc()); @@ -2948,8 +2948,8 @@ Value *ScalarExprEmitter::VisitOffsetOfExpr(OffsetOfExpr *E) { CurrentType = ON.getBase()->getType(); // Compute the offset to the base. - const RecordType *BaseRT = CurrentType->getAs(); - CXXRecordDecl *BaseRD = cast(BaseRT->getDecl()); + auto *BaseRT = CurrentType->castAs(); + auto *BaseRD = cast(BaseRT->getDecl()); CharUnits OffsetInt = RL.getBaseClassOffset(BaseRD); Offset = llvm::ConstantInt::get(ResultType, OffsetInt.getQuantity()); break; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 8d09311 - [clang] Sema::ActOnModuleImport - remove superfluous nullptr test
Author: Simon Pilgrim Date: 2022-03-09T11:40:36Z New Revision: 8d0931114f2df30c23b4eb1380185063f4684851 URL: https://github.com/llvm/llvm-project/commit/8d0931114f2df30c23b4eb1380185063f4684851 DIFF: https://github.com/llvm/llvm-project/commit/8d0931114f2df30c23b4eb1380185063f4684851.diff LOG: [clang] Sema::ActOnModuleImport - remove superfluous nullptr test Mod has already been dereferenced Added: Modified: clang/lib/Sema/SemaModule.cpp Removed: diff --git a/clang/lib/Sema/SemaModule.cpp b/clang/lib/Sema/SemaModule.cpp index d12de22241f2c..9de95e2e6087a 100644 --- a/clang/lib/Sema/SemaModule.cpp +++ b/clang/lib/Sema/SemaModule.cpp @@ -476,7 +476,7 @@ DeclResult Sema::ActOnModuleImport(SourceLocation StartLoc, Context.addModuleInitializer(ModuleScopes.back().Module, Import); // A module (partition) implementation unit shall not be exported. - if (getLangOpts().CPlusPlusModules && Mod && ExportLoc.isValid() && + if (getLangOpts().CPlusPlusModules && ExportLoc.isValid() && Mod->Kind == Module::ModuleKind::ModulePartitionImplementation) { Diag(ExportLoc, diag::err_export_partition_impl) << SourceRange(ExportLoc, Path.back().second); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] a157d83 - [clang] Environment::createValueUnlessSelfReferential - use castAs<> instead of getAs<> to avoid dereference of nullptr
Author: Simon Pilgrim Date: 2022-03-09T11:40:37Z New Revision: a157d839c52077001f234ce5c8b0cbc05fbb429c URL: https://github.com/llvm/llvm-project/commit/a157d839c52077001f234ce5c8b0cbc05fbb429c DIFF: https://github.com/llvm/llvm-project/commit/a157d839c52077001f234ce5c8b0cbc05fbb429c.diff LOG: [clang] Environment::createValueUnlessSelfReferential - use castAs<> instead of getAs<> to avoid dereference of nullptr The pointer is always dereferenced, so assert the cast is correct instead of returning nullptr Added: Modified: clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp Removed: diff --git a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp index ec945bac09863..23e905fc5138c 100644 --- a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp +++ b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp @@ -439,7 +439,7 @@ Value *Environment::createValueUnlessSelfReferential( if (Type->isReferenceType()) { CreatedValuesCount++; -QualType PointeeType = Type->getAs()->getPointeeType(); +QualType PointeeType = Type->castAs()->getPointeeType(); auto = createStorageLocation(PointeeType); if (!Visited.contains(PointeeType.getCanonicalType())) { @@ -457,7 +457,7 @@ Value *Environment::createValueUnlessSelfReferential( if (Type->isPointerType()) { CreatedValuesCount++; -QualType PointeeType = Type->getAs()->getPointeeType(); +QualType PointeeType = Type->castAs()->getPointeeType(); auto = createStorageLocation(PointeeType); if (!Visited.contains(PointeeType.getCanonicalType())) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 5fe64d2 - [clang] Sema::CheckEquivalentExceptionSpec - remove useless nullptr test
Author: Simon Pilgrim Date: 2022-02-17T16:59:50Z New Revision: 5fe64d238b8b5ed1861de63a2072ddf3e81af806 URL: https://github.com/llvm/llvm-project/commit/5fe64d238b8b5ed1861de63a2072ddf3e81af806 DIFF: https://github.com/llvm/llvm-project/commit/5fe64d238b8b5ed1861de63a2072ddf3e81af806.diff LOG: [clang] Sema::CheckEquivalentExceptionSpec - remove useless nullptr test We use castAs<> for NewProto/OldProto, which would assert if the cast failed. Added: Modified: clang/lib/Sema/SemaExceptionSpec.cpp Removed: diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp index 29cb4be7b1ba..151fbb48651d 100644 --- a/clang/lib/Sema/SemaExceptionSpec.cpp +++ b/clang/lib/Sema/SemaExceptionSpec.cpp @@ -342,8 +342,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { if (!MissingExceptionSpecification) return ReturnValueOnError; - const FunctionProtoType *NewProto = -New->getType()->castAs(); + const auto *NewProto = New->getType()->castAs(); // The new function declaration is only missing an empty exception // specification "throw()". If the throw() specification came from a @@ -353,7 +352,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { // specifications. // // Likewise if the old function is a builtin. - if (MissingEmptyExceptionSpecification && NewProto && + if (MissingEmptyExceptionSpecification && (Old->getLocation().isInvalid() || Context.getSourceManager().isInSystemHeader(Old->getLocation()) || Old->getBuiltinID()) && @@ -364,8 +363,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { return false; } - const FunctionProtoType *OldProto = -Old->getType()->castAs(); + const auto *OldProto = Old->getType()->castAs(); FunctionProtoType::ExceptionSpecInfo ESI = OldProto->getExceptionSpecType(); if (ESI.Type == EST_Dynamic) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 2614de8 - [clang] CGCXXABI::EmitLoadOfMemberFunctionPointer - use castAs<> instead of getAs<> to avoid dereference of nullptr
Author: Simon Pilgrim Date: 2022-02-17T13:18:23Z New Revision: 2614de82025bd9c04f8515747a611238c0ac4e05 URL: https://github.com/llvm/llvm-project/commit/2614de82025bd9c04f8515747a611238c0ac4e05 DIFF: https://github.com/llvm/llvm-project/commit/2614de82025bd9c04f8515747a611238c0ac4e05.diff LOG: [clang] CGCXXABI::EmitLoadOfMemberFunctionPointer - use castAs<> instead of getAs<> to avoid dereference of nullptr The pointer is always dereferenced by arrangeCXXMethodType, so assert the cast is correct instead of returning nullptr Added: Modified: clang/lib/CodeGen/CGCXXABI.cpp Removed: diff --git a/clang/lib/CodeGen/CGCXXABI.cpp b/clang/lib/CodeGen/CGCXXABI.cpp index 0b441e382f11..42e6c916bed0 100644 --- a/clang/lib/CodeGen/CGCXXABI.cpp +++ b/clang/lib/CodeGen/CGCXXABI.cpp @@ -45,8 +45,7 @@ CGCallee CGCXXABI::EmitLoadOfMemberFunctionPointer( ErrorUnsupportedABI(CGF, "calls through member pointers"); ThisPtrForCall = This.getPointer(); - const FunctionProtoType *FPT = -MPT->getPointeeType()->getAs(); + const auto *FPT = MPT->getPointeeType()->castAs(); const auto *RD = cast(MPT->getClass()->castAs()->getDecl()); llvm::FunctionType *FTy = CGM.getTypes().GetFunctionType( ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 57fc979 - [clang] CGDebugInfo::getOrCreateMethodType - use castAs<> instead of getAs<> to avoid dereference of nullptr
Author: Simon Pilgrim Date: 2022-02-17T13:18:23Z New Revision: 57fc9798d7145626809b0e81af9154a755b383eb URL: https://github.com/llvm/llvm-project/commit/57fc9798d7145626809b0e81af9154a755b383eb DIFF: https://github.com/llvm/llvm-project/commit/57fc9798d7145626809b0e81af9154a755b383eb.diff LOG: [clang] CGDebugInfo::getOrCreateMethodType - use castAs<> instead of getAs<> to avoid dereference of nullptr The pointer is always dereferenced, so assert the cast is correct instead of returning nullptr Added: Modified: clang/lib/CodeGen/CGDebugInfo.cpp Removed: diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index c09adad09aa8..d75b5a1a9d12 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1725,7 +1725,7 @@ void CGDebugInfo::CollectRecordFields( llvm::DISubroutineType * CGDebugInfo::getOrCreateMethodType(const CXXMethodDecl *Method, llvm::DIFile *Unit, bool decl) { - const FunctionProtoType *Func = Method->getType()->getAs(); + const auto *Func = Method->getType()->castAs(); if (Method->isStatic()) return cast_or_null( getOrCreateType(QualType(Func, 0), Unit)); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] 1c502c6 - [clang-doc] SerializeIndex - pass Index param by constant reference
Author: Simon Pilgrim Date: 2022-02-17T13:28:02Z New Revision: 1c502c63cb77dd15e698087fdc6b3fb892ce0977 URL: https://github.com/llvm/llvm-project/commit/1c502c63cb77dd15e698087fdc6b3fb892ce0977 DIFF: https://github.com/llvm/llvm-project/commit/1c502c63cb77dd15e698087fdc6b3fb892ce0977.diff LOG: [clang-doc] SerializeIndex - pass Index param by constant reference Silence coverity warnings about unnecessary copies Added: Modified: clang-tools-extra/clang-doc/HTMLGenerator.cpp Removed: diff --git a/clang-tools-extra/clang-doc/HTMLGenerator.cpp b/clang-tools-extra/clang-doc/HTMLGenerator.cpp index e110f312d10c4..4ab962be7864d 100644 --- a/clang-tools-extra/clang-doc/HTMLGenerator.cpp +++ b/clang-tools-extra/clang-doc/HTMLGenerator.cpp @@ -899,7 +899,7 @@ static llvm::Error SerializeIndex(ClangDocContext ) { } CDCtx.Idx.sort(); llvm::json::OStream J(OS, 2); - std::function IndexToJSON = [&](Index I) { + std::function IndexToJSON = [&](const Index ) { J.object([&] { J.attribute("USR", toHex(llvm::toStringRef(I.USR))); J.attribute("Name", I.Name); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] a54b56e - Fix Wdocumentation unknown parameter warning
Author: Simon Pilgrim Date: 2022-02-19T13:06:09Z New Revision: a54b56ecf2e7c35e0bb3e61585a2c27c252069c8 URL: https://github.com/llvm/llvm-project/commit/a54b56ecf2e7c35e0bb3e61585a2c27c252069c8 DIFF: https://github.com/llvm/llvm-project/commit/a54b56ecf2e7c35e0bb3e61585a2c27c252069c8.diff LOG: Fix Wdocumentation unknown parameter warning Added: Modified: clang/lib/Parse/ParseTemplate.cpp Removed: diff --git a/clang/lib/Parse/ParseTemplate.cpp b/clang/lib/Parse/ParseTemplate.cpp index f875e3bf43e81..0d8ab6ad2fbcd 100644 --- a/clang/lib/Parse/ParseTemplate.cpp +++ b/clang/lib/Parse/ParseTemplate.cpp @@ -1233,8 +1233,6 @@ bool Parser::ParseGreaterThanInTemplateList(SourceLocation LAngleLoc, /// token that forms the template-id. Otherwise, we will leave the /// last token in the stream (e.g., so that it can be replaced with an /// annotation token). -/// -/// \param NameHint is not required, and merely affects code completion. bool Parser::ParseTemplateIdAfterTemplateName(bool ConsumeLastToken, SourceLocation , TemplateArgList , ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] 535e7b0 - [clangd] lookupSiblingsWithinContext - remove unnecessary nullptr check
Author: Simon Pilgrim Date: 2022-02-18T11:12:53Z New Revision: 535e7b09c189dd3a7ef65bd36a02962f0c98bd5e URL: https://github.com/llvm/llvm-project/commit/535e7b09c189dd3a7ef65bd36a02962f0c98bd5e DIFF: https://github.com/llvm/llvm-project/commit/535e7b09c189dd3a7ef65bd36a02962f0c98bd5e.diff LOG: [clangd] lookupSiblingsWithinContext - remove unnecessary nullptr check The DC pointer is always dereferenced after the loop Added: Modified: clang-tools-extra/clangd/refactor/Rename.cpp Removed: diff --git a/clang-tools-extra/clangd/refactor/Rename.cpp b/clang-tools-extra/clangd/refactor/Rename.cpp index b106664f0a446..46d884578d462 100644 --- a/clang-tools-extra/clangd/refactor/Rename.cpp +++ b/clang-tools-extra/clangd/refactor/Rename.cpp @@ -389,7 +389,7 @@ const NamedDecl *lookupSiblingsWithinContext(ASTContext , DeclarationName LookupName(); DeclContextLookupResult LookupResult; const auto *DC = RenamedDecl.getDeclContext(); - while (DC && DC->isTransparentContext()) + while (DC->isTransparentContext()) DC = DC->getParent(); switch (DC->getDeclKind()) { // The enclosing DeclContext may not be the enclosing scope, it might have ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] 707157f - Revert rGc24e197aaad5333717a27f6e4346f97da84821ed "[clangd] getHover - pass FormatStyle argument by const reference"
Author: Simon Pilgrim Date: 2022-02-18T14:59:57Z New Revision: 707157f24834e814243c90cf1f5f50c75f3abcb9 URL: https://github.com/llvm/llvm-project/commit/707157f24834e814243c90cf1f5f50c75f3abcb9 DIFF: https://github.com/llvm/llvm-project/commit/707157f24834e814243c90cf1f5f50c75f3abcb9.diff LOG: Revert rGc24e197aaad5333717a27f6e4346f97da84821ed "[clangd] getHover - pass FormatStyle argument by const reference" There are a number of buildbot build failures on non MSVC compilers Added: Modified: clang-tools-extra/clangd/Hover.cpp Removed: diff --git a/clang-tools-extra/clangd/Hover.cpp b/clang-tools-extra/clangd/Hover.cpp index 8b22018411404..dda5ad36e9b89 100644 --- a/clang-tools-extra/clangd/Hover.cpp +++ b/clang-tools-extra/clangd/Hover.cpp @@ -963,7 +963,7 @@ void maybeAddCalleeArgInfo(const SelectionTree::Node *N, HoverInfo , } // namespace llvm::Optional getHover(ParsedAST , Position Pos, - const format::FormatStyle , + format::FormatStyle Style, const SymbolIndex *Index) { PrintingPolicy PP = getPrintingPolicy(AST.getASTContext().getPrintingPolicy()); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] c24e197 - [clangd] getHover - pass FormatStyle argument by const reference
Author: Simon Pilgrim Date: 2022-02-18T14:45:51Z New Revision: c24e197aaad5333717a27f6e4346f97da84821ed URL: https://github.com/llvm/llvm-project/commit/c24e197aaad5333717a27f6e4346f97da84821ed DIFF: https://github.com/llvm/llvm-project/commit/c24e197aaad5333717a27f6e4346f97da84821ed.diff LOG: [clangd] getHover - pass FormatStyle argument by const reference Reported by coverity Added: Modified: clang-tools-extra/clangd/Hover.cpp Removed: diff --git a/clang-tools-extra/clangd/Hover.cpp b/clang-tools-extra/clangd/Hover.cpp index dda5ad36e9b89..8b22018411404 100644 --- a/clang-tools-extra/clangd/Hover.cpp +++ b/clang-tools-extra/clangd/Hover.cpp @@ -963,7 +963,7 @@ void maybeAddCalleeArgInfo(const SelectionTree::Node *N, HoverInfo , } // namespace llvm::Optional getHover(ParsedAST , Position Pos, - format::FormatStyle Style, + const format::FormatStyle , const SymbolIndex *Index) { PrintingPolicy PP = getPrintingPolicy(AST.getASTContext().getPrintingPolicy()); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 9d91e03 - [clang] CIndex.cpp - use cast<> instead of dyn_cast<> to avoid dereference of nullptr
Author: Simon Pilgrim Date: 2022-02-23T10:09:44Z New Revision: 9d91e03b7d075239483e9a5793e1e5db9152bdf1 URL: https://github.com/llvm/llvm-project/commit/9d91e03b7d075239483e9a5793e1e5db9152bdf1 DIFF: https://github.com/llvm/llvm-project/commit/9d91e03b7d075239483e9a5793e1e5db9152bdf1.diff LOG: [clang] CIndex.cpp - use cast<> instead of dyn_cast<> to avoid dereference of nullptr The pointers are used immediately, so assert the cast is correct instead of returning nullptr Added: Modified: clang/tools/libclang/CIndex.cpp Removed: diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 53494ecc7ae9d..e77b85d63c53e 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -4010,7 +4010,7 @@ static const ExprEvalResult *evaluateExpr(Expr *expr, CXCursor C) { } if (expr->getStmtClass() == Stmt::ImplicitCastExprClass) { -const ImplicitCastExpr *I = dyn_cast(expr); +const auto *I = cast(expr); auto *subExpr = I->getSubExprAsWritten(); if (subExpr->getStmtClass() == Stmt::StringLiteralClass || subExpr->getStmtClass() == Stmt::ObjCStringLiteralClass) { @@ -6740,8 +6740,8 @@ void clang_getDefinitionSpellingAndExtent( CXCursor C, const char **startBuf, const char **endBuf, unsigned *startLine, unsigned *startColumn, unsigned *endLine, unsigned *endColumn) { assert(getCursorDecl(C) && "CXCursor has null decl"); - const FunctionDecl *FD = dyn_cast(getCursorDecl(C)); - CompoundStmt *Body = dyn_cast(FD->getBody()); + const auto *FD = cast(getCursorDecl(C)); + const auto *Body = cast(FD->getBody()); SourceManager = FD->getASTContext().getSourceManager(); *startBuf = SM.getCharacterData(Body->getLBracLoc()); @@ -8289,7 +8289,7 @@ unsigned clang_Cursor_getObjCPropertyAttributes(CXCursor C, unsigned reserved) { return CXObjCPropertyAttr_noattr; unsigned Result = CXObjCPropertyAttr_noattr; - const ObjCPropertyDecl *PD = dyn_cast(getCursorDecl(C)); + const auto *PD = cast(getCursorDecl(C)); ObjCPropertyAttribute::Kind Attr = PD->getPropertyAttributesAsWritten(); #define SET_CXOBJCPROP_ATTR(A) \ @@ -8317,7 +8317,7 @@ CXString clang_Cursor_getObjCPropertyGetterName(CXCursor C) { if (C.kind != CXCursor_ObjCPropertyDecl) return cxstring::createNull(); - const ObjCPropertyDecl *PD = dyn_cast(getCursorDecl(C)); + const auto *PD = cast(getCursorDecl(C)); Selector sel = PD->getGetterName(); if (sel.isNull()) return cxstring::createNull(); @@ -8329,7 +8329,7 @@ CXString clang_Cursor_getObjCPropertySetterName(CXCursor C) { if (C.kind != CXCursor_ObjCPropertyDecl) return cxstring::createNull(); - const ObjCPropertyDecl *PD = dyn_cast(getCursorDecl(C)); + const auto *PD = cast(getCursorDecl(C)); Selector sel = PD->getSetterName(); if (sel.isNull()) return cxstring::createNull(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits