[PATCH] D54068: [COFF, ARM64] Implement InterlockedDecrement*_* builtins
mgrang created this revision. mgrang added reviewers: rnk, efriedma, mstorsjo, TomTan. Herald added subscribers: kristina, jfb, chrib, kristof.beyls, javed.absar. This is eight in a series of patches to move intrinsic definitions out of intrin.h. Repository: rC Clang https://reviews.llvm.org/D54068 Files: CodeGen/CGBuiltin.cpp CodeGen/ms-intrinsics.c Headers/intrin.h clang/Basic/BuiltinsAArch64.def clang/Basic/BuiltinsARM.def Index: CodeGen/ms-intrinsics.c === --- CodeGen/ms-intrinsics.c +++ CodeGen/ms-intrinsics.c @@ -1259,6 +1259,87 @@ // CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = add i64 [[TMP]], 1 // CHECK-ARM-ARM64: ret i64 [[RESULT]] // CHECK-ARM-ARM64: } + +short test_InterlockedDecrement16_acq(short volatile *Addend) { + return _InterlockedDecrement16_acq(Addend); +} +// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedDecrement16_acq(i16*{{[a-z_ ]*}}%Addend){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = atomicrmw sub i16* %Addend, i16 1 acquire +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = add i16 [[TMP]], -1 +// CHECK-ARM-ARM64: ret i16 [[RESULT]] +// CHECK-ARM-ARM64: } + +short test_InterlockedDecrement16_rel(short volatile *Addend) { + return _InterlockedDecrement16_rel(Addend); +} +// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedDecrement16_rel(i16*{{[a-z_ ]*}}%Addend){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = atomicrmw sub i16* %Addend, i16 1 release +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = add i16 [[TMP]], -1 +// CHECK-ARM-ARM64: ret i16 [[RESULT]] +// CHECK-ARM-ARM64: } + +short test_InterlockedDecrement16_nf(short volatile *Addend) { + return _InterlockedDecrement16_nf(Addend); +} +// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedDecrement16_nf(i16*{{[a-z_ ]*}}%Addend){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = atomicrmw sub i16* %Addend, i16 1 monotonic +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = add i16 [[TMP]], -1 +// CHECK-ARM-ARM64: ret i16 [[RESULT]] +// CHECK-ARM-ARM64: } + +long test_InterlockedDecrement_acq(long volatile *Addend) { + return _InterlockedDecrement_acq(Addend); +} +// CHECK-ARM-ARM64: define{{.*}}i32 @test_InterlockedDecrement_acq(i32*{{[a-z_ ]*}}%Addend){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = atomicrmw sub i32* %Addend, i32 1 acquire +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = add i32 [[TMP]], -1 +// CHECK-ARM-ARM64: ret i32 [[RESULT]] +// CHECK-ARM-ARM64: } + +long test_InterlockedDecrement_rel(long volatile *Addend) { + return _InterlockedDecrement_rel(Addend); +} +// CHECK-ARM-ARM64: define{{.*}}i32 @test_InterlockedDecrement_rel(i32*{{[a-z_ ]*}}%Addend){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = atomicrmw sub i32* %Addend, i32 1 release +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = add i32 [[TMP]], -1 +// CHECK-ARM-ARM64: ret i32 [[RESULT]] +// CHECK-ARM-ARM64: } + +long test_InterlockedDecrement_nf(long volatile *Addend) { + return _InterlockedDecrement_nf(Addend); +} +// CHECK-ARM-ARM64: define{{.*}}i32 @test_InterlockedDecrement_nf(i32*{{[a-z_ ]*}}%Addend){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = atomicrmw sub i32* %Addend, i32 1 monotonic +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = add i32 [[TMP]], -1 +// CHECK-ARM-ARM64: ret i32 [[RESULT]] +// CHECK-ARM-ARM64: } + +__int64 test_InterlockedDecrement64_acq(__int64 volatile *Addend) { + return _InterlockedDecrement64_acq(Addend); +} +// CHECK-ARM-ARM64: define{{.*}}i64 @test_InterlockedDecrement64_acq(i64*{{[a-z_ ]*}}%Addend){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = atomicrmw sub i64* %Addend, i64 1 acquire +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = add i64 [[TMP]], -1 +// CHECK-ARM-ARM64: ret i64 [[RESULT]] +// CHECK-ARM-ARM64: } + +__int64 test_InterlockedDecrement64_rel(__int64 volatile *Addend) { + return _InterlockedDecrement64_rel(Addend); +} +// CHECK-ARM-ARM64: define{{.*}}i64 @test_InterlockedDecrement64_rel(i64*{{[a-z_ ]*}}%Addend){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = atomicrmw sub i64* %Addend, i64 1 release +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = add i64 [[TMP]], -1 +// CHECK-ARM-ARM64: ret i64 [[RESULT]] +// CHECK-ARM-ARM64: } + +__int64 test_InterlockedDecrement64_nf(__int64 volatile *Addend) { + return _InterlockedDecrement64_nf(Addend); +} +// CHECK-ARM-ARM64: define{{.*}}i64 @test_InterlockedDecrement64_nf(i64*{{[a-z_ ]*}}%Addend){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = atomicrmw sub i64* %Addend, i64 1 monotonic +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = add i64 [[TMP]], -1 +// CHECK-ARM-ARM64: ret i64 [[RESULT]] +// CHECK-ARM-ARM64: } #endif #if !defined(__aarch64__) Index: Headers/intrin.h === --- Headers/intrin.h +++ Headers/intrin.h @@ -360,42 +360,15 @@ |* Interlocked Decrement \**/ #if defined(__arm__) || defined(__aarch64__) -static __inline__ short __DEFAULT_FN_ATTRS -_InterlockedDecrement16_acq(short volatile
[PATCH] D54055: CXXNameMangler::mangleFunctionParam: fix assertion
jfb added a comment. In https://reviews.llvm.org/D54055#1286396, @rjmccall wrote: > That sounds more like this use of the mangler isn't manipulating the function > type context correctly. But actually I think the problem is that it's > ridiculous to assume that arbitrary local declarations have meaningful > manglings. Why are we calling `getStaticDeclName` on a variable that's > obviously not static? It was done in `CodeGenFunction::EmitAutoVarInit` a while ago. I moved it since then, but it's the same thing. I'm happy to mangle it any other way. At the end of the day we just need some name for an (unnamed address) global which is synthesized from a function-local initialization. We could just take the mangled function name and append something to it. Repository: rC Clang https://reviews.llvm.org/D54055 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D54055: CXXNameMangler::mangleFunctionParam: fix assertion
rjmccall added a comment. That sounds more like this use of the mangler isn't manipulating the function type context correctly. But actually I think the problem is that it's ridiculous to assume that arbitrary local declarations have meaningful manglings. Why are we calling `getStaticDeclName` on a variable that's obviously not static? Repository: rC Clang https://reviews.llvm.org/D54055 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D54067: [COFF, ARM64] Implement InterlockedIncrement*_* builtins
mgrang created this revision. mgrang added reviewers: rnk, efriedma, mstorsjo, TomTan. Herald added subscribers: kristina, jfb, chrib, kristof.beyls, javed.absar. This is seventh in a series of patches to move intrinsic definitions out of intrin.h. Repository: rC Clang https://reviews.llvm.org/D54067 Files: CodeGen/CGBuiltin.cpp CodeGen/ms-intrinsics.c Headers/intrin.h clang/Basic/BuiltinsAArch64.def clang/Basic/BuiltinsARM.def Index: CodeGen/ms-intrinsics.c === --- CodeGen/ms-intrinsics.c +++ CodeGen/ms-intrinsics.c @@ -1178,6 +1178,87 @@ // CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw and i64* %value, i64 %mask monotonic // CHECK-ARM-ARM64: ret i64 [[RESULT:%[0-9]+]] // CHECK-ARM-ARM64: } + +short test_InterlockedIncrement16_acq(short volatile *Addend) { + return _InterlockedIncrement16_acq(Addend); +} +// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedIncrement16_acq(i16*{{[a-z_ ]*}}%Addend){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = atomicrmw add i16* %Addend, i16 1 acquire +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = add i16 [[TMP]], 1 +// CHECK-ARM-ARM64: ret i16 [[RESULT]] +// CHECK-ARM-ARM64: } + +short test_InterlockedIncrement16_rel(short volatile *Addend) { + return _InterlockedIncrement16_rel(Addend); +} +// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedIncrement16_rel(i16*{{[a-z_ ]*}}%Addend){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = atomicrmw add i16* %Addend, i16 1 release +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = add i16 [[TMP]], 1 +// CHECK-ARM-ARM64: ret i16 [[RESULT]] +// CHECK-ARM-ARM64: } + +short test_InterlockedIncrement16_nf(short volatile *Addend) { + return _InterlockedIncrement16_nf(Addend); +} +// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedIncrement16_nf(i16*{{[a-z_ ]*}}%Addend){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = atomicrmw add i16* %Addend, i16 1 monotonic +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = add i16 [[TMP]], 1 +// CHECK-ARM-ARM64: ret i16 [[RESULT]] +// CHECK-ARM-ARM64: } + +long test_InterlockedIncrement_acq(long volatile *Addend) { + return _InterlockedIncrement_acq(Addend); +} +// CHECK-ARM-ARM64: define{{.*}}i32 @test_InterlockedIncrement_acq(i32*{{[a-z_ ]*}}%Addend){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = atomicrmw add i32* %Addend, i32 1 acquire +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = add i32 [[TMP]], 1 +// CHECK-ARM-ARM64: ret i32 [[RESULT]] +// CHECK-ARM-ARM64: } + +long test_InterlockedIncrement_rel(long volatile *Addend) { + return _InterlockedIncrement_rel(Addend); +} +// CHECK-ARM-ARM64: define{{.*}}i32 @test_InterlockedIncrement_rel(i32*{{[a-z_ ]*}}%Addend){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = atomicrmw add i32* %Addend, i32 1 release +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = add i32 [[TMP]], 1 +// CHECK-ARM-ARM64: ret i32 [[RESULT]] +// CHECK-ARM-ARM64: } + +long test_InterlockedIncrement_nf(long volatile *Addend) { + return _InterlockedIncrement_nf(Addend); +} +// CHECK-ARM-ARM64: define{{.*}}i32 @test_InterlockedIncrement_nf(i32*{{[a-z_ ]*}}%Addend){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = atomicrmw add i32* %Addend, i32 1 monotonic +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = add i32 [[TMP]], 1 +// CHECK-ARM-ARM64: ret i32 [[RESULT]] +// CHECK-ARM-ARM64: } + +__int64 test_InterlockedIncrement64_acq(__int64 volatile *Addend) { + return _InterlockedIncrement64_acq(Addend); +} +// CHECK-ARM-ARM64: define{{.*}}i64 @test_InterlockedIncrement64_acq(i64*{{[a-z_ ]*}}%Addend){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = atomicrmw add i64* %Addend, i64 1 acquire +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = add i64 [[TMP]], 1 +// CHECK-ARM-ARM64: ret i64 [[RESULT]] +// CHECK-ARM-ARM64: } + +__int64 test_InterlockedIncrement64_rel(__int64 volatile *Addend) { + return _InterlockedIncrement64_rel(Addend); +} +// CHECK-ARM-ARM64: define{{.*}}i64 @test_InterlockedIncrement64_rel(i64*{{[a-z_ ]*}}%Addend){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = atomicrmw add i64* %Addend, i64 1 release +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = add i64 [[TMP]], 1 +// CHECK-ARM-ARM64: ret i64 [[RESULT]] +// CHECK-ARM-ARM64: } + +__int64 test_InterlockedIncrement64_nf(__int64 volatile *Addend) { + return _InterlockedIncrement64_nf(Addend); +} +// CHECK-ARM-ARM64: define{{.*}}i64 @test_InterlockedIncrement64_nf(i64*{{[a-z_ ]*}}%Addend){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = atomicrmw add i64* %Addend, i64 1 monotonic +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = add i64 [[TMP]], 1 +// CHECK-ARM-ARM64: ret i64 [[RESULT]] +// CHECK-ARM-ARM64: } #endif #if !defined(__aarch64__) Index: Headers/intrin.h === --- Headers/intrin.h +++ Headers/intrin.h @@ -346,42 +346,15 @@ |* Interlocked Increment \**/ #if defined(__arm__) || defined(__aarch64__) -static __inline__ short __DEFAULT_FN_ATTRS
[PATCH] D53854: [Driver] Use -push-/-pop-state and -as-needed for libc++ on Fuchsia
MaskRay added inline comments. Comment at: lib/Driver/ToolChains/Fuchsia.cpp:128 if (OnlyLibstdcxxStatic) - CmdArgs.push_back("-Bstatic"); + CmdArgs.push_back("-static"); ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs); If Fuchsia doesn't use gold, it is fine. gold diverges from ld.bfd (lld) in that `-static` switches the whole link to its special static mode. (as usually while you link libstdc++/libc++ statically, you can still link other libraries normally) In ld.bfd/lld, `-Bstatic` is synonym with `-static`. Repository: rC Clang https://reviews.llvm.org/D53854 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D54066: [COFF, ARM64] Implement InterlockedAnd*_* builtins
mgrang created this revision. mgrang added reviewers: rnk, efriedma, mstorsjo, TomTan. Herald added subscribers: kristina, jfb, chrib, kristof.beyls, javed.absar. This is sixth in a series of patches to move intrinsic definitions out of intrin.h. Repository: rC Clang https://reviews.llvm.org/D54066 Files: CodeGen/CGBuiltin.cpp CodeGen/ms-intrinsics.c Headers/intrin.h clang/Basic/BuiltinsAArch64.def clang/Basic/BuiltinsARM.def Index: CodeGen/ms-intrinsics.c === --- CodeGen/ms-intrinsics.c +++ CodeGen/ms-intrinsics.c @@ -1082,6 +1082,102 @@ // CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xor i64* %value, i64 %mask monotonic // CHECK-ARM-ARM64: ret i64 [[RESULT:%[0-9]+]] // CHECK-ARM-ARM64: } + +char test_InterlockedAnd8_acq(char volatile *value, char mask) { + return _InterlockedAnd8_acq(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i8 @test_InterlockedAnd8_acq(i8*{{[a-z_ ]*}}%value, i8{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw and i8* %value, i8 %mask acquire +// CHECK-ARM-ARM64: ret i8 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +char test_InterlockedAnd8_rel(char volatile *value, char mask) { + return _InterlockedAnd8_rel(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i8 @test_InterlockedAnd8_rel(i8*{{[a-z_ ]*}}%value, i8{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw and i8* %value, i8 %mask release +// CHECK-ARM-ARM64: ret i8 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +char test_InterlockedAnd8_nf(char volatile *value, char mask) { + return _InterlockedAnd8_nf(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i8 @test_InterlockedAnd8_nf(i8*{{[a-z_ ]*}}%value, i8{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw and i8* %value, i8 %mask monotonic +// CHECK-ARM-ARM64: ret i8 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +short test_InterlockedAnd16_acq(short volatile *value, short mask) { + return _InterlockedAnd16_acq(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedAnd16_acq(i16*{{[a-z_ ]*}}%value, i16{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw and i16* %value, i16 %mask acquire +// CHECK-ARM-ARM64: ret i16 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +short test_InterlockedAnd16_rel(short volatile *value, short mask) { + return _InterlockedAnd16_rel(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedAnd16_rel(i16*{{[a-z_ ]*}}%value, i16{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw and i16* %value, i16 %mask release +// CHECK-ARM-ARM64: ret i16 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +short test_InterlockedAnd16_nf(short volatile *value, short mask) { + return _InterlockedAnd16_nf(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedAnd16_nf(i16*{{[a-z_ ]*}}%value, i16{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw and i16* %value, i16 %mask monotonic +// CHECK-ARM-ARM64: ret i16 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +long test_InterlockedAnd_acq(long volatile *value, long mask) { + return _InterlockedAnd_acq(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i32 @test_InterlockedAnd_acq(i32*{{[a-z_ ]*}}%value, i32{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw and i32* %value, i32 %mask acquire +// CHECK-ARM-ARM64: ret i32 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +long test_InterlockedAnd_rel(long volatile *value, long mask) { + return _InterlockedAnd_rel(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i32 @test_InterlockedAnd_rel(i32*{{[a-z_ ]*}}%value, i32{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw and i32* %value, i32 %mask release +// CHECK-ARM-ARM64: ret i32 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +long test_InterlockedAnd_nf(long volatile *value, long mask) { + return _InterlockedAnd_nf(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i32 @test_InterlockedAnd_nf(i32*{{[a-z_ ]*}}%value, i32{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw and i32* %value, i32 %mask monotonic +// CHECK-ARM-ARM64: ret i32 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +__int64 test_InterlockedAnd64_acq(__int64 volatile *value, __int64 mask) { + return _InterlockedAnd64_acq(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i64 @test_InterlockedAnd64_acq(i64*{{[a-z_ ]*}}%value, i64{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw and i64* %value, i64 %mask acquire +// CHECK-ARM-ARM64: ret i64 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +__int64 test_InterlockedAnd64_rel(__int64 volatile *value, __int64 mask) { + return _InterlockedAnd64_rel(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i64 @test_InterlockedAnd64_rel(i64*{{[a-z_ ]*}}%value, i64{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64:
[PATCH] D54065: [COFF, ARM64] Implement InterlockedXor*_* builtins
mgrang created this revision. mgrang added reviewers: rnk, efriedma, mstorsjo, TomTan. Herald added subscribers: kristina, jfb, chrib, kristof.beyls, javed.absar. This is fifth in a series of patches to move intrinsic defintions out of intrin.h. Repository: rC Clang https://reviews.llvm.org/D54065 Files: CodeGen/CGBuiltin.cpp CodeGen/ms-intrinsics.c Headers/intrin.h clang/Basic/BuiltinsAArch64.def clang/Basic/BuiltinsARM.def Index: CodeGen/ms-intrinsics.c === --- CodeGen/ms-intrinsics.c +++ CodeGen/ms-intrinsics.c @@ -986,6 +986,102 @@ // CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw or i64* %value, i64 %mask monotonic // CHECK-ARM-ARM64: ret i64 [[RESULT:%[0-9]+]] // CHECK-ARM-ARM64: } + +char test_InterlockedXor8_acq(char volatile *value, char mask) { + return _InterlockedXor8_acq(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i8 @test_InterlockedXor8_acq(i8*{{[a-z_ ]*}}%value, i8{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xor i8* %value, i8 %mask acquire +// CHECK-ARM-ARM64: ret i8 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +char test_InterlockedXor8_rel(char volatile *value, char mask) { + return _InterlockedXor8_rel(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i8 @test_InterlockedXor8_rel(i8*{{[a-z_ ]*}}%value, i8{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xor i8* %value, i8 %mask release +// CHECK-ARM-ARM64: ret i8 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +char test_InterlockedXor8_nf(char volatile *value, char mask) { + return _InterlockedXor8_nf(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i8 @test_InterlockedXor8_nf(i8*{{[a-z_ ]*}}%value, i8{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xor i8* %value, i8 %mask monotonic +// CHECK-ARM-ARM64: ret i8 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +short test_InterlockedXor16_acq(short volatile *value, short mask) { + return _InterlockedXor16_acq(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedXor16_acq(i16*{{[a-z_ ]*}}%value, i16{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xor i16* %value, i16 %mask acquire +// CHECK-ARM-ARM64: ret i16 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +short test_InterlockedXor16_rel(short volatile *value, short mask) { + return _InterlockedXor16_rel(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedXor16_rel(i16*{{[a-z_ ]*}}%value, i16{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xor i16* %value, i16 %mask release +// CHECK-ARM-ARM64: ret i16 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +short test_InterlockedXor16_nf(short volatile *value, short mask) { + return _InterlockedXor16_nf(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedXor16_nf(i16*{{[a-z_ ]*}}%value, i16{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xor i16* %value, i16 %mask monotonic +// CHECK-ARM-ARM64: ret i16 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +long test_InterlockedXor_acq(long volatile *value, long mask) { + return _InterlockedXor_acq(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i32 @test_InterlockedXor_acq(i32*{{[a-z_ ]*}}%value, i32{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xor i32* %value, i32 %mask acquire +// CHECK-ARM-ARM64: ret i32 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +long test_InterlockedXor_rel(long volatile *value, long mask) { + return _InterlockedXor_rel(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i32 @test_InterlockedXor_rel(i32*{{[a-z_ ]*}}%value, i32{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xor i32* %value, i32 %mask release +// CHECK-ARM-ARM64: ret i32 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +long test_InterlockedXor_nf(long volatile *value, long mask) { + return _InterlockedXor_nf(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i32 @test_InterlockedXor_nf(i32*{{[a-z_ ]*}}%value, i32{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xor i32* %value, i32 %mask monotonic +// CHECK-ARM-ARM64: ret i32 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +__int64 test_InterlockedXor64_acq(__int64 volatile *value, __int64 mask) { + return _InterlockedXor64_acq(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i64 @test_InterlockedXor64_acq(i64*{{[a-z_ ]*}}%value, i64{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xor i64* %value, i64 %mask acquire +// CHECK-ARM-ARM64: ret i64 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +__int64 test_InterlockedXor64_rel(__int64 volatile *value, __int64 mask) { + return _InterlockedXor64_rel(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i64 @test_InterlockedXor64_rel(i64*{{[a-z_ ]*}}%value, i64{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64:
[PATCH] D54064: [Driver] Always match resource dir in Fuchsia driver tests
phosek created this revision. phosek added a reviewer: mcgrathr. Herald added subscribers: cfe-commits, cryptoad. This makes the tests stricter by not only matching the runtime file name, but the entire path into the resource directory. Repository: rC Clang https://reviews.llvm.org/D54064 Files: clang/test/Driver/fuchsia.c clang/test/Driver/fuchsia.cpp Index: clang/test/Driver/fuchsia.cpp === --- clang/test/Driver/fuchsia.cpp +++ clang/test/Driver/fuchsia.cpp @@ -1,8 +1,10 @@ -// RUN: %clangxx %s -### -no-canonical-prefixes --target=x86_64-unknown-fuchsia \ +// RUN: %clangxx %s -### -no-canonical-prefixes --target=x86_64-fuchsia \ +// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \ // RUN: --sysroot=%S/platform -fuse-ld=lld 2>&1 | FileCheck %s // CHECK: {{.*}}clang{{.*}}" "-cc1" // CHECK: "-triple" "x86_64-fuchsia" // CHECK: "-fuse-init-array" +// CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]" // CHECK: "-internal-isystem" "{{.*[/\\]}}include{{/|}}c++{{/|}}v1" // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include" @@ -20,7 +22,7 @@ // CHECK: "-lc++" // CHECK: "-lm" // CHECK: "--pop-state" -// CHECK: "{{.*[/\\]}}libclang_rt.builtins-x86_64.a" +// CHECK: "[[RESOURCE_DIR]]{{/|}}x86_64-fuchsia{{/|}}lib{{/|}}libclang_rt.builtins.a" // CHECK: "-lc" // CHECK-NOT: crtend.o // CHECK-NOT: crtn.o Index: clang/test/Driver/fuchsia.c === --- clang/test/Driver/fuchsia.c +++ clang/test/Driver/fuchsia.c @@ -10,6 +10,7 @@ // CHECK: "--mrelax-relocations" // CHECK: "-munwind-tables" // CHECK: "-fuse-init-array" +// CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]" // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include" // CHECK: "-fsanitize=safe-stack" @@ -25,8 +26,8 @@ // CHECK-NOT: crti.o // CHECK-NOT: crtbegin.o // CHECK: "-L[[SYSROOT]]{{/|}}lib" -// CHECK-X86_64: "{{.*[/\\]}}libclang_rt.builtins.a" -// CHECK-AARCH64: "{{.*[/\\]}}libclang_rt.builtins.a" +// CHECK-X86_64: "[[RESOURCE_DIR]]{{/|}}x86_64-fuchsia{{/|}}lib{{/|}}libclang_rt.builtins.a" +// CHECK-AARCH64: "[[RESOURCE_DIR]]{{/|}}aarch64-fuchsia{{/|}}lib{{/|}}libclang_rt.builtins.a" // CHECK: "-lc" // CHECK-NOT: crtend.o // CHECK-NOT: crtn.o @@ -57,8 +58,9 @@ // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \ // RUN: -fuse-ld=lld \ // RUN: | FileCheck %s -check-prefix=CHECK-SAFESTACK +// CHECK-SAFESTACK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-SAFESTACK: "-fsanitize=safe-stack" -// CHECK-SAFESTACK-NOT: "{{.*[/\\]}}libclang_rt.safestack.a" +// CHECK-SAFESTACK-NOT: "[[RESOURCE_DIR]]{{/|}}x86_64-fuchsia{{/|}}lib{{/|}}libclang_rt.safestack.a" // CHECK-SAFESTACK-NOT: "__safestack_init" // RUN: %clang %s -### --target=x86_64-fuchsia \ @@ -94,52 +96,58 @@ // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \ // RUN: -fuse-ld=lld \ // RUN: | FileCheck %s -check-prefix=CHECK-ASAN-SHARED +// CHECK-ASAN-SHARED: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-ASAN-SHARED: "-fsanitize=address" // CHECK-ASAN-SHARED: "-fsanitize-address-globals-dead-stripping" -// CHECK-ASAN-SHARED: "{{.*[/\\]}}libclang_rt.asan.so" -// CHECK-ASAN-SHARED-NOT: "{{.*[/\\]}}libclang_rt.asan-preinit.a" +// CHECK-ASAN-SHARED: "[[RESOURCE_DIR]]{{/|}}x86_64-fuchsia{{/|}}lib{{/|}}libclang_rt.asan.so" +// CHECK-ASAN-SHARED-NOT: "[[RESOURCE_DIR]]{{/|}}x86_64-fuchsia{{/|}}lib{{/|}}libclang_rt.asan-preinit.a" // RUN: %clang %s -### --target=x86_64-fuchsia \ // RUN: -fsanitize=fuzzer 2>&1 \ // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \ // RUN: -fuse-ld=lld \ // RUN: | FileCheck %s -check-prefix=CHECK-FUZZER-X86 +// CHECK-FUZZER-X86: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-FUZZER-X86: "-fsanitize=fuzzer,fuzzer-no-link,safe-stack" -// CHECK-FUZZER-X86: "{{.*[/\\]}}libclang_rt.fuzzer.a" +// CHECK-FUZZER-X86: "[[RESOURCE_DIR]]{{/|}}x86_64-fuchsia{{/|}}lib{{/|}}libclang_rt.fuzzer.a" // RUN: %clang %s -### --target=aarch64-fuchsia \ // RUN: -fsanitize=fuzzer 2>&1 \ // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \ // RUN: -fuse-ld=lld \ // RUN: | FileCheck %s -check-prefix=CHECK-FUZZER-AARCH64 +// CHECK-FUZZER-AARCH64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-FUZZER-AARCH64: "-fsanitize=fuzzer,fuzzer-no-link,safe-stack" -// CHECK-FUZZER-AARCH64: "{{.*[/\\]}}libclang_rt.fuzzer.a" +// CHECK-FUZZER-AARCH64: "[[RESOURCE_DIR]]{{/|}}aarch64-fuchsia{{/|}}lib{{/|}}libclang_rt.fuzzer.a" // RUN: %clang %s -### --target=x86_64-fuchsia \ // RUN: -fsanitize=scudo 2>&1 \ // RUN:
r346065 - Revert r345562: "PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type"
Author: rsmith Date: Fri Nov 2 19:23:33 2018 New Revision: 346065 URL: http://llvm.org/viewvc/llvm-project?rev=346065=rev Log: Revert r345562: "PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type" This exposes a (known) CodeGen bug: it can't cope with emitting lvalue expressions that denote non-odr-used but usable-in-constant-expression variables. See PR39528 for a testcase. Reverted for now until that issue can be fixed. Modified: cfe/trunk/lib/AST/Expr.cpp cfe/trunk/lib/CodeGen/CGExprAgg.cpp cfe/trunk/lib/CodeGen/CGExprScalar.cpp cfe/trunk/lib/Sema/SemaExpr.cpp cfe/trunk/lib/Sema/SemaInit.cpp cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp cfe/trunk/test/Analysis/nullptr.cpp cfe/trunk/test/CXX/drs/dr21xx.cpp cfe/trunk/test/CodeGenCXX/nullptr.cpp cfe/trunk/www/cxx_dr_status.html Modified: cfe/trunk/lib/AST/Expr.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=346065=346064=346065=diff == --- cfe/trunk/lib/AST/Expr.cpp (original) +++ cfe/trunk/lib/AST/Expr.cpp Fri Nov 2 19:23:33 2018 @@ -1816,11 +1816,6 @@ ImplicitCastExpr *ImplicitCastExpr::Crea void *Buffer = C.Allocate(totalSizeToAlloc( PathSize ? 1 : 0, PathSize)); - // Per C++ [conv.lval]p3, lvalue-to-rvalue conversions on class and - // std::nullptr_t have special semantics not captured by CK_LValueToRValue. - assert((Kind != CK_LValueToRValue || - !(T->isNullPtrType() || T->getAsCXXRecordDecl())) && - "invalid type for lvalue-to-rvalue conversion"); ImplicitCastExpr *E = new (Buffer) ImplicitCastExpr(T, Kind, Operand, PathSize, VK); if (PathSize) Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=346065=346064=346065=diff == --- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original) +++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Fri Nov 2 19:23:33 2018 @@ -1300,8 +1300,7 @@ static bool isSimpleZero(const Expr *E, // (int*)0 - Null pointer expressions. if (const CastExpr *ICE = dyn_cast(E)) return ICE->getCastKind() == CK_NullToPointer && - CGF.getTypes().isPointerZeroInitializable(E->getType()) && - !E->HasSideEffects(CGF.getContext()); +CGF.getTypes().isPointerZeroInitializable(E->getType()); // '\0' if (const CharacterLiteral *CL = dyn_cast(E)) return CL->getValue() == 0; Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=346065=346064=346065=diff == --- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original) +++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Fri Nov 2 19:23:33 2018 @@ -2072,14 +2072,14 @@ Value *ScalarExprEmitter::VisitCastExpr( case CK_NullToPointer: if (MustVisitNullValue(E)) - CGF.EmitIgnoredExpr(E); + (void) Visit(E); return CGF.CGM.getNullPointer(cast(ConvertType(DestTy)), DestTy); case CK_NullToMemberPointer: { if (MustVisitNullValue(E)) - CGF.EmitIgnoredExpr(E); + (void) Visit(E); const MemberPointerType *MPT = CE->getType()->getAs(); return CGF.CGM.getCXXABI().EmitNullMemberPointer(MPT); Modified: cfe/trunk/lib/Sema/SemaExpr.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=346065=346064=346065=diff == --- cfe/trunk/lib/Sema/SemaExpr.cpp (original) +++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Nov 2 19:23:33 2018 @@ -623,11 +623,8 @@ ExprResult Sema::DefaultLvalueConversion if (E->getType().getObjCLifetime() == Qualifiers::OCL_Weak) Cleanup.setExprNeedsCleanups(true); - // C++ [conv.lval]p3: - // If T is cv std::nullptr_t, the result is a null pointer constant. - CastKind CK = T->isNullPtrType() ? CK_NullToPointer : CK_LValueToRValue; - ExprResult Res = - ImplicitCastExpr::Create(Context, T, CK, E, nullptr, VK_RValue); + ExprResult Res = ImplicitCastExpr::Create(Context, T, CK_LValueToRValue, E, +nullptr, VK_RValue); // C11 6.3.2.1p2: // ... if the lvalue has atomic type, the value has the non-atomic version Modified: cfe/trunk/lib/Sema/SemaInit.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=346065=346064=346065=diff == --- cfe/trunk/lib/Sema/SemaInit.cpp (original) +++ cfe/trunk/lib/Sema/SemaInit.cpp Fri Nov 2 19:23:33 2018 @@ -7644,13 +7644,9 @@ InitializationSequence::Perform(Sema , case SK_LValueToRValue: { assert(CurInit.get()->isGLValue() && "cannot load from a prvalue"); -
[PATCH] D53854: [Driver] Use -push-/-pop-state and -as-needed for libc++ on Fuchsia
This revision was automatically updated to reflect the committed changes. Closed by commit rC346064: [Driver] Use -push-/-pop-state and -as-needed for libc++ on Fuchsia (authored by phosek, committed by ). Changed prior to commit: https://reviews.llvm.org/D53854?vs=171948=172478#toc Repository: rC Clang https://reviews.llvm.org/D53854 Files: lib/Driver/ToolChains/Fuchsia.cpp test/Driver/fuchsia.cpp Index: lib/Driver/ToolChains/Fuchsia.cpp === --- lib/Driver/ToolChains/Fuchsia.cpp +++ lib/Driver/ToolChains/Fuchsia.cpp @@ -122,13 +122,14 @@ if (ToolChain.ShouldLinkCXXStdlib(Args)) { bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) && !Args.hasArg(options::OPT_static); +CmdArgs.push_back("--push-state"); +CmdArgs.push_back("--as-needed"); if (OnlyLibstdcxxStatic) - CmdArgs.push_back("-Bstatic"); + CmdArgs.push_back("-static"); ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs); -if (OnlyLibstdcxxStatic) - CmdArgs.push_back("-Bdynamic"); +CmdArgs.push_back("-lm"); +CmdArgs.push_back("--pop-state"); } - CmdArgs.push_back("-lm"); } AddRunTimeLibs(ToolChain, D, CmdArgs, Args); Index: test/Driver/fuchsia.cpp === --- test/Driver/fuchsia.cpp +++ test/Driver/fuchsia.cpp @@ -15,7 +15,11 @@ // CHECK-NOT: crti.o // CHECK-NOT: crtbegin.o // CHECK: "-L[[SYSROOT]]{{/|}}lib" -// CHECK: "-lc++" "-lm" +// CHECK: "--push-state" +// CHECK: "--as-needed" +// CHECK: "-lc++" +// CHECK: "-lm" +// CHECK: "--pop-state" // CHECK: "{{.*[/\\]}}libclang_rt.builtins-x86_64.a" // CHECK: "-lc" // CHECK-NOT: crtend.o @@ -29,8 +33,10 @@ // RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -static-libstdc++ \ // RUN: -fuse-ld=lld 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-STATIC -// CHECK-STATIC: "-Bstatic" +// CHECK-STATIC: "--push-state" +// CHECK-STATIC: "--as-needed" +// CHECK-STATIC: "-static" // CHECK-STATIC: "-lc++" -// CHECK-STATIC: "-Bdynamic" // CHECK-STATIC: "-lm" +// CHECK-STATIC: "--pop-state" // CHECK-STATIC: "-lc" Index: lib/Driver/ToolChains/Fuchsia.cpp === --- lib/Driver/ToolChains/Fuchsia.cpp +++ lib/Driver/ToolChains/Fuchsia.cpp @@ -122,13 +122,14 @@ if (ToolChain.ShouldLinkCXXStdlib(Args)) { bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) && !Args.hasArg(options::OPT_static); +CmdArgs.push_back("--push-state"); +CmdArgs.push_back("--as-needed"); if (OnlyLibstdcxxStatic) - CmdArgs.push_back("-Bstatic"); + CmdArgs.push_back("-static"); ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs); -if (OnlyLibstdcxxStatic) - CmdArgs.push_back("-Bdynamic"); +CmdArgs.push_back("-lm"); +CmdArgs.push_back("--pop-state"); } - CmdArgs.push_back("-lm"); } AddRunTimeLibs(ToolChain, D, CmdArgs, Args); Index: test/Driver/fuchsia.cpp === --- test/Driver/fuchsia.cpp +++ test/Driver/fuchsia.cpp @@ -15,7 +15,11 @@ // CHECK-NOT: crti.o // CHECK-NOT: crtbegin.o // CHECK: "-L[[SYSROOT]]{{/|}}lib" -// CHECK: "-lc++" "-lm" +// CHECK: "--push-state" +// CHECK: "--as-needed" +// CHECK: "-lc++" +// CHECK: "-lm" +// CHECK: "--pop-state" // CHECK: "{{.*[/\\]}}libclang_rt.builtins-x86_64.a" // CHECK: "-lc" // CHECK-NOT: crtend.o @@ -29,8 +33,10 @@ // RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -static-libstdc++ \ // RUN: -fuse-ld=lld 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-STATIC -// CHECK-STATIC: "-Bstatic" +// CHECK-STATIC: "--push-state" +// CHECK-STATIC: "--as-needed" +// CHECK-STATIC: "-static" // CHECK-STATIC: "-lc++" -// CHECK-STATIC: "-Bdynamic" // CHECK-STATIC: "-lm" +// CHECK-STATIC: "--pop-state" // CHECK-STATIC: "-lc" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r346064 - [Driver] Use -push-/-pop-state and -as-needed for libc++ on Fuchsia
Author: phosek Date: Fri Nov 2 18:43:25 2018 New Revision: 346064 URL: http://llvm.org/viewvc/llvm-project?rev=346064=rev Log: [Driver] Use -push-/-pop-state and -as-needed for libc++ on Fuchsia This avoids introducing unnecessary DT_NEEDED entries when using C++ driver for linking C code or C++ code that doesn't use C++ standard library. Differential Revision: https://reviews.llvm.org/D53854 Modified: cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp cfe/trunk/test/Driver/fuchsia.cpp Modified: cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp?rev=346064=346063=346064=diff == --- cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp Fri Nov 2 18:43:25 2018 @@ -122,13 +122,14 @@ void fuchsia::Linker::ConstructJob(Compi if (ToolChain.ShouldLinkCXXStdlib(Args)) { bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) && !Args.hasArg(options::OPT_static); +CmdArgs.push_back("--push-state"); +CmdArgs.push_back("--as-needed"); if (OnlyLibstdcxxStatic) - CmdArgs.push_back("-Bstatic"); + CmdArgs.push_back("-static"); ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs); -if (OnlyLibstdcxxStatic) - CmdArgs.push_back("-Bdynamic"); +CmdArgs.push_back("-lm"); +CmdArgs.push_back("--pop-state"); } - CmdArgs.push_back("-lm"); } AddRunTimeLibs(ToolChain, D, CmdArgs, Args); Modified: cfe/trunk/test/Driver/fuchsia.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fuchsia.cpp?rev=346064=346063=346064=diff == --- cfe/trunk/test/Driver/fuchsia.cpp (original) +++ cfe/trunk/test/Driver/fuchsia.cpp Fri Nov 2 18:43:25 2018 @@ -15,7 +15,11 @@ // CHECK-NOT: crti.o // CHECK-NOT: crtbegin.o // CHECK: "-L[[SYSROOT]]{{/|}}lib" -// CHECK: "-lc++" "-lm" +// CHECK: "--push-state" +// CHECK: "--as-needed" +// CHECK: "-lc++" +// CHECK: "-lm" +// CHECK: "--pop-state" // CHECK: "{{.*[/\\]}}libclang_rt.builtins-x86_64.a" // CHECK: "-lc" // CHECK-NOT: crtend.o @@ -29,8 +33,10 @@ // RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -static-libstdc++ \ // RUN: -fuse-ld=lld 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-STATIC -// CHECK-STATIC: "-Bstatic" +// CHECK-STATIC: "--push-state" +// CHECK-STATIC: "--as-needed" +// CHECK-STATIC: "-static" // CHECK-STATIC: "-lc++" -// CHECK-STATIC: "-Bdynamic" // CHECK-STATIC: "-lm" +// CHECK-STATIC: "--pop-state" // CHECK-STATIC: "-lc" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D54063: [COFF, ARM64] Implement InterlockedOr*_* builtins
mgrang created this revision. mgrang added reviewers: rnk, efriedma, mstorsjo, TomTan. Herald added subscribers: kristina, jfb, chrib, kristof.beyls, javed.absar. This is fourth in a series of patches to move intrinsic defintions out of intrin.h. Repository: rC Clang https://reviews.llvm.org/D54063 Files: include/clang/Basic/BuiltinsAArch64.def include/clang/Basic/BuiltinsARM.def lib/CodeGen/CGBuiltin.cpp lib/Headers/intrin.h test/CodeGen/ms-intrinsics.c Index: test/CodeGen/ms-intrinsics.c === --- test/CodeGen/ms-intrinsics.c +++ test/CodeGen/ms-intrinsics.c @@ -890,6 +890,102 @@ // CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = extractvalue { i64, i1 } [[TMP]], 0 // CHECK-ARM-ARM64: ret i64 [[RESULT]] // CHECK-ARM-ARM64: } + +char test_InterlockedOr8_acq(char volatile *value, char mask) { + return _InterlockedOr8_acq(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i8 @test_InterlockedOr8_acq(i8*{{[a-z_ ]*}}%value, i8{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw or i8* %value, i8 %mask acquire +// CHECK-ARM-ARM64: ret i8 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +char test_InterlockedOr8_rel(char volatile *value, char mask) { + return _InterlockedOr8_rel(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i8 @test_InterlockedOr8_rel(i8*{{[a-z_ ]*}}%value, i8{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw or i8* %value, i8 %mask release +// CHECK-ARM-ARM64: ret i8 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +char test_InterlockedOr8_nf(char volatile *value, char mask) { + return _InterlockedOr8_nf(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i8 @test_InterlockedOr8_nf(i8*{{[a-z_ ]*}}%value, i8{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw or i8* %value, i8 %mask monotonic +// CHECK-ARM-ARM64: ret i8 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +short test_InterlockedOr16_acq(short volatile *value, short mask) { + return _InterlockedOr16_acq(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedOr16_acq(i16*{{[a-z_ ]*}}%value, i16{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw or i16* %value, i16 %mask acquire +// CHECK-ARM-ARM64: ret i16 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +short test_InterlockedOr16_rel(short volatile *value, short mask) { + return _InterlockedOr16_rel(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedOr16_rel(i16*{{[a-z_ ]*}}%value, i16{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw or i16* %value, i16 %mask release +// CHECK-ARM-ARM64: ret i16 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +short test_InterlockedOr16_nf(short volatile *value, short mask) { + return _InterlockedOr16_nf(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedOr16_nf(i16*{{[a-z_ ]*}}%value, i16{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw or i16* %value, i16 %mask monotonic +// CHECK-ARM-ARM64: ret i16 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +long test_InterlockedOr_acq(long volatile *value, long mask) { + return _InterlockedOr_acq(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i32 @test_InterlockedOr_acq(i32*{{[a-z_ ]*}}%value, i32{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw or i32* %value, i32 %mask acquire +// CHECK-ARM-ARM64: ret i32 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +long test_InterlockedOr_rel(long volatile *value, long mask) { + return _InterlockedOr_rel(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i32 @test_InterlockedOr_rel(i32*{{[a-z_ ]*}}%value, i32{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw or i32* %value, i32 %mask release +// CHECK-ARM-ARM64: ret i32 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +long test_InterlockedOr_nf(long volatile *value, long mask) { + return _InterlockedOr_nf(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i32 @test_InterlockedOr_nf(i32*{{[a-z_ ]*}}%value, i32{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw or i32* %value, i32 %mask monotonic +// CHECK-ARM-ARM64: ret i32 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +__int64 test_InterlockedOr64_acq(__int64 volatile *value, __int64 mask) { + return _InterlockedOr64_acq(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i64 @test_InterlockedOr64_acq(i64*{{[a-z_ ]*}}%value, i64{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw or i64* %value, i64 %mask acquire +// CHECK-ARM-ARM64: ret i64 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } + +__int64 test_InterlockedOr64_rel(__int64 volatile *value, __int64 mask) { + return _InterlockedOr64_rel(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i64 @test_InterlockedOr64_rel(i64*{{[a-z_ ]*}}%value, i64{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] =
[PATCH] D54062: [COFF, ARM64] Implement InterlockedCompareExchange*_* builtins
mgrang created this revision. mgrang added reviewers: rnk, efriedma, mstorsjo, TomTan. Herald added subscribers: kristina, jfb, chrib, kristof.beyls, javed.absar. This is third in a series of patches to move intrinsic definitions out of intrin.h. Repository: rC Clang https://reviews.llvm.org/D54062 Files: include/clang/Basic/BuiltinsAArch64.def include/clang/Basic/BuiltinsARM.def lib/CodeGen/CGBuiltin.cpp lib/Headers/intrin.h test/CodeGen/ms-intrinsics.c Index: test/CodeGen/ms-intrinsics.c === --- test/CodeGen/ms-intrinsics.c +++ test/CodeGen/ms-intrinsics.c @@ -782,6 +782,114 @@ // CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xchg i64* %value, i64 %mask monotonic // CHECK-ARM-ARM64: ret i64 [[RESULT:%[0-9]+]] // CHECK-ARM-ARM64: } + +char test_InterlockedCompareExchange8_acq(char volatile *Destination, char Exchange, char Comperand) { + return _InterlockedCompareExchange8_acq(Destination, Exchange, Comperand); +} +// CHECK-ARM-ARM64: define{{.*}}i8 @test_InterlockedCompareExchange8_acq(i8*{{[a-z_ ]*}}%Destination, i8{{[a-z_ ]*}}%Exchange, i8{{[a-z_ ]*}}%Comperand){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = cmpxchg volatile i8* %Destination, i8 %Comperand, i8 %Exchange acquire acquire +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = extractvalue { i8, i1 } [[TMP]], 0 +// CHECK-ARM-ARM64: ret i8 [[RESULT]] +// CHECK-ARM-ARM64: } + +char test_InterlockedCompareExchange8_rel(char volatile *Destination, char Exchange, char Comperand) { + return _InterlockedCompareExchange8_rel(Destination, Exchange, Comperand); +} +// CHECK-ARM-ARM64: define{{.*}}i8 @test_InterlockedCompareExchange8_rel(i8*{{[a-z_ ]*}}%Destination, i8{{[a-z_ ]*}}%Exchange, i8{{[a-z_ ]*}}%Comperand){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = cmpxchg volatile i8* %Destination, i8 %Comperand, i8 %Exchange release monotonic +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = extractvalue { i8, i1 } [[TMP]], 0 +// CHECK-ARM-ARM64: ret i8 [[RESULT]] +// CHECK-ARM-ARM64: } + +char test_InterlockedCompareExchange8_nf(char volatile *Destination, char Exchange, char Comperand) { + return _InterlockedCompareExchange8_nf(Destination, Exchange, Comperand); +} +// CHECK-ARM-ARM64: define{{.*}}i8 @test_InterlockedCompareExchange8_nf(i8*{{[a-z_ ]*}}%Destination, i8{{[a-z_ ]*}}%Exchange, i8{{[a-z_ ]*}}%Comperand){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = cmpxchg volatile i8* %Destination, i8 %Comperand, i8 %Exchange monotonic monotonic +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = extractvalue { i8, i1 } [[TMP]], 0 +// CHECK-ARM-ARM64: ret i8 [[RESULT]] +// CHECK-ARM-ARM64: } + +short test_InterlockedCompareExchange16_acq(short volatile *Destination, short Exchange, short Comperand) { + return _InterlockedCompareExchange16_acq(Destination, Exchange, Comperand); +} +// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedCompareExchange16_acq(i16*{{[a-z_ ]*}}%Destination, i16{{[a-z_ ]*}}%Exchange, i16{{[a-z_ ]*}}%Comperand){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = cmpxchg volatile i16* %Destination, i16 %Comperand, i16 %Exchange acquire acquire +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = extractvalue { i16, i1 } [[TMP]], 0 +// CHECK-ARM-ARM64: ret i16 [[RESULT]] +// CHECK-ARM-ARM64: } + +short test_InterlockedCompareExchange16_rel(short volatile *Destination, short Exchange, short Comperand) { + return _InterlockedCompareExchange16_rel(Destination, Exchange, Comperand); +} +// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedCompareExchange16_rel(i16*{{[a-z_ ]*}}%Destination, i16{{[a-z_ ]*}}%Exchange, i16{{[a-z_ ]*}}%Comperand){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = cmpxchg volatile i16* %Destination, i16 %Comperand, i16 %Exchange release monotonic +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = extractvalue { i16, i1 } [[TMP]], 0 +// CHECK-ARM-ARM64: ret i16 [[RESULT]] +// CHECK-ARM-ARM64: } + +short test_InterlockedCompareExchange16_nf(short volatile *Destination, short Exchange, short Comperand) { + return _InterlockedCompareExchange16_nf(Destination, Exchange, Comperand); +} +// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedCompareExchange16_nf(i16*{{[a-z_ ]*}}%Destination, i16{{[a-z_ ]*}}%Exchange, i16{{[a-z_ ]*}}%Comperand){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = cmpxchg volatile i16* %Destination, i16 %Comperand, i16 %Exchange monotonic monotonic +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = extractvalue { i16, i1 } [[TMP]], 0 +// CHECK-ARM-ARM64: ret i16 [[RESULT]] +// CHECK-ARM-ARM64: } + +long test_InterlockedCompareExchange_acq(long volatile *Destination, long Exchange, long Comperand) { + return _InterlockedCompareExchange_acq(Destination, Exchange, Comperand); +} +// CHECK-ARM-ARM64: define{{.*}}i32 @test_InterlockedCompareExchange_acq(i32*{{[a-z_ ]*}}%Destination, i32{{[a-z_ ]*}}%Exchange, i32{{[a-z_ ]*}}%Comperand){{.*}}{ +// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = cmpxchg volatile i32* %Destination, i32 %Comperand, i32 %Exchange acquire acquire +//
[PATCH] D54061: [clang-tidy] run() doesn't update the SourceManager.
sammccall created this revision. sammccall added reviewers: hokein, alexfh. Herald added subscribers: cfe-commits, xazax.hun. By now the context's SourceManager is now initialized everywhere that ClangTidyCheck::registerMatcher() is called, so the call from run() seems entirely redundant, and indeed all the tests pass. This solves a problem with embedding clang-tidy: if using a DiagnosticsEngine which already has file state, re-setting its SourceManager (to the same value) causes an assertion. (There are other ways to solve this problem, but this is the simplest). Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D54061 Files: clang-tidy/ClangTidy.cpp Index: clang-tidy/ClangTidy.cpp === --- clang-tidy/ClangTidy.cpp +++ clang-tidy/ClangTidy.cpp @@ -441,7 +441,6 @@ } void ClangTidyCheck::run(const ast_matchers::MatchFinder::MatchResult ) { - Context->setSourceManager(Result.SourceManager); check(Result); } Index: clang-tidy/ClangTidy.cpp === --- clang-tidy/ClangTidy.cpp +++ clang-tidy/ClangTidy.cpp @@ -441,7 +441,6 @@ } void ClangTidyCheck::run(const ast_matchers::MatchFinder::MatchResult ) { - Context->setSourceManager(Result.SourceManager); check(Result); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D54026: [CMake][Fuchsia] Set -fuse-ld=lld explicitly for Linux runtimes
This revision was automatically updated to reflect the committed changes. Closed by commit rL346056: [CMake][Fuchsia] Set -fuse-ld=lld explicitly for Linux runtimes (authored by phosek, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D54026?vs=172312=172468#toc Repository: rL LLVM https://reviews.llvm.org/D54026 Files: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake Index: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake === --- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake +++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake @@ -40,12 +40,18 @@ set(BUILTINS_${target}-linux-gnu_CMAKE_SYSTEM_NAME Linux CACHE STRING "") set(BUILTINS_${target}-linux-gnu_CMAKE_BUILD_TYPE Release CACHE STRING "") set(BUILTINS_${target}-linux-gnu_CMAKE_SYSROOT ${LINUX_${target}_SYSROOT} CACHE STRING "") +set(BUILTINS_${target}-linux-gnu_CMAKE_SHARED_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "") +set(BUILTINS_${target}-linux-gnu_CMAKE_MODULE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "") +set(BUILTINS_${target}-linux-gnu_CMAKE_EXE_LINKER_FLAG "-fuse-ld=lld" CACHE STRING "") # Set the per-target runtimes options. list(APPEND RUNTIME_TARGETS "${target}-linux-gnu") set(RUNTIMES_${target}-linux-gnu_CMAKE_SYSTEM_NAME Linux CACHE STRING "") set(RUNTIMES_${target}-linux-gnu_CMAKE_BUILD_TYPE Release CACHE STRING "") set(RUNTIMES_${target}-linux-gnu_CMAKE_SYSROOT ${LINUX_${target}_SYSROOT} CACHE STRING "") +set(RUNTIMES_${target}-linux-gnu_CMAKE_SHARED_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "") +set(RUNTIMES_${target}-linux-gnu_CMAKE_MODULE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "") +set(RUNTIMES_${target}-linux-gnu_CMAKE_EXE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "") set(RUNTIMES_${target}-linux-gnu_LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "") set(RUNTIMES_${target}-linux-gnu_LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "") set(RUNTIMES_${target}-linux-gnu_LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "") @@ -79,25 +85,25 @@ list(APPEND BUILTIN_TARGETS "${target}-fuchsia") set(BUILTINS_${target}-fuchsia_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "") set(BUILTINS_${target}-fuchsia_CMAKE_BUILD_TYPE Release CACHE STRING "") -set(BUILTINS_${target}-fuchsia_CMAKE_ASM_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE PATH "") -set(BUILTINS_${target}-fuchsia_CMAKE_C_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE PATH "") -set(BUILTINS_${target}-fuchsia_CMAKE_CXX_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE PATH "") -set(BUILTINS_${target}-fuchsia_CMAKE_SHARED_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE PATH "") -set(BUILTINS_${target}-fuchsia_CMAKE_MODULE_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE PATH "") -set(BUILTINS_${target}-fuchsia_CMAKE_EXE_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE PATH "") +set(BUILTINS_${target}-fuchsia_CMAKE_ASM_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE STRING "") +set(BUILTINS_${target}-fuchsia_CMAKE_C_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE STRING "") +set(BUILTINS_${target}-fuchsia_CMAKE_CXX_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE STRING "") +set(BUILTINS_${target}-fuchsia_CMAKE_SHARED_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE STRING "") +set(BUILTINS_${target}-fuchsia_CMAKE_MODULE_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE STRING "") +set(BUILTINS_${target}-fuchsia_CMAKE_EXE_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE STRING "") set(BUILTINS_${target}-fuchsia_CMAKE_SYSROOT ${FUCHSIA_${target}_SYSROOT} CACHE PATH "") # Set the per-target runtimes options. list(APPEND RUNTIME_TARGETS "${target}-fuchsia") set(RUNTIMES_${target}-fuchsia_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "") set(RUNTIMES_${target}-fuchsia_CMAKE_BUILD_TYPE Release CACHE STRING "") -set(RUNTIMES_${target}-fuchsia_CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE STRING "") -set(RUNTIMES_${target}-fuchsia_CMAKE_ASM_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE PATH "") -set(RUNTIMES_${target}-fuchsia_CMAKE_C_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE PATH "") -set(RUNTIMES_${target}-fuchsia_CMAKE_CXX_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE PATH "") -set(RUNTIMES_${target}-fuchsia_CMAKE_SHARED_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE PATH "") -set(RUNTIMES_${target}-fuchsia_CMAKE_MODULE_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE PATH "") -set(RUNTIMES_${target}-fuchsia_CMAKE_EXE_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE PATH "") +set(RUNTIMES_${target}-fuchsia_CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE BOOL "") +set(RUNTIMES_${target}-fuchsia_CMAKE_ASM_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE STRING "") +set(RUNTIMES_${target}-fuchsia_CMAKE_C_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS}
r346056 - [CMake][Fuchsia] Set -fuse-ld=lld explicitly for Linux runtimes
Author: phosek Date: Fri Nov 2 16:49:36 2018 New Revision: 346056 URL: http://llvm.org/viewvc/llvm-project?rev=346056=rev Log: [CMake][Fuchsia] Set -fuse-ld=lld explicitly for Linux runtimes We set lld as the default linker on non-Darwin platforms, but we still need to set -fuse-ld=lld explicitly in to support cross-compiling Linux runtimes on Darwin. Differential Revision: https://reviews.llvm.org/D54026 Modified: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake Modified: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/Fuchsia-stage2.cmake?rev=346056=346055=346056=diff == --- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake (original) +++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake Fri Nov 2 16:49:36 2018 @@ -40,12 +40,18 @@ foreach(target i386;x86_64;armhf;aarch64 set(BUILTINS_${target}-linux-gnu_CMAKE_SYSTEM_NAME Linux CACHE STRING "") set(BUILTINS_${target}-linux-gnu_CMAKE_BUILD_TYPE Release CACHE STRING "") set(BUILTINS_${target}-linux-gnu_CMAKE_SYSROOT ${LINUX_${target}_SYSROOT} CACHE STRING "") +set(BUILTINS_${target}-linux-gnu_CMAKE_SHARED_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "") +set(BUILTINS_${target}-linux-gnu_CMAKE_MODULE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "") +set(BUILTINS_${target}-linux-gnu_CMAKE_EXE_LINKER_FLAG "-fuse-ld=lld" CACHE STRING "") # Set the per-target runtimes options. list(APPEND RUNTIME_TARGETS "${target}-linux-gnu") set(RUNTIMES_${target}-linux-gnu_CMAKE_SYSTEM_NAME Linux CACHE STRING "") set(RUNTIMES_${target}-linux-gnu_CMAKE_BUILD_TYPE Release CACHE STRING "") set(RUNTIMES_${target}-linux-gnu_CMAKE_SYSROOT ${LINUX_${target}_SYSROOT} CACHE STRING "") +set(RUNTIMES_${target}-linux-gnu_CMAKE_SHARED_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "") +set(RUNTIMES_${target}-linux-gnu_CMAKE_MODULE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "") +set(RUNTIMES_${target}-linux-gnu_CMAKE_EXE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "") set(RUNTIMES_${target}-linux-gnu_LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "") set(RUNTIMES_${target}-linux-gnu_LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "") set(RUNTIMES_${target}-linux-gnu_LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "") @@ -79,25 +85,25 @@ if(FUCHSIA_SDK) list(APPEND BUILTIN_TARGETS "${target}-fuchsia") set(BUILTINS_${target}-fuchsia_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "") set(BUILTINS_${target}-fuchsia_CMAKE_BUILD_TYPE Release CACHE STRING "") -set(BUILTINS_${target}-fuchsia_CMAKE_ASM_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE PATH "") -set(BUILTINS_${target}-fuchsia_CMAKE_C_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE PATH "") -set(BUILTINS_${target}-fuchsia_CMAKE_CXX_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE PATH "") -set(BUILTINS_${target}-fuchsia_CMAKE_SHARED_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE PATH "") -set(BUILTINS_${target}-fuchsia_CMAKE_MODULE_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE PATH "") -set(BUILTINS_${target}-fuchsia_CMAKE_EXE_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE PATH "") +set(BUILTINS_${target}-fuchsia_CMAKE_ASM_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE STRING "") +set(BUILTINS_${target}-fuchsia_CMAKE_C_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE STRING "") +set(BUILTINS_${target}-fuchsia_CMAKE_CXX_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE STRING "") +set(BUILTINS_${target}-fuchsia_CMAKE_SHARED_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE STRING "") +set(BUILTINS_${target}-fuchsia_CMAKE_MODULE_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE STRING "") +set(BUILTINS_${target}-fuchsia_CMAKE_EXE_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE STRING "") set(BUILTINS_${target}-fuchsia_CMAKE_SYSROOT ${FUCHSIA_${target}_SYSROOT} CACHE PATH "") # Set the per-target runtimes options. list(APPEND RUNTIME_TARGETS "${target}-fuchsia") set(RUNTIMES_${target}-fuchsia_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "") set(RUNTIMES_${target}-fuchsia_CMAKE_BUILD_TYPE Release CACHE STRING "") -set(RUNTIMES_${target}-fuchsia_CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE STRING "") -set(RUNTIMES_${target}-fuchsia_CMAKE_ASM_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE PATH "") -set(RUNTIMES_${target}-fuchsia_CMAKE_C_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE PATH "") -set(RUNTIMES_${target}-fuchsia_CMAKE_CXX_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE PATH "") -set(RUNTIMES_${target}-fuchsia_CMAKE_SHARED_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE PATH "") -set(RUNTIMES_${target}-fuchsia_CMAKE_MODULE_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE PATH "") -set(RUNTIMES_${target}-fuchsia_CMAKE_EXE_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE PATH "") +
[PATCH] D54026: [CMake][Fuchsia] Set -fuse-ld=lld explicitly for Linux runtimes
phosek added a comment. In https://reviews.llvm.org/D54026#1285754, @mcgrathr wrote: > So the default is not per-target? It should be. Agreed, although that'll require non-trivial driver changes. Repository: rC Clang https://reviews.llvm.org/D54026 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r346054 - [clangd] don't buffer the input-mirror stream, it's used to diagnose crashes
Author: sammccall Date: Fri Nov 2 16:47:55 2018 New Revision: 346054 URL: http://llvm.org/viewvc/llvm-project?rev=346054=rev Log: [clangd] don't buffer the input-mirror stream, it's used to diagnose crashes Modified: clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp Modified: clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp?rev=346054=346053=346054=diff == --- clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp (original) +++ clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp Fri Nov 2 16:47:55 2018 @@ -217,6 +217,8 @@ int main(int argc, char *argv[]) { if (EC) { InputMirrorStream.reset(); errs() << "Error while opening an input mirror file: " << EC.message(); +} else { + InputMirrorStream->SetUnbuffered(); } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [llvm-dev] mips builders on LLVM buildbot?
Hi Galina, I'm sad that they appear to have been abandoned but no objections from me as I'm not the admin for any of these anymore. A couple of them were taken over by a colleague when I left but he too has left MIPS since then. Simon Atanasyan might be able to find the owners if there still are any. > On Nov 2, 2018, at 13:29, Galina Kistanova via llvm-dev > wrote: > > Hello everyone, > > There are few abandoned mips builders on LLVM buildbot: > > llvm-mips-linux > clang-cmake-mipsel > clang-cmake-mips > > I am going to remove them, if anyone has any objections, please speak up! > > Thanks > > Galina > ___ > LLVM Developers mailing list > llvm-...@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D52794: [analyzer][PlistMacroExpansion] Part 2.: Retrieving the macro name and primitive expansion
Szelethus updated this revision to Diff 172459. Szelethus marked an inline comment as done. Szelethus added a comment. - Fixes according to @xazax.hun's observations Thanks! I'll commit when I have time watch buildbots. https://reviews.llvm.org/D52794 Files: lib/StaticAnalyzer/Core/PlistDiagnostics.cpp test/Analysis/Inputs/expected-plists/plist-macros-with-expansion.cpp.plist test/Analysis/plist-macros-with-expansion.cpp Index: test/Analysis/plist-macros-with-expansion.cpp === --- test/Analysis/plist-macros-with-expansion.cpp +++ test/Analysis/plist-macros-with-expansion.cpp @@ -27,8 +27,8 @@ *ptr = 5; // expected-warning{{Dereference of null pointer}} } -// CHECK: name -// CHECK-NEXT: expansion +// CHECK: nameSET_PTR_VAR_TO_NULL +// CHECK-NEXT: expansionptr = 0 #define NULL 0 #define SET_PTR_VAR_TO_NULL_WITH_NESTED_MACRO \ @@ -40,5 +40,109 @@ *ptr = 5; // expected-warning{{Dereference of null pointer}} } -// CHECK: name -// CHECK-NEXT: expansion +// CHECK: nameSET_PTR_VAR_TO_NULL_WITH_NESTED_MACRO +// CHECK-NEXT: expansionptr =0 + +//===--===// +// Tests for function-like macro expansions. +//===--===// + +void setToNull(int **vptr) { + *vptr = nullptr; +} + +#define TO_NULL(x) \ + setToNull(x) + +void functionLikeMacroTest() { + int *ptr; + TO_NULL(); + *ptr = 5; // expected-warning{{Dereference of null pointer}} +} + +// TODO: Expand arguments. +// CHECK: nameTO_NULL +// CHECK: expansionsetToNull(x) + +#define DOES_NOTHING(x) \ + { \ +int b; \ +b = 5; \ + } \ + print(x) + +#define DEREF(x) \ + DOES_NOTHING(x); \ + *x + +void functionLikeNestedMacroTest() { + int *a; + TO_NULL(); + DEREF(a) = 5; // expected-warning{{Dereference of null pointer}} +} + +// TODO: Expand arguments. +// CHECK: nameTO_NULL +// CHECK-NEXT: expansionsetToNull(x) + +// TODO: Expand arguments. +// CHECK: nameDEREF +// CHECK-NEXT: expansion{ int b; b = 5; } print(x); *x + +//===--===// +// Tests for undefining and/or redifining macros. +//===--===// + +#define WILL_UNDEF_SET_NULL_TO_PTR(ptr) \ + ptr = nullptr; + +void undefinedMacroByTheEndOfParsingTest() { + int *ptr; + WILL_UNDEF_SET_NULL_TO_PTR(ptr); + *ptr = 5; // expected-warning{{Dereference of null pointer}} +} + +#undef WILL_UNDEF_SET_NULL_TO_PTR + +// TODO: Expand arguments. +// CHECK: nameWILL_UNDEF_SET_NULL_TO_PTR +// CHECK-NEXT: expansionptr = nullptr; + +#define WILL_REDIFINE_MULTIPLE_TIMES_SET_TO_NULL(ptr) \ + /* Nothing */ +#undef WILL_REDIFINE_MULTIPLE_TIMES_SET_TO_NULL +#define WILL_REDIFINE_MULTIPLE_TIMES_SET_TO_NULL(ptr) \ + ptr = nullptr; + +void macroRedefinedMultipleTimesTest() { + int *ptr; + WILL_REDIFINE_MULTIPLE_TIMES_SET_TO_NULL(ptr) + *ptr = 5; // expected-warning{{Dereference of null pointer}} +} + +#undef WILL_REDIFINE_MULTIPLE_TIMES_SET_TO_NULL +#define WILL_REDIFINE_MULTIPLE_TIMES_SET_TO_NULL(ptr) \ + print("This string shouldn't be in the plist file at all. Or anywhere, " \ +"but here."); + +// TODO: Expand arguments. +// CHECK: nameWILL_REDIFINE_MULTIPLE_TIMES_SET_TO_NULL +// CHECK-NEXT: expansionptr = nullptr; + +#define WILL_UNDEF_SET_NULL_TO_PTR_2(ptr) \ + ptr = nullptr; + +#define PASS_PTR_TO_MACRO_THAT_WILL_BE_UNDEFD(ptr) \ + WILL_UNDEF_SET_NULL_TO_PTR_2(ptr) + +void undefinedMacroInsideAnotherMacroTest() { + int *ptr; + PASS_PTR_TO_MACRO_THAT_WILL_BE_UNDEFD(ptr); + *ptr = 5; // expected-warning{{Dereference of null pointer}} +} + +// TODO: Expand arguments. +// CHECK: namePASS_PTR_TO_MACRO_THAT_WILL_BE_UNDEFD +// CHECK-NEXT: expansionptr = nullptr; + +#undef WILL_UNDEF_SET_NULL_TO_PTR_2 Index: test/Analysis/Inputs/expected-plists/plist-macros-with-expansion.cpp.plist === --- test/Analysis/Inputs/expected-plists/plist-macros-with-expansion.cpp.plist +++ test/Analysis/Inputs/expected-plists/plist-macros-with-expansion.cpp.plist @@ -143,8 +143,8 @@ col3 file0 - name - expansion + nameSET_PTR_VAR_TO_NULL + expansionptr = 0 descriptionDereference of null pointer (loaded from variable ptr) @@ -312,8 +312,8 @@ col3 file0 - name - expansion + nameSET_PTR_VAR_TO_NULL_WITH_NESTED_MACRO + expansionptr =0 descriptionDereference of null pointer (loaded from variable ptr) @@ -342,10 +342,1047 @@ + + path + + + kindcontrol + edges + + +start + + + line58 + col3 + file0 + + +
[PATCH] D54055: CXXNameMangler::mangleFunctionParam: fix assertion
jfb added a comment. In https://reviews.llvm.org/D54055#1286196, @erik.pilkington wrote: > Can you give an example of some code that triggered this with your patch > applied? Even if it isn't a real reproducer right now, it would help to try > to understand whats happening here. Sure! I have code like this: `getStaticDeclName(CGM, D)` where `D` is `vla` in: void foo(int size) { int vla[size]; // ... } Repository: rC Clang https://reviews.llvm.org/D54055 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D54055: CXXNameMangler::mangleFunctionParam: fix assertion
erik.pilkington added a comment. Can you give an example of some code that triggered this with your patch applied? Even if it isn't a real reproducer right now, it would help to try to understand whats happening here. Repository: rC Clang https://reviews.llvm.org/D54055 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable
Eugene.Zelenko added inline comments. Comment at: docs/ReleaseNotes.rst:116 + + This check searches for those for loops which has a loop variable with + a "too small" type which means this type can't represent all values Please avoid This check, may be Detects? Same in documentation. Comment at: docs/ReleaseNotes.rst:116 + + This check searches for those `for` loops which has a loop variable with + a "too small" type which means this type can't represent all values Somehow for is still highlighted with single `, should be ``. Same in documentation. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D53974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D54055: CXXNameMangler::mangleFunctionParam: fix assertion
jfb added a comment. I'm not sure this is the right fix because mangling confuses me. It fixes the assertion I'm encountering in my patch, and I don't think I can create a repro without the patch (since I'm asking to mangle a local in a way we don't seem to right now). Repository: rC Clang https://reviews.llvm.org/D54055 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D54055: CXXNameMangler::mangleFunctionParam: fix assertion
jfb created this revision. jfb added a reviewer: rjmccall. Herald added subscribers: cfe-commits, dexonsmith. jfb added a comment. I'm not sure this is the right fix because mangling confuses me. It fixes the assertion I'm encountering in my patch, and I don't think I can create a repro without the patch (since I'm asking to mangle a local in a way we don't seem to right now). The assertion seemed to be trying to avoid subtracting from zero, but was missing a case. I have a patch which was trying to mangle a local (to promote to a global and keep a nice name to it), and it was triggering the assertion. Repository: rC Clang https://reviews.llvm.org/D54055 Files: lib/AST/ItaniumMangle.cpp Index: lib/AST/ItaniumMangle.cpp === --- lib/AST/ItaniumMangle.cpp +++ lib/AST/ItaniumMangle.cpp @@ -4300,7 +4300,9 @@ // Compute 'L'. // parmDepth does not include the declaring function prototype. // FunctionTypeDepth does account for that. - assert(parmDepth < FunctionTypeDepth.getDepth()); + assert(parmDepth < FunctionTypeDepth.getDepth() || + (parmDepth == FunctionTypeDepth.getDepth() && + !FunctionTypeDepth.isInResultType())); unsigned nestingDepth = FunctionTypeDepth.getDepth() - parmDepth; if (FunctionTypeDepth.isInResultType()) nestingDepth--; Index: lib/AST/ItaniumMangle.cpp === --- lib/AST/ItaniumMangle.cpp +++ lib/AST/ItaniumMangle.cpp @@ -4300,7 +4300,9 @@ // Compute 'L'. // parmDepth does not include the declaring function prototype. // FunctionTypeDepth does account for that. - assert(parmDepth < FunctionTypeDepth.getDepth()); + assert(parmDepth < FunctionTypeDepth.getDepth() || + (parmDepth == FunctionTypeDepth.getDepth() && + !FunctionTypeDepth.isInResultType())); unsigned nestingDepth = FunctionTypeDepth.getDepth() - parmDepth; if (FunctionTypeDepth.isInResultType()) nestingDepth--; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53856: [analyzer] Put llvm.Conventions back in alpha
NoQ added a comment. In https://reviews.llvm.org/D53856#1285373, @rnkovacs wrote: > In https://reviews.llvm.org/D53856#1280408, @Szelethus wrote: > > > In https://reviews.llvm.org/D53856#1279887, @NoQ wrote: > > > > > This might be also covered by @rnkovacs's string buffer escape checker - > > > either already or eventually, it'll become just yet another string view > > > API that the checker supports. > > > > > > I thought about that too, adding some `StringRef` specific information to > > that checker makes more sense then essentially duplicating the logic. > > However, what @MTC mentioned about `ArrayRef` would be a neat addition > > too, and maybe it isn't worth making `InnerPointerChecker` //that// general. > > > > @rnkovacs, any thoughts? > > > I agree, adding `StringRef` support to the buffer escape checker around the > time we add `string_view` will be great. Also, we named it > `InnerPointerChecker` to allow for covering more general structures in the > future, so I guess `ArrayRef`s may also be added eventually. Unfortunately, I > have some other tasks to finish before getting to these, so I think this > patch is fine now as-is. I also agree that we should generally try harder to determine common logic behind checkers. Eg., `MallocChecker` and `StreamChecker` should be the same checker, or at least re-use a large chunk of common code that implements the overall idea of "one function produces a symbol, then another function consumes it, and the consuming function always needs to be called on that symbol, while the symbol should not be used in certain (almost all) manners after it is consumed". Repository: rC Clang https://reviews.llvm.org/D53856 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53701: [Analyzer] Record and process comparison of symbols instead of iterator positions in interator checkers
NoQ added a comment. Ok, so what this code does is, eg., for a call of `i1.operator==(i2)` that returns a symbol `$x` of type `bool`, it conserves the sacred checker-specific knowledge that `$x` is in fact equal to `$offset(i1) == $offset(i2)`, where `$offset(i)` is the offset symbol within `IteratorPosition` to which iterator `i` is mapped. This looks like a renaming problem to me: what we really want to do is //rename// (i.e. update representation in the `SVal` hierarchy of) `$x` to `$offset(i1) == $offset(i2)`. And for now the single plausible approach to renaming problems in the Static Analyzer is to avoid them: //give the value a correct name from the start// so that you didn't have to rename it later. What this means is that instead of waiting until `checkPostCall` to obtain `$x` and then trying to rename it into `$offset(i1) == $offset(i2)`, we should `evalCall` the comparison operator to return `$offset(i1) == $offset(i2)`. So that the symbol with the wrong name (i.e., `$x`) didn't appear in the program state in the first place. The good thing about this approach is that it does not require any extra tracking at all - no comparison maps, no `evalAssume()`, nothing. The value is simply correct from the start. As a side effect, you will have a chance (though still not forced) to avoid redundant invalidation of Store during evaluation of the operator call. This is the correct behavior for at least STL containers and probably for all containers ever created by mankind. Though of course you never know. I.e., what if the code under analysis measures complexity of vector sort procedure and increments a global counter every time two iterators are compared within that procedure? But at least for STL/boost/LLVM/WebKit containers this is probably the right thing to do. *** Now, of course, `evalCall()` would suppress inlining. During `evalCall()` we currently do not know whether the function will be inlined or evaluated conservatively if none of the checkers evaluate it, but we can easily provide such information in `evalCall()`, so this is not a problem. The problem with inlining is that we got names for iterator offsets wrong from the start, because we conjured them out of thin air and they are conflicting with the actual representation of offsets within the implementation of the container. Which brings us back to a renaming problem: the problem of renaming `$offset(i1) == $offset(i2)` into the actual return value `$x` that was computed via inlining. Moreover, this new renaming problem is ill-formed because renaming non-atomic symbols doesn't make any sense - we should instead rename `$offset(i1)` and `$offset(i2)` separately. Still, the problem is indeed, as you already noticed, solved easily when `$x` is concrete: we only need to assume that `$offset(i1) == $offset(i2)` or `$offset(i1) != $offset(i2)` depending on the concrete value of `$x`. And if `$x` is symbolic, we could still //introduce a state split// here: on one branch both `$x` and `$offset(i1) == $offset(i2)` are false, on the other branch they both are true, and no additional tracking is ever be necessary. I believe that such state split is not invalid: it pretty much corresponds to the "eagerly assume" behavior, just for iterators. The question here is how much are we sure that both branches are possible. Even if neither inlining nor our custom iterator model managed to refute any of these two branches, one of the paths may still be infeasible. But the amount of error here is not larger than eagerly-assume, and for eagerly-assume it isn't that bad, so we could try. Of course, the alternative to state split is assuming things about `($offset(i1) == $offset(i2)) == $x`, but our constraint solver will not be able to handle such constraints, which is the very reason why we have problems with renaming (well, at least some of them; renaming temporary regions in C++ is slightly more complicated than that (understatement intended)). In fact, i think the reasoning behind having eager assumptions for numbers is exactly that: they wanted to make constraints simpler. *** But still, i want to step back and ask the question that i really really want answered here: //if container methods are inlinable, do we actually want to track iterator positions manually?// Maybe just rely on inlining entirely when possible? Like, both for modeling and for bug-finding. Or only rely on `evalCall()`? Essentially, if inlining is not reliable enough for relying on it entirely (so we have to maintain a parallel checker-specific model of iterators and have these two models exchange information), why do we think that it is reliable enough for the purpose of evaluating iterator comparisons? This question is in fact asked and answered, one way or another, intentionally or accidentally, with different levels of urgency, in every checker that tries to model effects of function calls. The most famous example of
[PATCH] D51531: [analyzer][UninitializedObjectChecker] Uninit regions are only reported once
Szelethus added a comment. Oh, and the reason why I think it would add a lot of complication: since only `ExprEngine` is avaible in the `checkEndAnalysis` callback, which, from what I can see, doesn't have a handly `isDead` method, so I'm not even sure how I'd implement it. https://reviews.llvm.org/D51531 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51531: [analyzer][UninitializedObjectChecker] Uninit regions are only reported once
Szelethus added a comment. Sorry for the late reply. I'm not actually super confident about this idea, I don't think it would add much value, compared to how complicated it would make things. This patch reduces report by a significant amount when pointer chasing is enabled, but a global set might make things that much cleaner -- if the same report would be made on different execution paths, it would be uniqued with the help of the uniqueing location. If it it wouldn't be, I guess it shouldn't be. Of course, I'm always open to a discussion! https://reviews.llvm.org/D51531 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r346048 - Add an explicit -std=c++14 to this test.
Author: adrian Date: Fri Nov 2 15:19:02 2018 New Revision: 346048 URL: http://llvm.org/viewvc/llvm-project?rev=346048=rev Log: Add an explicit -std=c++14 to this test. rdar://problem/45642490 Modified: cfe/trunk/test/Modules/lsv-debuginfo.cpp Modified: cfe/trunk/test/Modules/lsv-debuginfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/lsv-debuginfo.cpp?rev=346048=346047=346048=diff == --- cfe/trunk/test/Modules/lsv-debuginfo.cpp (original) +++ cfe/trunk/test/Modules/lsv-debuginfo.cpp Fri Nov 2 15:19:02 2018 @@ -1,7 +1,7 @@ // Test C++ -gmodules debug info in the PCMs with local submodule visibility. // REQUIRES: asserts // RUN: rm -rf %t -// RUN: %clang_cc1 -triple %itanium_abi_triple\ +// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++14 \ // RUN: -fmodules-local-submodule-visibility %s \ // RUN: -dwarf-ext-refs -fmodule-format=obj -debug-info-kind=standalone \ // RUN: -dwarf-version=4 -fmodules -fimplicit-module-maps \ @@ -10,13 +10,13 @@ // RUN: cat %t-mod.ll | FileCheck %s // RUN: rm -rf %t -// RUN: %clang_cc1 -triple %itanium_abi_triple\ +// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++14 \ // RUN: -fmodules-local-submodule-visibility %s \ // RUN: -dwarf-ext-refs -fmodule-format=obj -debug-info-kind=standalone \ // RUN: -dwarf-version=4 -fmodules -fimplicit-module-maps \ // RUN: -fmodules-cache-path="%t" -o %t.ll -I%S/Inputs/lsv-debuginfo \ -// RUN: -mllvm -debug-only=pchcontainer &>%t-mod.ll \ -// RUN: -DWITH_NAMESPACE +// RUN: -DWITH_NAMESPACE \ +// RUN: -mllvm -debug-only=pchcontainer &>%t-mod.ll // RUN: cat %t-mod.ll | FileCheck %s // ADT ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53912: [Headers] [MS] Add intrin0.h
STL_MSFT added a comment. Yes, the "real builtin" approach seems to be best. For a recent example, https://reviews.llvm.org/D49606 added `__shiftright128` as an inline function in intrin.h, but that didn't work with MSVC's STL when I moved our declaration of `__shiftright128` from intrin.h to intrin0.h. This was fixed by https://reviews.llvm.org/D50907 making `__shiftright128` a real builtin. For the record, MSVC's intrin.h declares ~880 intrinsics (plus many many more from immintrin.h etc.) and it includes intrin0.h to get the declarations of ~130 intrinsics. There is no duplication - each intrinsic is declared in either the small intrin0.h or the large intrin.h. MSVC's STL then includes intrin0.h in its headers for increased throughput. We occasionally move intrinsics from intrin.h to intrin0.h as we discover that they're needed in the STL (as we've recently done for `__shiftright128`, `_umul128`, `_BitScanForward[64]`, and `_BitScanReverse[64]`). Repository: rC Clang https://reviews.llvm.org/D53912 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable
ztamas marked 3 inline comments as done. ztamas added inline comments. Comment at: test/clang-tidy/bugprone-too-small-loop-variable.cpp:6 +void voidBadForLoop() { + for (int i = 0; i < size(); ++i) { +// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has a narrower type ('int') than the type ('long') of termination condition [bugprone-too-small-loop-variable] JonasToth wrote: > ztamas wrote: > > JonasToth wrote: > > > please add tests where the rhs is a literal. > > Do you mean tests like voidForLoopWithLiteralCond()? > > Is it worth to add more tests like that? > I didn't see it. In principle yes, but i would like to see a test with a > bigger number then iterateable (maybe there is a frontend warning for that?). > If there is no warning, this should definitely be implemented here (possible > follow up) or even become a frontend warning. I added a test case. This kind of test cases are caught by -Wtautological-constant-out-of-range-compare, so we are good I think. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D53974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable
ztamas updated this revision to Diff 172436. ztamas added a comment. - Use StringRef instead of char[] - Add test cases about big constant / literal / enum values Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D53974 Files: clang-tidy/bugprone/BugproneTidyModule.cpp clang-tidy/bugprone/CMakeLists.txt clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp clang-tidy/bugprone/TooSmallLoopVariableCheck.h docs/ReleaseNotes.rst docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst docs/clang-tidy/checks/list.rst test/clang-tidy/bugprone-too-small-loop-variable.cpp Index: test/clang-tidy/bugprone-too-small-loop-variable.cpp === --- /dev/null +++ test/clang-tidy/bugprone-too-small-loop-variable.cpp @@ -0,0 +1,184 @@ +// RUN: %check_clang_tidy %s bugprone-too-small-loop-variable %t + +long size() { return 294967296l; } + +void voidBadForLoop() { + for (int i = 0; i < size(); ++i) { +// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable] + } +} + +void voidBadForLoop2() { + for (int i = 0; i < size() + 10; ++i) { +// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable] + } +} + +void voidBadForLoop3() { + for (int i = 0; i <= size() - 1; ++i) { +// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable] + } +} + +void voidBadForLoop4() { + for (int i = 0; size() > i; ++i) { +// CHECK-MESSAGES: :[[@LINE-1]]:28: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable] + } +} + +void voidBadForLoop5() { + for (int i = 0; size() - 1 >= i; ++i) { +// CHECK-MESSAGES: :[[@LINE-1]]:33: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable] + } +} + +void voidBadForLoop6() { + int i = 0; + for (; i < size(); ++i) { +// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable] + } +} + +void voidForLoopUnsignedCond() { + unsigned size = 3147483647; + for (int i = 0; i < size; ++i) { +// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has narrower type 'int' than terminating condition 'unsigned int' [bugprone-too-small-loop-variable] + } +} + +// False positive: because of the integer literal, loop condition has int type +void voidForLoopFalsePositive() { + short size = 3; + bool cond = false; + for (short i = 0; i < (cond ? 0 : size); ++i) { +// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: loop variable has narrower type 'short' than terminating condition 'int' [bugprone-too-small-loop-variable] + } +} + +// Simple use case when both expressions have the same type +void voidGoodForLoop() { + for (long i = 0; i < size(); ++i) { + } // no warning +} + +// Second simple use case when both expressions have the same type +void voidGoodForLoop2() { + short loopCond = 10; + for (short i = 0; i < loopCond; ++i) { + } // no warning +} + +// Because of the integer literal, the loop condition is int, but we suppress the warning here +void voidForLoopShortPlusLiteral() { + short size = 3; + for (short i = 0; i <= (size - 1); ++i) { + } // no warning +} + +// Additions of two short variable is converted to int, but we suppress this to avoid false positives +void voidForLoopShortPlusShort() { + short size = 256; + short increment = 14; + for (short i = 0; i < size + increment; ++i) { + } // no warning +} + +// Different integer types, but in this case the loop variable is the bigger type +void voidForLoopReverseCond() { + short start = 256; + short end = 14; + for (int i = start; i >= end; --i) { + } // no warning +} + +// TODO: handle while loop +void voidBadWhileLoop() { + short i = 0; + while (i < size()) { // missing warning +++i; + } +} + +// TODO: handle do-while loop +void voidBadDoWhileLoop() { + short i = 0; + do { +++i; + } while (i < size()); // missing warning +} + +// Test case with a reverse iteration +// This is caught by -Wimplicit-int-conversion +void voidReverseForLoop() { + for (short i = size() - 1; i >= 0; --i) { // no warning + } +} + +// TODO: handle complex loop conditions +void voidComplexForCond() { + bool additionalCond = true; + for (int i = 0; i < size() && additionalCond; ++i) { // missing warning + } +} + +// Macro in loop condition +#define SIZE 125 +#define SIZE2 (SIZE + 1) +void voidForLoopWithMacroCond() { + for (short i = 0; i < SIZE2; ++i) { // no warning + } +} + +// Literal in loop condition +void voidForLoopWithLiteralCond() { + for (short i = 0; i < 125; ++i) { // no warning + } +} + +// "Big" literal in
r346044 - [COFF, ARM64] Implement InterlockedExchange*_* builtins
Author: mgrang Date: Fri Nov 2 14:18:23 2018 New Revision: 346044 URL: http://llvm.org/viewvc/llvm-project?rev=346044=rev Log: [COFF, ARM64] Implement InterlockedExchange*_* builtins Summary: Windows SDK needs these intrinsics to be proper builtins. This is second in a series of patches to move intrinsic defintions out of intrin.h. Reviewers: rnk, mstorsjo, efriedma, TomTan Reviewed By: rnk, efriedma Subscribers: javed.absar, kristof.beyls, chrib, jfb, kristina, cfe-commits Differential Revision: https://reviews.llvm.org/D54046 Modified: cfe/trunk/include/clang/Basic/BuiltinsAArch64.def cfe/trunk/include/clang/Basic/BuiltinsARM.def cfe/trunk/lib/CodeGen/CGBuiltin.cpp cfe/trunk/lib/Headers/intrin.h cfe/trunk/test/CodeGen/ms-intrinsics.c Modified: cfe/trunk/include/clang/Basic/BuiltinsAArch64.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsAArch64.def?rev=346044=346043=346044=diff == --- cfe/trunk/include/clang/Basic/BuiltinsAArch64.def (original) +++ cfe/trunk/include/clang/Basic/BuiltinsAArch64.def Fri Nov 2 14:18:23 2018 @@ -117,6 +117,19 @@ TARGET_HEADER_BUILTIN(_InterlockedExchan TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd64_rel, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd64_nf, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange8_acq, "ccD*c", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange8_nf, "ccD*c", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange8_rel, "ccD*c", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange16_acq, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange16_nf, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange16_rel, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange_acq, "LiLiD*Li","nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange_nf,"LiLiD*Li","nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange_rel, "LiLiD*Li","nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange64_acq, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange64_nf, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange64_rel, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") + TARGET_HEADER_BUILTIN(_ReadWriteBarrier, "v", "nh", "intrin.h", ALL_MS_LANGUAGES, "") TARGET_HEADER_BUILTIN(__getReg, "ULLii", "nh", "intrin.h", ALL_MS_LANGUAGES, "") TARGET_HEADER_BUILTIN(_ReadStatusReg, "ii", "nh", "intrin.h", ALL_MS_LANGUAGES, "") Modified: cfe/trunk/include/clang/Basic/BuiltinsARM.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsARM.def?rev=346044=346043=346044=diff == --- cfe/trunk/include/clang/Basic/BuiltinsARM.def (original) +++ cfe/trunk/include/clang/Basic/BuiltinsARM.def Fri Nov 2 14:18:23 2018 @@ -243,6 +243,19 @@ TARGET_HEADER_BUILTIN(_InterlockedExchan TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd64_rel, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd64_nf, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange8_acq, "ccD*c", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange8_nf, "ccD*c", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange8_rel, "ccD*c", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange16_acq, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange16_nf, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange16_rel, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange_acq, "LiLiD*Li","nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange_nf,"LiLiD*Li","nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange_rel, "LiLiD*Li","nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange64_acq, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange64_nf, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange64_rel, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") + #undef BUILTIN #undef
[PATCH] D54046: [COFF, ARM64] Implement InterlockedExchange*_* builtins
This revision was automatically updated to reflect the committed changes. Closed by commit rL346044: [COFF, ARM64] Implement InterlockedExchange*_* builtins (authored by mgrang, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D54046?vs=172425=172432#toc Repository: rL LLVM https://reviews.llvm.org/D54046 Files: cfe/trunk/include/clang/Basic/BuiltinsAArch64.def cfe/trunk/include/clang/Basic/BuiltinsARM.def cfe/trunk/lib/CodeGen/CGBuiltin.cpp cfe/trunk/lib/Headers/intrin.h cfe/trunk/test/CodeGen/ms-intrinsics.c Index: cfe/trunk/include/clang/Basic/BuiltinsAArch64.def === --- cfe/trunk/include/clang/Basic/BuiltinsAArch64.def +++ cfe/trunk/include/clang/Basic/BuiltinsAArch64.def @@ -117,6 +117,19 @@ TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd64_rel, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd64_nf, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange8_acq, "ccD*c", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange8_nf, "ccD*c", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange8_rel, "ccD*c", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange16_acq, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange16_nf, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange16_rel, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange_acq, "LiLiD*Li","nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange_nf,"LiLiD*Li","nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange_rel, "LiLiD*Li","nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange64_acq, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange64_nf, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange64_rel, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") + TARGET_HEADER_BUILTIN(_ReadWriteBarrier, "v", "nh", "intrin.h", ALL_MS_LANGUAGES, "") TARGET_HEADER_BUILTIN(__getReg, "ULLii", "nh", "intrin.h", ALL_MS_LANGUAGES, "") TARGET_HEADER_BUILTIN(_ReadStatusReg, "ii", "nh", "intrin.h", ALL_MS_LANGUAGES, "") Index: cfe/trunk/include/clang/Basic/BuiltinsARM.def === --- cfe/trunk/include/clang/Basic/BuiltinsARM.def +++ cfe/trunk/include/clang/Basic/BuiltinsARM.def @@ -243,6 +243,19 @@ TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd64_rel, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd64_nf, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange8_acq, "ccD*c", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange8_nf, "ccD*c", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange8_rel, "ccD*c", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange16_acq, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange16_nf, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange16_rel, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange_acq, "LiLiD*Li","nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange_nf,"LiLiD*Li","nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange_rel, "LiLiD*Li","nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange64_acq, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange64_nf, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedExchange64_rel, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") + #undef BUILTIN #undef LANGBUILTIN #undef TARGET_HEADER_BUILTIN Index: cfe/trunk/test/CodeGen/ms-intrinsics.c === --- cfe/trunk/test/CodeGen/ms-intrinsics.c +++ cfe/trunk/test/CodeGen/ms-intrinsics.c @@ -698,6 +698,90 @@ // CHECK-ARM-ARM64: ret i64 [[RESULT:%[0-9]+]] // CHECK-ARM-ARM64: } +char test_InterlockedExchange8_acq(char volatile *value, char mask) { + return _InterlockedExchange8_acq(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i8 @test_InterlockedExchange8_acq(i8*{{[a-z_ ]*}}%value, i8{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xchg i8*
[PATCH] D53780: Fix bitcast to address space cast for coerced load/stores
david-salinas updated this revision to Diff 172261. david-salinas added a comment. As per rjmccall's comments, changed the call to CreatePointerBitCastOrAddrSpaceCast back to a call to CreateBitCast, but now we're casting to the int8* with the address space of the target. https://reviews.llvm.org/D53780 Files: lib/CodeGen/CGCall.cpp test/CodeGenCXX/address-space-cast-coerce.cpp Index: test/CodeGenCXX/address-space-cast-coerce.cpp === --- /dev/null +++ test/CodeGenCXX/address-space-cast-coerce.cpp @@ -0,0 +1,81 @@ +// RUN: %clang_cc1 %s -triple=amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck %s + +template struct my_vector_base; + +template +struct my_vector_base { +typedef T Native_vec_ __attribute__((ext_vector_type(1))); + +union { +Native_vec_ data; +struct { +T x; +}; +}; +}; + +template +struct my_vector_type : public my_vector_base { +using my_vector_base::data; +using typename my_vector_base::Native_vec_; + +template< typename U> +__attribute__((cpu)) __attribute__((hc)) +my_vector_type(U x) noexcept +{ +for (auto i = 0u; i != rank; ++i) data[i] = x; +} +__attribute__((cpu)) __attribute__((hc)) +my_vector_type& operator+=(const my_vector_type& x) noexcept +{ +data += x.data; +return *this; +} +}; + +template +__attribute__((cpu)) __attribute__((hc)) +inline +my_vector_type operator+( +const my_vector_type& x, const my_vector_type& y) noexcept +{ +return my_vector_type{x} += y; +} + +using char1 = my_vector_type; + +int main() { + +char1 f1{1}; +char1 f2{1}; + +// CHECK: %[[a:[^ ]+]] = addrspacecast i16 addrspace(5)* %{{[^ ]+}} to i16* +// CHECK: %[[a:[^ ]+]] = addrspacecast %{{[^ ]+}} addrspace(5)* %{{[^ ]+}} to %{{[^ ]+}} + +char1 f3 = f1 + f2; +} + +/* + +Look for this: +HECK: %4 = addrspacecast i16 addrspace(5)* %tmp to i16* +HECK: %5 = addrspacecast %struct.my_vector_type* addrspace(5)* %this.addr.i to %struct.my_vector_type** + +FAIL< +pass> +38,39c38,39 +< %5 = bitcast i16* %4 to i8 addrspace(5)* +< %6 = bitcast <1 x i8>* %coerce.dive2 to i8 addrspace(5)* +--- +> %5 = addrspacecast i16* %4 to i8 addrspace(5)* +> %6 = addrspacecast <1 x i8>* %coerce.dive2 to i8 addrspace(5)* +86,87c86,87 +< %11 = bitcast i16* %4 to i8 addrspace(5)* +< %12 = bitcast <1 x i8>* %coerce.dive2 to i8 addrspace(5)* +--- +> %11 = addrspacecast i16* %4 to i8 addrspace(5)* +> %12 = addrspacecast <1 x i8>* %coerce.dive2 to i8 addrspace(5)* + + +*/ + Index: lib/CodeGen/CGCall.cpp === --- lib/CodeGen/CGCall.cpp +++ lib/CodeGen/CGCall.cpp @@ -1253,8 +1253,8 @@ // Otherwise do coercion through memory. This is stupid, but simple. Address Tmp = CreateTempAllocaForCoercion(CGF, Ty, Src.getAlignment()); - Address Casted = CGF.Builder.CreateBitCast(Tmp, CGF.AllocaInt8PtrTy); - Address SrcCasted = CGF.Builder.CreateBitCast(Src, CGF.AllocaInt8PtrTy); + Address Casted = CGF.Builder.CreateBitCast(Tmp, CGF.Int8Ty->getPointerTo(Tmp.getAddressSpace())); + Address SrcCasted = CGF.Builder.CreateBitCast(Src, CGF.Int8Ty->getPointerTo(Src.getAddressSpace())); CGF.Builder.CreateMemCpy(Casted, SrcCasted, llvm::ConstantInt::get(CGF.IntPtrTy, SrcSize), false); @@ -1335,8 +1335,8 @@ // to that information. Address Tmp = CreateTempAllocaForCoercion(CGF, SrcTy, Dst.getAlignment()); CGF.Builder.CreateStore(Src, Tmp); -Address Casted = CGF.Builder.CreateBitCast(Tmp, CGF.AllocaInt8PtrTy); -Address DstCasted = CGF.Builder.CreateBitCast(Dst, CGF.AllocaInt8PtrTy); +Address Casted = CGF.Builder.CreateBitCast(Tmp,CGF.Int8Ty->getPointerTo(Tmp.getAddressSpace()) ); +Address DstCasted = CGF.Builder.CreateBitCast(Dst, CGF.Int8Ty->getPointerTo(Dst.getAddressSpace())); CGF.Builder.CreateMemCpy(DstCasted, Casted, llvm::ConstantInt::get(CGF.IntPtrTy, DstSize), false); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D54048: [AST] Get aliased type info from an aliased TemplateSpecialization.
mattd created this revision. mattd added reviewers: aaron.ballman, rjmccall. Previously the TemplateSpecialization instance for 'template_alias', in the example below, returned the type info of the canonical type (int). This ignored the type alias if the template type happen to be aliased. Before this patch, the assert would trigger with an alignment of 4: typedef int __attribute__(( aligned( 16 ) )) aligned_int; template < typename > using template_alias = aligned_int; static_assert( alignof( template_alias) == 16, "" ); This patch checks if the TemplateSpecialization type has an alias, and if so will return the type information for the aliased type, else the canonical type's info is returned (original behavior). I believe that this is the desired behavior. https://reviews.llvm.org/D54048 Files: include/clang/AST/TypeNodes.def lib/AST/ASTContext.cpp lib/AST/Type.cpp test/SemaCXX/alignof.cpp Index: test/SemaCXX/alignof.cpp === --- test/SemaCXX/alignof.cpp +++ test/SemaCXX/alignof.cpp @@ -97,3 +97,8 @@ typedef __attribute__((aligned(N))) int Field[sizeof(N)]; // expected-error {{requested alignment is dependent but declaration is not dependent}} }; } + +typedef int __attribute__(( aligned( 16 ) )) aligned_int; +template < typename > +using template_alias = aligned_int; +static_assert( alignof( template_alias) == 16, "alignof(template_alias<>) is incorrect" ); Index: lib/AST/Type.cpp === --- lib/AST/Type.cpp +++ lib/AST/Type.cpp @@ -3481,6 +3481,7 @@ case Type::Auto: case Type::DeducedTemplateSpecialization: + case Type::TemplateSpecialization: // Give non-deduced 'auto' types external linkage. We should only see them // here in error recovery. return CachedProperties(ExternalLinkage, false); @@ -3587,6 +3588,7 @@ case Type::Auto: case Type::DeducedTemplateSpecialization: + case Type::TemplateSpecialization: return LinkageInfo::external(); case Type::Record: Index: lib/AST/ASTContext.cpp === --- lib/AST/ASTContext.cpp +++ lib/AST/ASTContext.cpp @@ -1990,6 +1990,12 @@ return getTypeInfo(A->getDeducedType().getTypePtr()); } + case Type::TemplateSpecialization: { +const auto *TS = cast(T); +return TS->isTypeAlias() ? getTypeInfo(TS->getAliasedType().getTypePtr()) + : getTypeInfo(TS->desugar().getTypePtr()); + } + case Type::Paren: return getTypeInfo(cast(T)->getInnerType().getTypePtr()); @@ -6926,6 +6932,7 @@ // We could see an undeduced auto type here during error recovery. // Just ignore it. case Type::Auto: + case Type::TemplateSpecialization: case Type::DeducedTemplateSpecialization: return; @@ -8738,6 +8745,7 @@ llvm_unreachable("Non-canonical and dependent types shouldn't get here"); case Type::Auto: + case Type::TemplateSpecialization: case Type::DeducedTemplateSpecialization: case Type::LValueReference: case Type::RValueReference: Index: include/clang/AST/TypeNodes.def === --- include/clang/AST/TypeNodes.def +++ include/clang/AST/TypeNodes.def @@ -97,7 +97,7 @@ DEPENDENT_TYPE(TemplateTypeParm, Type) NON_CANONICAL_TYPE(SubstTemplateTypeParm, Type) DEPENDENT_TYPE(SubstTemplateTypeParmPack, Type) -NON_CANONICAL_UNLESS_DEPENDENT_TYPE(TemplateSpecialization, Type) +TYPE(TemplateSpecialization, Type) ABSTRACT_TYPE(Deduced, Type) TYPE(Auto, DeducedType) TYPE(DeducedTemplateSpecialization, DeducedType) Index: test/SemaCXX/alignof.cpp === --- test/SemaCXX/alignof.cpp +++ test/SemaCXX/alignof.cpp @@ -97,3 +97,8 @@ typedef __attribute__((aligned(N))) int Field[sizeof(N)]; // expected-error {{requested alignment is dependent but declaration is not dependent}} }; } + +typedef int __attribute__(( aligned( 16 ) )) aligned_int; +template < typename > +using template_alias = aligned_int; +static_assert( alignof( template_alias) == 16, "alignof(template_alias<>) is incorrect" ); Index: lib/AST/Type.cpp === --- lib/AST/Type.cpp +++ lib/AST/Type.cpp @@ -3481,6 +3481,7 @@ case Type::Auto: case Type::DeducedTemplateSpecialization: + case Type::TemplateSpecialization: // Give non-deduced 'auto' types external linkage. We should only see them // here in error recovery. return CachedProperties(ExternalLinkage, false); @@ -3587,6 +3588,7 @@ case Type::Auto: case Type::DeducedTemplateSpecialization: + case Type::TemplateSpecialization: return LinkageInfo::external(); case Type::Record: Index: lib/AST/ASTContext.cpp === --- lib/AST/ASTContext.cpp +++
[PATCH] D52421: [Sema] Diagnose parameter names that shadow inherited field names
aaron.ballman closed this revision. aaron.ballman added a comment. I've commit in r346041. https://reviews.llvm.org/D52421 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r346041 - Diagnose parameter names that shadow the names of inherited fields under -Wshadow-field.
Author: aaronballman Date: Fri Nov 2 14:04:44 2018 New Revision: 346041 URL: http://llvm.org/viewvc/llvm-project?rev=346041=rev Log: Diagnose parameter names that shadow the names of inherited fields under -Wshadow-field. This addresses PR34120. Note, unlike GCC, we take into account the accessibility of the field when deciding whether to warn or not. Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/Sema/SemaDecl.cpp cfe/trunk/lib/Sema/SemaDeclCXX.cpp cfe/trunk/test/SemaCXX/warn-shadow.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=346041=346040=346041=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Nov 2 14:04:44 2018 @@ -9467,16 +9467,15 @@ def warn_block_literal_qualifiers_on_omi InGroup; def ext_warn_gnu_final : ExtWarn< - "__final is a GNU extension, consider using C++11 final">, - InGroup; - -def warn_shadow_field : - Warning<"non-static data member %0 of %1 shadows member inherited from " - "type %2">, - InGroup, DefaultIgnore; -def note_shadow_field : Note<"declared here">; - -def err_multiversion_required_in_redecl : Error< + "__final is a GNU extension, consider using C++11 final">, + InGroup; + +def warn_shadow_field : Warning< + "%select{parameter|non-static data member}3 %0 %select{|of %1 }3shadows " + "member inherited from type %2">, InGroup, DefaultIgnore; +def note_shadow_field : Note<"declared here">; + +def err_multiversion_required_in_redecl : Error< "function declaration is missing %select{'target'|'cpu_specific' or " "'cpu_dispatch'}0 attribute in a multiversioned function">; def note_multiversioning_caused_here : Note< Modified: cfe/trunk/include/clang/Sema/Sema.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=346041=346040=346041=diff == --- cfe/trunk/include/clang/Sema/Sema.h (original) +++ cfe/trunk/include/clang/Sema/Sema.h Fri Nov 2 14:04:44 2018 @@ -10588,7 +10588,8 @@ private: /// Check if there is a field shadowing. void CheckShadowInheritedFields(const SourceLocation , DeclarationName FieldName, - const CXXRecordDecl *RD); + const CXXRecordDecl *RD, + bool DeclIsField = true); /// Check if the given expression contains 'break' or 'continue' /// statement that produces control flow different from GCC. Modified: cfe/trunk/lib/Sema/SemaDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=346041=346040=346041=diff == --- cfe/trunk/lib/Sema/SemaDecl.cpp (original) +++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Nov 2 14:04:44 2018 @@ -12366,6 +12366,13 @@ Decl *Sema::ActOnParamDeclarator(Scope * D.setInvalidType(true); } } + +if (LangOpts.CPlusPlus) { + DeclarationNameInfo DNI = GetNameForDeclarator(D); + if (auto *RD = dyn_cast(CurContext)) +CheckShadowInheritedFields(DNI.getLoc(), DNI.getName(), RD, + /*DeclIsField*/ false); +} } // Temporarily put parameter variables in the translation unit, not Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=346041=346040=346041=diff == --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original) +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri Nov 2 14:04:44 2018 @@ -2832,13 +2832,14 @@ static const ParsedAttr *getMSPropertyAt return nullptr; } -// Check if there is a field shadowing. -void Sema::CheckShadowInheritedFields(const SourceLocation , - DeclarationName FieldName, - const CXXRecordDecl *RD) { - if (Diags.isIgnored(diag::warn_shadow_field, Loc)) -return; - +// Check if there is a field shadowing. +void Sema::CheckShadowInheritedFields(const SourceLocation , + DeclarationName FieldName, + const CXXRecordDecl *RD, + bool DeclIsField) { + if (Diags.isIgnored(diag::warn_shadow_field, Loc)) +return; + // To record a shadowed field in a base std::map Bases; auto FieldShadowed = [&](const CXXBaseSpecifier *Specifier, @@ -2872,13 +2873,13 @@ void Sema::CheckShadowInheritedFields(co continue; auto BaseField = It->second;
[PATCH] D54047: Check TUScope is valid before use
trixirt created this revision. trixirt added reviewers: rsmith, stephenkelly. Herald added a subscriber: cfe-commits. Include-what-you-use crashes when run against llvm because of late use of TUScope. The testcase is https://github.com/trixirt/include-what-you-use/commit/dfec8cf07015fb5fe2db10df2f0a005250953131 Enabling incremental processing, fixes this problem but causes 3 regression in iwyu. https://github.com/include-what-you-use/include-what-you-use/pull/586 So the fix is moving to clang. Repository: rC Clang https://reviews.llvm.org/D54047 Files: lib/Sema/SemaExpr.cpp Index: lib/Sema/SemaExpr.cpp === --- lib/Sema/SemaExpr.cpp +++ lib/Sema/SemaExpr.cpp @@ -905,6 +905,10 @@ UnqualifiedId Name; Name.setIdentifier(PP.getIdentifierInfo("__builtin_trap"), E->getBeginLoc()); + +if (TUScope == nullptr) + return ExprError(); + ExprResult TrapFn = ActOnIdExpression(TUScope, SS, TemplateKWLoc, Name, true, false); if (TrapFn.isInvalid()) Index: lib/Sema/SemaExpr.cpp === --- lib/Sema/SemaExpr.cpp +++ lib/Sema/SemaExpr.cpp @@ -905,6 +905,10 @@ UnqualifiedId Name; Name.setIdentifier(PP.getIdentifierInfo("__builtin_trap"), E->getBeginLoc()); + +if (TUScope == nullptr) + return ExprError(); + ExprResult TrapFn = ActOnIdExpression(TUScope, SS, TemplateKWLoc, Name, true, false); if (TrapFn.isInvalid()) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53912: [Headers] [MS] Add intrin0.h
rnk added a subscriber: STL_MSFT. rnk added a comment. In https://reviews.llvm.org/D53912#1284804, @azharudd wrote: > I agree. This currently resolves issues with building for ARM64 target using > Visual Studio 2017. The missing intrinsics it complains about are already > present in intrin.h. We could add those to intrin0.h too but that would > duplicate. Please let me know what you think. I see that more intrinsics are being added as builtins in https://reviews.llvm.org/D54046. I think that's a good future direction. We should do our best not to add new headers to shadow CRT and SDK headers anymore. +@STL_MSFT Repository: rC Clang https://reviews.llvm.org/D53912 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable
Szelethus added a comment. In https://reviews.llvm.org/D53974#1283759, @ZaMaZaN4iK wrote: > Hmm, i thought Clang has some warning for this, but I was wrong... Did you > think to implement this check as Clang warning? That is an interesting point actually -- maybe it'd be worth doing that, and if more powerful analysis is required, Static Analyzer would be the next step. I haven't actually implemented any 'regular' clang warning, so I'm not sure. Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:109 + +if (RHSE->isInstantiationDependent() || LHSE->isInstantiationDependent()) + return 0; You seem to have code for handling templates, but I don't see test cases for it. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D53974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D54046: [COFF, ARM64] Implement InterlockedExchange*_* builtins
rnk accepted this revision. rnk added a comment. lgtm Repository: rC Clang https://reviews.llvm.org/D54046 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable
JonasToth added inline comments. Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:20 + +static const char LoopName[] = "forLoopName"; +static const char loopVarName[] = "loopVar"; ztamas wrote: > JonasToth wrote: > > Please move these variable in the matcher function and make them > > `StringRef` instead of `const char[]`. > These variables are used not only inside the matcher function but also in the > check() function. > I didn't see that, but they should still be `StringRef` as type. Comment at: test/clang-tidy/bugprone-too-small-loop-variable.cpp:6 +void voidBadForLoop() { + for (int i = 0; i < size(); ++i) { +// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has a narrower type ('int') than the type ('long') of termination condition [bugprone-too-small-loop-variable] ztamas wrote: > JonasToth wrote: > > please add tests where the rhs is a literal. > Do you mean tests like voidForLoopWithLiteralCond()? > Is it worth to add more tests like that? I didn't see it. In principle yes, but i would like to see a test with a bigger number then iterateable (maybe there is a frontend warning for that?). If there is no warning, this should definitely be implemented here (possible follow up) or even become a frontend warning. Comment at: test/clang-tidy/bugprone-too-small-loop-variable.cpp:152 +void voidForLoopWithEnumCond() { + for (short i = eSizeType::START; i < eSizeType::END; ++i) { + } // no warning ztamas wrote: > JonasToth wrote: > > It is possible to specify the underlying type of an `enum`. > > For the case `enum eSizeType2 : int;` the problem does occur as well. I > > think especially this case is tricky to spot manually and should be handled > > too. What do you think? > Hmm, it can be handled I think. However, I'm not sure how often it is, that > an enum has an item value bigger than 32767 (short) or 65535 (unsigned short) > or another even bigger value. > For now, I think it's better to just ignore these cases to avoid false > positives and keep the first version of the check simple. The scope can be > extended anytime later I think. `enum` values can become very big for flag-enums ``` enum Foo { value1 = 1 << 1; // ... value 24 = 1 << 24; }; ``` You should still add a test for a `enum` with specified underlying type to ensure, there is no noise. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D53974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D54046: [COFF, ARM64] Implement InterlockedExchange*_* builtins
efriedma accepted this revision. efriedma added a comment. This revision is now accepted and ready to land. LGTM Repository: rC Clang https://reviews.llvm.org/D54046 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable
ztamas marked 16 inline comments as done. ztamas added inline comments. Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:20 + +static const char LoopName[] = "forLoopName"; +static const char loopVarName[] = "loopVar"; JonasToth wrote: > Please move these variable in the matcher function and make them `StringRef` > instead of `const char[]`. These variables are used not only inside the matcher function but also in the check() function. Comment at: test/clang-tidy/bugprone-too-small-loop-variable.cpp:6 +void voidBadForLoop() { + for (int i = 0; i < size(); ++i) { +// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has a narrower type ('int') than the type ('long') of termination condition [bugprone-too-small-loop-variable] JonasToth wrote: > please add tests where the rhs is a literal. Do you mean tests like voidForLoopWithLiteralCond()? Is it worth to add more tests like that? Comment at: test/clang-tidy/bugprone-too-small-loop-variable.cpp:116 + +// TODO: handle those cases when the loop condition contains a floating point expression +void voidDoubleForCond() { whisperity wrote: > (Misc: You might want to check out D52730 for floats later down the line.) In the meantime, I thought this float comparison is not a real use case. It just came in my mind while I was trying to find out test cases. So I just removed it. The referenced conversion check might catch it anyway. Comment at: test/clang-tidy/bugprone-too-small-loop-variable.cpp:152 +void voidForLoopWithEnumCond() { + for (short i = eSizeType::START; i < eSizeType::END; ++i) { + } // no warning JonasToth wrote: > It is possible to specify the underlying type of an `enum`. > For the case `enum eSizeType2 : int;` the problem does occur as well. I think > especially this case is tricky to spot manually and should be handled too. > What do you think? Hmm, it can be handled I think. However, I'm not sure how often it is, that an enum has an item value bigger than 32767 (short) or 65535 (unsigned short) or another even bigger value. For now, I think it's better to just ignore these cases to avoid false positives and keep the first version of the check simple. The scope can be extended anytime later I think. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D53974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D54046: [COFF, ARM64] Implement InterlockedExchange*_* builtins
mgrang created this revision. mgrang added reviewers: rnk, mstorsjo, efriedma, TomTan. Herald added subscribers: kristina, jfb, chrib, kristof.beyls, javed.absar. Windows SDK needs these intrinsics to be proper builtins. This is second in a series of patches to move intrinsic defintions out of intrin.h. Repository: rC Clang https://reviews.llvm.org/D54046 Files: include/clang/Basic/BuiltinsAArch64.def include/clang/Basic/BuiltinsARM.def lib/CodeGen/CGBuiltin.cpp lib/Headers/intrin.h test/CodeGen/ms-intrinsics.c Index: test/CodeGen/ms-intrinsics.c === --- test/CodeGen/ms-intrinsics.c +++ test/CodeGen/ms-intrinsics.c @@ -698,6 +698,90 @@ // CHECK-ARM-ARM64: ret i64 [[RESULT:%[0-9]+]] // CHECK-ARM-ARM64: } +char test_InterlockedExchange8_acq(char volatile *value, char mask) { + return _InterlockedExchange8_acq(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i8 @test_InterlockedExchange8_acq(i8*{{[a-z_ ]*}}%value, i8{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xchg i8* %value, i8 %mask acquire +// CHECK-ARM-ARM64: ret i8 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } +char test_InterlockedExchange8_rel(char volatile *value, char mask) { + return _InterlockedExchange8_rel(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i8 @test_InterlockedExchange8_rel(i8*{{[a-z_ ]*}}%value, i8{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xchg i8* %value, i8 %mask release +// CHECK-ARM-ARM64: ret i8 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } +char test_InterlockedExchange8_nf(char volatile *value, char mask) { + return _InterlockedExchange8_nf(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i8 @test_InterlockedExchange8_nf(i8*{{[a-z_ ]*}}%value, i8{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xchg i8* %value, i8 %mask monotonic +// CHECK-ARM-ARM64: ret i8 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } +short test_InterlockedExchange16_acq(short volatile *value, short mask) { + return _InterlockedExchange16_acq(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedExchange16_acq(i16*{{[a-z_ ]*}}%value, i16{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xchg i16* %value, i16 %mask acquire +// CHECK-ARM-ARM64: ret i16 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } +short test_InterlockedExchange16_rel(short volatile *value, short mask) { + return _InterlockedExchange16_rel(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedExchange16_rel(i16*{{[a-z_ ]*}}%value, i16{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xchg i16* %value, i16 %mask release +// CHECK-ARM-ARM64: ret i16 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } +short test_InterlockedExchange16_nf(short volatile *value, short mask) { + return _InterlockedExchange16_nf(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedExchange16_nf(i16*{{[a-z_ ]*}}%value, i16{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xchg i16* %value, i16 %mask monotonic +// CHECK-ARM-ARM64: ret i16 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } +long test_InterlockedExchange_acq(long volatile *value, long mask) { + return _InterlockedExchange_acq(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i32 @test_InterlockedExchange_acq(i32*{{[a-z_ ]*}}%value, i32{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xchg i32* %value, i32 %mask acquire +// CHECK-ARM-ARM64: ret i32 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } +long test_InterlockedExchange_rel(long volatile *value, long mask) { + return _InterlockedExchange_rel(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i32 @test_InterlockedExchange_rel(i32*{{[a-z_ ]*}}%value, i32{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xchg i32* %value, i32 %mask release +// CHECK-ARM-ARM64: ret i32 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } +long test_InterlockedExchange_nf(long volatile *value, long mask) { + return _InterlockedExchange_nf(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i32 @test_InterlockedExchange_nf(i32*{{[a-z_ ]*}}%value, i32{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xchg i32* %value, i32 %mask monotonic +// CHECK-ARM-ARM64: ret i32 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } +__int64 test_InterlockedExchange64_acq(__int64 volatile *value, __int64 mask) { + return _InterlockedExchange64_acq(value, mask); +} +// CHECK-ARM-ARM64: define{{.*}}i64 @test_InterlockedExchange64_acq(i64*{{[a-z_ ]*}}%value, i64{{[a-z_ ]*}}%mask){{.*}}{ +// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = atomicrmw xchg i64* %value, i64 %mask acquire +// CHECK-ARM-ARM64: ret i64 [[RESULT:%[0-9]+]] +// CHECK-ARM-ARM64: } +__int64 test_InterlockedExchange64_rel(__int64 volatile *value, __int64 mask) { + return
mips builders on LLVM buildbot?
Hello everyone, There are few abandoned mips builders on LLVM buildbot: llvm-mips-linux clang-cmake-mipsel clang-cmake-mips I am going to remove them, if anyone has any objections, please speak up! Thanks Galina ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D53922: [clangd] fix non linux build
Appreciate the input from everyone. This is an experimental feature that isn't hooked up anywhere yet, linux/glibc-only is fine for now. We can revisit once this code is actually used. (BTW musl seems to work fine: https://git.musl-libc.org/cgit/musl/tree/src/thread/pthread_setschedparam.c) On Fri, Nov 2, 2018 at 9:09 PM Fangrui Song via Phabricator < revi...@reviews.llvm.org> wrote: > MaskRay added a comment. > > I don't even know if this actually does any good. In some libc > implementations `pthread_setschedparam` may be a no-op (e.g. in musl) > > > Repository: > rL LLVM > > https://reviews.llvm.org/D53922 > > > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable
ztamas updated this revision to Diff 172422. ztamas added a comment. Update code based on reviewer comments: - Remove const qualifier - Fix some comments - Use isInstantiationDependent() method - Do not ignore macros - Mark code-constructs in docs - Handle the use case when both operands of the binary operator is constant inside the condition expression. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D53974 Files: clang-tidy/bugprone/BugproneTidyModule.cpp clang-tidy/bugprone/CMakeLists.txt clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp clang-tidy/bugprone/TooSmallLoopVariableCheck.h docs/ReleaseNotes.rst docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst docs/clang-tidy/checks/list.rst test/clang-tidy/bugprone-too-small-loop-variable.cpp Index: test/clang-tidy/bugprone-too-small-loop-variable.cpp === --- /dev/null +++ test/clang-tidy/bugprone-too-small-loop-variable.cpp @@ -0,0 +1,154 @@ +// RUN: %check_clang_tidy %s bugprone-too-small-loop-variable %t + +long size() { return 294967296l; } + +void voidBadForLoop() { + for (int i = 0; i < size(); ++i) { +// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable] + } +} + +void voidBadForLoop2() { + for (int i = 0; i < size() + 10; ++i) { +// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable] + } +} + +void voidBadForLoop3() { + for (int i = 0; i <= size() - 1; ++i) { +// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable] + } +} + +void voidBadForLoop4() { + for (int i = 0; size() > i; ++i) { +// CHECK-MESSAGES: :[[@LINE-1]]:28: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable] + } +} + +void voidBadForLoop5() { + for (int i = 0; size() - 1 >= i; ++i) { +// CHECK-MESSAGES: :[[@LINE-1]]:33: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable] + } +} + +void voidBadForLoop6() { + int i = 0; + for (; i < size(); ++i) { +// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable] + } +} + +void voidForLoopUnsignedCond() { + unsigned size = 3147483647; + for (int i = 0; i < size; ++i) { +// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has narrower type 'int' than terminating condition 'unsigned int' [bugprone-too-small-loop-variable] + } +} + +// False positive: because of the integer literal, loop condition has int type +void voidForLoopFalsePositive() { + short size = 3; + bool cond = false; + for (short i = 0; i < (cond ? 0 : size); ++i) { +// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: loop variable has narrower type 'short' than terminating condition 'int' [bugprone-too-small-loop-variable] + } +} + +// Simple use case when both expressions have the same type +void voidGoodForLoop() { + for (long i = 0; i < size(); ++i) { + } // no warning +} + +// Second simple use case when both expressions have the same type +void voidGoodForLoop2() { + short loopCond = 10; + for (short i = 0; i < loopCond; ++i) { + } // no warning +} + +// Because of the integer literal, the loop condition is int, but we suppress the warning here +void voidForLoopShortPlusLiteral() { + short size = 3; + for (short i = 0; i <= (size - 1); ++i) { + } // no warning +} + +// Additions of two short variable is converted to int, but we suppress this to avoid false positives +void voidForLoopShortPlusShort() { + short size = 256; + short increment = 14; + for (short i = 0; i < size + increment; ++i) { + } // no warning +} + +// Different integer types, but in this case the loop variable is the bigger type +void voidForLoopReverseCond() { + short start = 256; + short end = 14; + for (int i = start; i >= end; --i) { + } // no warning +} + +// TODO: handle while loop +void voidBadWhileLoop() { + short i = 0; + while (i < size()) { // missing warning +++i; + } +} + +// TODO: handle do-while loop +void voidBadDoWhileLoop() { + short i = 0; + do { +++i; + } while (i < size()); // missing warning +} + +// We do not catch this, but other conversion related checks can catch it anyway +void voidReverseForLoop() { + for (short i = size() - 1; i >= 0; --i) { // no warning + } +} + +// TODO: handle complex loop conditions +void voidComplexForCond() { + bool additionalCond = true; + for (int i = 0; i < size() && additionalCond; ++i) { // missing warning + } +} + +// Macro in loop condition +#define SIZE 125 +#define SIZE2 (SIZE + 1) +void voidForLoopWithMacroCond() { + for (short i = 0; i <
[PATCH] D53922: [clangd] fix non linux build
MaskRay added a comment. I don't even know if this actually does any good. In some libc implementations `pthread_setschedparam` may be a no-op (e.g. in musl) Repository: rL LLVM https://reviews.llvm.org/D53922 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53483: [analyzer] Restrict AnalyzerOptions' interface so that non-checker objects have to be registered
Szelethus added inline comments. Comment at: include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:146-149 +/// If you'd like to add a new -cc1 flag, add it to +/// include/clang/Driver/CC1Options.td, add a new field to store the value of +/// that flag in this class, and initialize it in +/// lib/Frontend/CompilerInvocation.cpp. NoQ wrote: > Szelethus wrote: > > NoQ wrote: > > > Szelethus wrote: > > > > NoQ wrote: > > > > > Szelethus wrote: > > > > > > NoQ wrote: > > > > > > > Nono, don't add more -cc1 flags :) > > > > > > Code review is there to stop adding unnecessary -cc1 flags. Are we > > > > > > sure we wouldn't even like to document it? I myself will add at > > > > > > least 2 more -cc1 flags in the future (-analyzer-config-help, > > > > > > -analyzer-checker-option-help), that undoubtedly belong there. > > > > > But these flags wouldn't define new analyzer options(?) > > > > That is correct, but we do store similar cc1 flags here, because they > > > > belong to the the analyzer. > > > > > > > > Although, hm, some of those would be more fitting as -analyzer-config > > > > flags, but I don't see how I could pull that off in a backward > > > > compatible way. > > > Those were there before `AnalyzerOptions` were invented. That said, > > > @george.karpenkov just made an experiment with converting > > > `-analyzer-eagerly-assume` into `-analyzer-config eagerly-assume` > > > (D51251) and it seems to have went well. For feature flags that were not > > > really ever supposed to have been appended by GUIs, it is enough to just > > > make sure that the correct behavior is enabled by default; there's no > > > need to maintain backwards compatibility. > > Hmm, maybe I could add that to my TODO list :) > > > > I think the comment should still mention cc1 flags, but with an addition: > > > Add a -cc1 only if your flag is related to the Static Analyzer, but > > > doesn't actually change the actual analysis. > Sounds good! Or something like that: "TODO: Some of these options are > controlled by raw frontend flags. These should be eventually converted into > -analyzer-config flags. New analyzer options should not be implemented as > frontend flags. Frontend flags still make sense for things that do not affect > the actual analysis." Will do that! Aaaafter I'm confident enough that the previous patches cause no more trouble. https://reviews.llvm.org/D53483 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53483: [analyzer] Restrict AnalyzerOptions' interface so that non-checker objects have to be registered
NoQ added inline comments. Comment at: include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:146-149 +/// If you'd like to add a new -cc1 flag, add it to +/// include/clang/Driver/CC1Options.td, add a new field to store the value of +/// that flag in this class, and initialize it in +/// lib/Frontend/CompilerInvocation.cpp. Szelethus wrote: > NoQ wrote: > > Szelethus wrote: > > > NoQ wrote: > > > > Szelethus wrote: > > > > > NoQ wrote: > > > > > > Nono, don't add more -cc1 flags :) > > > > > Code review is there to stop adding unnecessary -cc1 flags. Are we > > > > > sure we wouldn't even like to document it? I myself will add at least > > > > > 2 more -cc1 flags in the future (-analyzer-config-help, > > > > > -analyzer-checker-option-help), that undoubtedly belong there. > > > > But these flags wouldn't define new analyzer options(?) > > > That is correct, but we do store similar cc1 flags here, because they > > > belong to the the analyzer. > > > > > > Although, hm, some of those would be more fitting as -analyzer-config > > > flags, but I don't see how I could pull that off in a backward compatible > > > way. > > Those were there before `AnalyzerOptions` were invented. That said, > > @george.karpenkov just made an experiment with converting > > `-analyzer-eagerly-assume` into `-analyzer-config eagerly-assume` (D51251) > > and it seems to have went well. For feature flags that were not really ever > > supposed to have been appended by GUIs, it is enough to just make sure that > > the correct behavior is enabled by default; there's no need to maintain > > backwards compatibility. > Hmm, maybe I could add that to my TODO list :) > > I think the comment should still mention cc1 flags, but with an addition: > > Add a -cc1 only if your flag is related to the Static Analyzer, but doesn't > > actually change the actual analysis. Sounds good! Or something like that: "TODO: Some of these options are controlled by raw frontend flags. These should be eventually converted into -analyzer-config flags. New analyzer options should not be implemented as frontend flags. Frontend flags still make sense for things that do not affect the actual analysis." https://reviews.llvm.org/D53483 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53705: [OpenCL] Postpone PSV address space diagnostic
keryell added a comment. In https://reviews.llvm.org/D53705#1285096, @rjmccall wrote: > > If your plan is to compile code for the CPU with a normal C++ compiler but > for the GPU with an OpenCL-aware compiler, you are going to have > significantly divergent behavior between the CPU and GPU language dialects > because of the non-standardness of the GPU dialect. We are trying to minimize the divergence. Thus the use of conditional tense and *mostly" word in the sentence "could mostly run on a CPU without a specific compiler", as a wishful thinking design trade-off, trying to minimize the rewriting a user has to do starting from a plain C++ function. Probably we can discuss this next week off-line during a ISO C++ SG14 or SG1 session... Repository: rC Clang https://reviews.llvm.org/D53705 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53483: [analyzer] Restrict AnalyzerOptions' interface so that non-checker objects have to be registered
Szelethus added inline comments. Comment at: include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:146-149 +/// If you'd like to add a new -cc1 flag, add it to +/// include/clang/Driver/CC1Options.td, add a new field to store the value of +/// that flag in this class, and initialize it in +/// lib/Frontend/CompilerInvocation.cpp. NoQ wrote: > Szelethus wrote: > > NoQ wrote: > > > Szelethus wrote: > > > > NoQ wrote: > > > > > Nono, don't add more -cc1 flags :) > > > > Code review is there to stop adding unnecessary -cc1 flags. Are we sure > > > > we wouldn't even like to document it? I myself will add at least 2 more > > > > -cc1 flags in the future (-analyzer-config-help, > > > > -analyzer-checker-option-help), that undoubtedly belong there. > > > But these flags wouldn't define new analyzer options(?) > > That is correct, but we do store similar cc1 flags here, because they > > belong to the the analyzer. > > > > Although, hm, some of those would be more fitting as -analyzer-config > > flags, but I don't see how I could pull that off in a backward compatible > > way. > Those were there before `AnalyzerOptions` were invented. That said, > @george.karpenkov just made an experiment with converting > `-analyzer-eagerly-assume` into `-analyzer-config eagerly-assume` (D51251) > and it seems to have went well. For feature flags that were not really ever > supposed to have been appended by GUIs, it is enough to just make sure that > the correct behavior is enabled by default; there's no need to maintain > backwards compatibility. Hmm, maybe I could add that to my TODO list :) I think the comment should still mention cc1 flags, but with an addition: > Add a -cc1 only if your flag is related to the Static Analyzer, but doesn't > actually change the actual analysis. https://reviews.llvm.org/D53483 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53882: [clang-tidy] Adding Zircon checker for std namespace
juliehockett planned changes to this revision. juliehockett marked 5 inline comments as done. juliehockett added a comment. In https://reviews.llvm.org/D53882#1282219, @aaron.ballman wrote: > I am a bit confused by what this check is trying to accomplish. It seems like > this is intended to catch use of anything declared within the standard > library, but that includes library support things that are needed to write > useful code. For instance, it seems this means users cannot use initializer > lists or type traits. I'm not even certain users can overload `operator > new()` because that uses `std::size_t` as an argument. > > Can you expound on the requirements in a bit more detail? Is it truly "no > standard library functionality at all, including things required to be > supported in freestanding implementations"? Yes. We're in the process of enabling the C++ standard library in the Zircon userspace code, and there is a firm requirement that no kernel code use anything in the std namespace (which declares its own implementations of things like type traits). That said, the policy rollout has shifted a bit since I implemented this and so I'll be reworking it a bit (and also likely renaming it to zircon-kernel-no-std-namespace, so we can disable it for userspace code). Thanks all for your comments! https://reviews.llvm.org/D53882 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r346033 - Attempt to fix 'logical operation on address of string constant'
Author: szelethus Date: Fri Nov 2 12:48:56 2018 New Revision: 346033 URL: http://llvm.org/viewvc/llvm-project?rev=346033=rev Log: Attempt to fix 'logical operation on address of string constant' Caused a lot of warnings for Windows: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/21178/steps/build/logs/warnings%20%2867%29 Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp?rev=346033=346032=346033=diff == --- cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp Fri Nov 2 12:48:56 2018 @@ -178,7 +178,8 @@ void ento::printAnalyzerConfigList(raw_o { \ CMDFLAG, \ llvm::Twine(llvm::Twine() + "(" + \ - (#TYPE == "StringRef" ? "string" : #TYPE ) + ") " DESC \ + (StringRef(#TYPE) == "StringRef" ? "string" : #TYPE ) + \ + ") " DESC \ " (default: " #DEFAULT_VAL ")").str() \ }, @@ -187,7 +188,8 @@ void ento::printAnalyzerConfigList(raw_o { \ CMDFLAG, \ llvm::Twine(llvm::Twine() + "(" + \ - (#TYPE == "StringRef" ? "string" : #TYPE ) + ") " DESC \ + (StringRef(#TYPE) == "StringRef" ? "string" : #TYPE ) + \ + ") " DESC \ " (default: " #SHALLOW_VAL " in shallow mode, " #DEEP_VAL \ " in deep mode)").str() \ }, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D53922: [clangd] fix non linux build
Yes, that's the intent, at least for now. Fine to eat all your cores, but background indexing isn't higher priority than anything else. On Fri, Nov 2, 2018 at 8:35 PM Joerg Sonnenberger wrote: > On Wed, Oct 31, 2018 at 08:53:03AM +, Sam McCall via Phabricator via > cfe-commits wrote: > > sammccall accepted this revision. > > sammccall added a comment. > > This revision is now accepted and ready to land. > > > > Thanks! > > We should work out what to do on BSD+Mac (and windows at some point), > but no-op is good for now. > > Is this really a good idea in general? It means that on a busy system, > the thread will never run... > > Joerg > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D53922: [clangd] fix non linux build
On Wed, Oct 31, 2018 at 08:53:03AM +, Sam McCall via Phabricator via cfe-commits wrote: > sammccall accepted this revision. > sammccall added a comment. > This revision is now accepted and ready to land. > > Thanks! > We should work out what to do on BSD+Mac (and windows at some point), but > no-op is good for now. Is this really a good idea in general? It means that on a busy system, the thread will never run... Joerg ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53483: [analyzer] Restrict AnalyzerOptions' interface so that non-checker objects have to be registered
NoQ added inline comments. Comment at: include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:146-149 +/// If you'd like to add a new -cc1 flag, add it to +/// include/clang/Driver/CC1Options.td, add a new field to store the value of +/// that flag in this class, and initialize it in +/// lib/Frontend/CompilerInvocation.cpp. Szelethus wrote: > NoQ wrote: > > Szelethus wrote: > > > NoQ wrote: > > > > Nono, don't add more -cc1 flags :) > > > Code review is there to stop adding unnecessary -cc1 flags. Are we sure > > > we wouldn't even like to document it? I myself will add at least 2 more > > > -cc1 flags in the future (-analyzer-config-help, > > > -analyzer-checker-option-help), that undoubtedly belong there. > > But these flags wouldn't define new analyzer options(?) > That is correct, but we do store similar cc1 flags here, because they belong > to the the analyzer. > > Although, hm, some of those would be more fitting as -analyzer-config flags, > but I don't see how I could pull that off in a backward compatible way. Those were there before `AnalyzerOptions` were invented. That said, @george.karpenkov just made an experiment with converting `-analyzer-eagerly-assume` into `-analyzer-config eagerly-assume` (D51251) and it seems to have went well. For feature flags that were not really ever supposed to have been appended by GUIs, it is enough to just make sure that the correct behavior is enabled by default; there's no need to maintain backwards compatibility. https://reviews.llvm.org/D53483 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53483: [analyzer] Restrict AnalyzerOptions' interface so that non-checker objects have to be registered
Szelethus added inline comments. Comment at: include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:146-149 +/// If you'd like to add a new -cc1 flag, add it to +/// include/clang/Driver/CC1Options.td, add a new field to store the value of +/// that flag in this class, and initialize it in +/// lib/Frontend/CompilerInvocation.cpp. NoQ wrote: > Szelethus wrote: > > NoQ wrote: > > > Nono, don't add more -cc1 flags :) > > Code review is there to stop adding unnecessary -cc1 flags. Are we sure we > > wouldn't even like to document it? I myself will add at least 2 more -cc1 > > flags in the future (-analyzer-config-help, -analyzer-checker-option-help), > > that undoubtedly belong there. > But these flags wouldn't define new analyzer options(?) That is correct, but we do store similar cc1 flags here, because they belong to the the analyzer. Although, hm, some of those would be more fitting as -analyzer-config flags, but I don't see how I could pull that off in a backward compatible way. https://reviews.llvm.org/D53483 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53483: [analyzer] Restrict AnalyzerOptions' interface so that non-checker objects have to be registered
NoQ accepted this revision. NoQ added inline comments. Comment at: include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:146-149 +/// If you'd like to add a new -cc1 flag, add it to +/// include/clang/Driver/CC1Options.td, add a new field to store the value of +/// that flag in this class, and initialize it in +/// lib/Frontend/CompilerInvocation.cpp. Szelethus wrote: > NoQ wrote: > > Nono, don't add more -cc1 flags :) > Code review is there to stop adding unnecessary -cc1 flags. Are we sure we > wouldn't even like to document it? I myself will add at least 2 more -cc1 > flags in the future (-analyzer-config-help, -analyzer-checker-option-help), > that undoubtedly belong there. But these flags wouldn't define new analyzer options(?) Comment at: lib/StaticAnalyzer/Core/AnalyzerOptions.cpp:172 + .getAsInteger(10, *V); + assert(!HasFailed && "analyzer-config option should be numeric"); + (void)HasFailed; Szelethus wrote: > NoQ wrote: > > I guess @xazax.hun's comment also applies to this assert. > Which is sadly only going to be addressed in followup patches :/ Note that I > merely moved code around in this patch, but have organized things in a way > that emitting proper diagnostics will be super easy going forward. Since > analyzer configs are mainly meant for developers, I think this is acceptable > before I fix it (in any case, it has always been like this). Hmm, right. I guess @xazax.hun's comment also applies to all other asserts all over this code. https://reviews.llvm.org/D53483 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53277: [analyzer][NFC] Collect all -analyzer-config options in a .def file
Szelethus closed this revision. Szelethus added a comment. Interesting, I didn't get a mail about this :/ In any case, let's hope no more problems arise. Repository: rL LLVM https://reviews.llvm.org/D53277 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53277: [analyzer][NFC] Collect all -analyzer-config options in a .def file
Szelethus added a comment. In https://reviews.llvm.org/D53277#1285777, @george.karpenkov wrote: > @NoQ @Szelethus Actually pushed a fix. Just saw this -- Thank you! :D Repository: rL LLVM https://reviews.llvm.org/D53277 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r345989 - [analyzer] New flag to print all -analyzer-config options
Also one of your resent commits added another broken test to the builder: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/13729 . . . Failing Tests: . . . Clang-Unit :: Frontend/./FrontendTests.exe/FrontendOutputTests.TestOutputStream . . . The builder did not send notifications on this. Please have a look? Thanks Galina On Fri, Nov 2, 2018 at 9:01 AM Kristof Umann via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: szelethus > Date: Fri Nov 2 08:59:37 2018 > New Revision: 345989 > > URL: http://llvm.org/viewvc/llvm-project?rev=345989=rev > Log: > [analyzer] New flag to print all -analyzer-config options > > A new -cc1 flag is avaible for the said purpose: -analyzer-config-help > > Differential Revision: https://reviews.llvm.org/D53296 > > Added: > cfe/trunk/test/Analysis/analyzer-list-configs.c > Modified: > cfe/trunk/include/clang/Driver/CC1Options.td > cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h > cfe/trunk/include/clang/StaticAnalyzer/Frontend/FrontendActions.h > cfe/trunk/lib/Frontend/CompilerInvocation.cpp > cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp > cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp > > Modified: cfe/trunk/include/clang/Driver/CC1Options.td > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=345989=345988=345989=diff > > == > --- cfe/trunk/include/clang/Driver/CC1Options.td (original) > +++ cfe/trunk/include/clang/Driver/CC1Options.td Fri Nov 2 08:59:37 2018 > @@ -129,6 +129,9 @@ def analyzer_disable_all_checks : Flag<[ > def analyzer_checker_help : Flag<["-"], "analyzer-checker-help">, >HelpText<"Display the list of analyzer checkers that are available">; > > +def analyzer_config_help : Flag<["-"], "analyzer-config-help">, > + HelpText<"Display the list of -analyzer-config options">; > + > def analyzer_list_enabled_checkers : Flag<["-"], > "analyzer-list-enabled-checkers">, >HelpText<"Display the list of enabled analyzer checkers">; > > > Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h?rev=345989=345988=345989=diff > > == > --- cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h > (original) > +++ cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h Fri Nov > 2 08:59:37 2018 > @@ -175,6 +175,7 @@ public: > >unsigned ShowCheckerHelp : 1; >unsigned ShowEnabledCheckerList : 1; > + unsigned ShowConfigOptionsList : 1; >unsigned AnalyzeAll : 1; >unsigned AnalyzerDisplayProgress : 1; >unsigned AnalyzeNestedBlocks : 1; > > Modified: cfe/trunk/include/clang/StaticAnalyzer/Frontend/FrontendActions.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Frontend/FrontendActions.h?rev=345989=345988=345989=diff > > == > --- cfe/trunk/include/clang/StaticAnalyzer/Frontend/FrontendActions.h > (original) > +++ cfe/trunk/include/clang/StaticAnalyzer/Frontend/FrontendActions.h Fri > Nov 2 08:59:37 2018 > @@ -55,6 +55,7 @@ private: > void printCheckerHelp(raw_ostream , ArrayRef plugins); > void printEnabledCheckerList(raw_ostream , ArrayRef > plugins, > const AnalyzerOptions ); > +void printAnalyzerConfigList(raw_ostream ); > > } // end GR namespace > > > Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=345989=345988=345989=diff > > == > --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) > +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Nov 2 08:59:37 2018 > @@ -279,6 +279,7 @@ static bool ParseAnalyzerArgs(AnalyzerOp >} > >Opts.ShowCheckerHelp = Args.hasArg(OPT_analyzer_checker_help); > + Opts.ShowConfigOptionsList = Args.hasArg(OPT_analyzer_config_help); >Opts.ShowEnabledCheckerList = > Args.hasArg(OPT_analyzer_list_enabled_checkers); >Opts.DisableAllChecks = Args.hasArg(OPT_analyzer_disable_all_checks); > > > Modified: cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp?rev=345989=345988=345989=diff > > == > --- cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp (original) > +++ cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp Fri Nov 2 > 08:59:37 2018 > @@ -241,11 +241,19 @@ bool ExecuteCompilerInvocation(CompilerI > ento::printCheckerHelp(llvm::outs(), >
r346028 - [analyzer] Fixup of the module build after https://reviews.llvm.org/D53277
Author: george.karpenkov Date: Fri Nov 2 11:28:52 2018 New Revision: 346028 URL: http://llvm.org/viewvc/llvm-project?rev=346028=rev Log: [analyzer] Fixup of the module build after https://reviews.llvm.org/D53277 Adds AnalyzerOptions.def to the list of textual headers. Modified: cfe/trunk/include/clang/module.modulemap Modified: cfe/trunk/include/clang/module.modulemap URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/module.modulemap?rev=346028=346027=346028=diff == --- cfe/trunk/include/clang/module.modulemap (original) +++ cfe/trunk/include/clang/module.modulemap Fri Nov 2 11:28:52 2018 @@ -128,6 +128,7 @@ module Clang_StaticAnalyzer_Core { umbrella "StaticAnalyzer/Core" textual header "StaticAnalyzer/Core/Analyses.def" + textual header "StaticAnalyzer/Core/AnalyzerOptions.def" textual header "StaticAnalyzer/Core/PathSensitive/SVals.def" textual header "StaticAnalyzer/Core/PathSensitive/Symbols.def" textual header "StaticAnalyzer/Core/PathSensitive/Regions.def" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53277: [analyzer][NFC] Collect all -analyzer-config options in a .def file
george.karpenkov added a comment. @NoQ @Szelethus Actually pushed a fix. Repository: rL LLVM https://reviews.llvm.org/D53277 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53277: [analyzer][NFC] Collect all -analyzer-config options in a .def file
george.karpenkov added a comment. @Szelethus @NoQ OK it seems you need to annotate those headers in modulemap. E.g. take a look at: george1@/Volumes/Transcend/code/monorepo/llvm-project/clang (master)≻ rg SVals.def include/clang/module.modulemap 131: textual header "StaticAnalyzer/Core/PathSensitive/SVals.def" include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h 58:#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def" 68:#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def" 82:#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def" include/clang/StaticAnalyzer/Core/PathSensitive/SValVisitor.h 39:#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def" 44:#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def" 51:#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def" 66:#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def" include/clang/StaticAnalyzer/Core/PathSensitive/SVals.def 1://===-- SVals.def - Metadata about SVal kinds ---*- C++ -*-===// Repository: rL LLVM https://reviews.llvm.org/D53277 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53830: [clang-tidy]: Abseil: new check 'abseil-upgrade-duration-conversions'
astrelni marked an inline comment as done. astrelni added inline comments. Comment at: clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp:33-36 + anyOf(hasAncestor( +functionTemplateDecl(HasMatchingDependentDescendant)), +hasAncestor( +classTemplateDecl(HasMatchingDependentDescendant alexfh wrote: > The hasAncestor and hasDescendant matchers frequently have non-trivial > performance implications. Especially the latter, especially when called on a > large number of nodes with a large number of transitive children (this > obviously depends on the code being analyzed). I don't know how likely is > this to cause problems here (the matcher seems to only be used when the check > is about to issue a diagnostic), but it's always good to be aware of the > possible issues. > > Frequently there's a more efficient (and easier to understand) alternative. > For example, instead of trying to evaluate certain conditions while > traversing the code (which may require a large number of lookups into > relatively distant parts of the AST), it's sometimes more efficient to split > the analysis into two or more stages. During the AST traversal (i.e. when AST > matchers run) the check could collect some raw information about all > potentially problematic places in the code and then (for example, in > `onEndOfTranslationUnit`) analyze the collected information together in a > second stage. This works best if there's a way to arrange the data gathered > on the first pass such that the second pass can efficiently look up necessary > information. Thanks, gave it a try, what do you think of this? https://reviews.llvm.org/D53830 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53998: [COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry
This revision was automatically updated to reflect the committed changes. Closed by commit rL346024: [COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry (authored by mgrang, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D53998?vs=172238=172404#toc Repository: rL LLVM https://reviews.llvm.org/D53998 Files: cfe/trunk/lib/CodeGen/CGBuiltin.cpp cfe/trunk/test/CodeGen/ms-setjmp.c Index: cfe/trunk/test/CodeGen/ms-setjmp.c === --- cfe/trunk/test/CodeGen/ms-setjmp.c +++ cfe/trunk/test/CodeGen/ms-setjmp.c @@ -25,7 +25,7 @@ // X64-NEXT: ret i32 %[[call]] // AARCH64-LABEL: define dso_local i32 @test_setjmp - // AARCH64: %[[addr:.*]] = call i8* @llvm.frameaddress(i32 0) + // AARCH64: %[[addr:.*]] = call i8* @llvm.sponentry() // AARCH64: %[[call:.*]] = call i32 @_setjmpex(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @jb, i32 0, i32 0), i8* %[[addr]]) // AARCH64-NEXT: ret i32 %[[call]] } @@ -38,7 +38,7 @@ // X64-NEXT: ret i32 %[[call]] // AARCH64-LABEL: define dso_local i32 @test_setjmpex - // AARCH64: %[[addr:.*]] = call i8* @llvm.frameaddress(i32 0) + // AARCH64: %[[addr:.*]] = call i8* @llvm.sponentry() // AARCH64: %[[call:.*]] = call i32 @_setjmpex(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @jb, i32 0, i32 0), i8* %[[addr]]) // AARCH64-NEXT: ret i32 %[[call]] } Index: cfe/trunk/lib/CodeGen/CGBuiltin.cpp === --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp @@ -711,8 +711,11 @@ } else { Name = SJKind == MSVCSetJmpKind::_setjmp ? "_setjmp" : "_setjmpex"; Arg1Ty = CGF.Int8PtrTy; -Arg1 = CGF.Builder.CreateCall(CGF.CGM.getIntrinsic(Intrinsic::frameaddress), - llvm::ConstantInt::get(CGF.Int32Ty, 0)); +if (CGF.getTarget().getTriple().getArch() == llvm::Triple::aarch64) { + Arg1 = CGF.Builder.CreateCall(CGF.CGM.getIntrinsic(Intrinsic::sponentry)); +} else + Arg1 = CGF.Builder.CreateCall(CGF.CGM.getIntrinsic(Intrinsic::frameaddress), +llvm::ConstantInt::get(CGF.Int32Ty, 0)); } // Mark the call site and declaration with ReturnsTwice. Index: cfe/trunk/test/CodeGen/ms-setjmp.c === --- cfe/trunk/test/CodeGen/ms-setjmp.c +++ cfe/trunk/test/CodeGen/ms-setjmp.c @@ -25,7 +25,7 @@ // X64-NEXT: ret i32 %[[call]] // AARCH64-LABEL: define dso_local i32 @test_setjmp - // AARCH64: %[[addr:.*]] = call i8* @llvm.frameaddress(i32 0) + // AARCH64: %[[addr:.*]] = call i8* @llvm.sponentry() // AARCH64: %[[call:.*]] = call i32 @_setjmpex(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @jb, i32 0, i32 0), i8* %[[addr]]) // AARCH64-NEXT: ret i32 %[[call]] } @@ -38,7 +38,7 @@ // X64-NEXT: ret i32 %[[call]] // AARCH64-LABEL: define dso_local i32 @test_setjmpex - // AARCH64: %[[addr:.*]] = call i8* @llvm.frameaddress(i32 0) + // AARCH64: %[[addr:.*]] = call i8* @llvm.sponentry() // AARCH64: %[[call:.*]] = call i32 @_setjmpex(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @jb, i32 0, i32 0), i8* %[[addr]]) // AARCH64-NEXT: ret i32 %[[call]] } Index: cfe/trunk/lib/CodeGen/CGBuiltin.cpp === --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp @@ -711,8 +711,11 @@ } else { Name = SJKind == MSVCSetJmpKind::_setjmp ? "_setjmp" : "_setjmpex"; Arg1Ty = CGF.Int8PtrTy; -Arg1 = CGF.Builder.CreateCall(CGF.CGM.getIntrinsic(Intrinsic::frameaddress), - llvm::ConstantInt::get(CGF.Int32Ty, 0)); +if (CGF.getTarget().getTriple().getArch() == llvm::Triple::aarch64) { + Arg1 = CGF.Builder.CreateCall(CGF.CGM.getIntrinsic(Intrinsic::sponentry)); +} else + Arg1 = CGF.Builder.CreateCall(CGF.CGM.getIntrinsic(Intrinsic::frameaddress), +llvm::ConstantInt::get(CGF.Int32Ty, 0)); } // Mark the call site and declaration with ReturnsTwice. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53277: [analyzer][NFC] Collect all -analyzer-config options in a .def file
george.karpenkov added a comment. @Szelethus you can see the command required to get modules build in the mentioned log. I think -DLLVM_ENABLE_MODULES=On might be enough. Repository: rL LLVM https://reviews.llvm.org/D53277 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r345990 - [analyzer] Put llvm.Conventions back in alpha
Hello Kristof, It looks like this commit added broken tests to couple of our builders: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win . . . Clang :: Analysis/analyzer-list-configs.c Please have a look? The builders were already red and did not send any notifications. Please have a look? Thanks Galina On Fri, Nov 2, 2018 at 9:04 AM Kristof Umann via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: szelethus > Date: Fri Nov 2 09:02:10 2018 > New Revision: 345990 > > URL: http://llvm.org/viewvc/llvm-project?rev=345990=rev > Log: > [analyzer] Put llvm.Conventions back in alpha > > Interestingly, this many year old (when I last looked I remember 2010ish) > checker was committed without any tests, so I thought I'd implement them, > but I > was shocked to see how I barely managed to get it working. The code is > severely > outdated, I'm not even sure it has ever been used, so I'd propose to move > it > back into alpha, and possibly even remove it. > > Differential Revision: https://reviews.llvm.org/D53856 > > Added: > cfe/trunk/test/Analysis/llvm-conventions.cpp > Modified: > cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td > cfe/trunk/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp > cfe/trunk/test/Analysis/Inputs/system-header-simulator-cxx.h > cfe/trunk/test/Analysis/diagnostics/explicit-suppression.cpp > cfe/trunk/test/Analysis/inner-pointer.cpp > cfe/trunk/test/Analysis/temporaries.cpp > cfe/trunk/www/analyzer/alpha_checks.html > > Modified: cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td?rev=345990=345989=345990=diff > > == > --- cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td (original) > +++ cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td Fri Nov 2 > 09:02:10 2018 > @@ -83,6 +83,7 @@ def LocalizabilityOptIn : Package<"local > def MPI : Package<"mpi">, InPackage; > > def LLVM : Package<"llvm">; > +def LLVMAlpha : Package<"llvm">, InPackage, Hidden; > > // The APIModeling package is for checkers that model APIs and don't > perform > // any diagnostics. These checkers are always turned on; this package is > @@ -730,7 +731,7 @@ let ParentPackage = MPI in { > > > //===--===// > > def LLVMConventionsChecker : Checker<"Conventions">, > - InPackage, > + InPackage, >HelpText<"Check code for LLVM codebase conventions">, >DescFile<"LLVMConventionsChecker.cpp">; > > > Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp?rev=345990=345989=345990=diff > > == > --- cfe/trunk/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp > (original) > +++ cfe/trunk/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp Fri > Nov 2 09:02:10 2018 > @@ -32,8 +32,7 @@ static bool IsLLVMStringRef(QualType T) >if (!RT) > return false; > > - return StringRef(QualType(RT, 0).getAsString()) == > - "class StringRef"; > + return StringRef(QualType(RT, 0).getAsString()) == "class StringRef"; > } > > /// Check whether the declaration is semantically inside the top-level > > Modified: cfe/trunk/test/Analysis/Inputs/system-header-simulator-cxx.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/Inputs/system-header-simulator-cxx.h?rev=345990=345989=345990=diff > > == > --- cfe/trunk/test/Analysis/Inputs/system-header-simulator-cxx.h (original) > +++ cfe/trunk/test/Analysis/Inputs/system-header-simulator-cxx.h Fri Nov > 2 09:02:10 2018 > @@ -12,6 +12,13 @@ typedef __typeof__((char*)0-(char*)0) pt > void *memmove(void *s1, const void *s2, size_t n); > > namespace std { > + typedef size_t size_type; > +#if __cplusplus >= 201103L > + using nullptr_t = decltype(nullptr); > +#endif > +} > + > +namespace std { >struct input_iterator_tag { }; >struct output_iterator_tag { }; >struct forward_iterator_tag : public input_iterator_tag { }; > @@ -517,6 +524,42 @@ namespace std { > const T& front() const { return *begin(); } >}; > > + template > + class basic_string { > + public: > +basic_string(); > +basic_string(const CharT *s); > + > +~basic_string(); > +void clear(); > + > +basic_string =(const basic_string ); > +basic_string +=(const basic_string ); > + > +const CharT *c_str() const; > +const CharT *data() const; > +CharT *data(); > + > +basic_string (size_type count, CharT ch); > +
[PATCH] D53277: [analyzer][NFC] Collect all -analyzer-config options in a .def file
NoQ added a comment. Ugh, this breaks builds with //modules//, eg. http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/12074/console I'm bad with modules, but you might consult my own failure of this kind: https://reviews.llvm.org/D15448#325856 - especially the `include/clang/module.modulemap` part. There must be a cmake flag for this. I guess please try to revert and reproduce the build failure locally and ask me if you need any help with that :) Repository: rL LLVM https://reviews.llvm.org/D53277 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D54026: [CMake][Fuchsia] Set -fuse-ld=lld explicitly for Linux runtimes
mcgrathr accepted this revision. mcgrathr added a comment. This revision is now accepted and ready to land. So the default is not per-target? It should be. Repository: rC Clang https://reviews.llvm.org/D54026 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable
JonasToth added a comment. In https://reviews.llvm.org/D53974#1285585, @ztamas wrote: > Just to make it clear. I think this check is in a good shape now. I mean it > catches usefull issues and also does not produce too many false positives, as > I see. Yes, I did not want to stop the patch or so! It would be great to remove the false-positive as they might annoy users and as consequence turn the check off. Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:20 + +static const char LoopName[] = "forLoopName"; +static const char loopVarName[] = "loopVar"; Please move these variable in the matcher function and make them `StringRef` instead of `const char[]`. Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:40 +void TooSmallLoopVariableCheck::registerMatchers(MatchFinder *Finder) { + const StatementMatcher LoopVarMatcher = + expr( please do not qualify values as `const`. LLVM style only qualifies pointers and references. (here and elsewhere). Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:45 + + // We need to catch only those comparisons when there is any integer cast + const StatementMatcher LoopVarConversionMatcher = Please make all comments full sentences with punctuation and working grammar (here and elsewhere). I won't be the judge, but aaron ;) Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:82 + +/// \brief Returns the positive part of the integer width for an integer type +unsigned calcPositiveBits(const ASTContext , You can ellide the `\brief` here. Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:106 + +if (RHSE->isTypeDependent() || RHSE->isValueDependent() || +LHSE->isTypeDependent() || LHSE->isValueDependent()) `isInstantiationDependent()`, but please filter that already while matching. Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:110 + +const QualType RHSEType = RHSE->getType(); +const QualType LHSEType = LHSE->getType(); const Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:117 +if (RHSEType->isEnumeralType() || RHSEType.isConstQualified() || +RHSE->getBeginLoc().isMacroID() || isa(RHSE)) + CondExprPosBits = calcPositiveBits(Context, LHSEType); As noted on the other place, i think macros should not be ignored. If the macro defines a constant, it is handled by `IntegerLiteral` Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:134 + const auto *CondExpr = + Result.Nodes.getNodeAs(loopCondName)->IgnoreParenImpCasts(); + const auto *LoopIncrement = You can move the `ignoreParenImpCasts` to the matchers, there is a specific one for that. Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:138 + + if (CondExpr->isTypeDependent() || CondExpr->isValueDependent() || + LoopVar->isTypeDependent() || LoopVar->isValueDependent() || You can replace the two conditions with `isInstantiationDependent()`, there shuold be a matcher for that too. Ignoring them there already should be beneficial. Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:149 + + if (CondExpr->getBeginLoc().isMacroID()) +return; // In most of the cases a macro defines a const value, let just I do not agree with the comment here. Macros can hide weird stuff from time to time, especially "inlined" functions. These should be analyzed as well. Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:158 + + const unsigned LoopVarPosBits = calcPositiveBits(Context, LoopVarType); + const unsigned CondExprPosBits = const Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:166 + if (LoopVarPosBits < CondExprPosBits) +diag(LoopVar->getBeginLoc(), "loop variable has a narrower type (%0) than " + "the type (%1) of termination condition") The diag can be shortened a bit `loop variable has narrower typ %0 than terminating condition %1` or similar. Diags are not sentences. Comment at: docs/ReleaseNotes.rst:116 + + This check searches for those for loops which has a loop variable with + a "too small" type which means this type can't represent all values Please mark code-constructs with two backticks to emphasize them in documentation. in this case `for` Comment at: docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst:6 + +This check searches for those for loops which has a loop variable +with a "too small" type which means this type can't represent all values `for` Comment
[PATCH] D53830: [clang-tidy]: Abseil: new check 'abseil-upgrade-duration-conversions'
astrelni updated this revision to Diff 172402. astrelni added a comment. Herald added a subscriber: mgrang. Updated filtering of template instantiations to not use potentially costly hasDescendent matcher. https://reviews.llvm.org/D53830 Files: clang-tidy/abseil/AbseilTidyModule.cpp clang-tidy/abseil/CMakeLists.txt clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp clang-tidy/abseil/UpgradeDurationConversionsCheck.h docs/ReleaseNotes.rst docs/clang-tidy/checks/abseil-upgrade-duration-conversions.rst docs/clang-tidy/checks/list.rst test/clang-tidy/abseil-upgrade-duration-conversions.cpp Index: docs/clang-tidy/checks/list.rst === --- docs/clang-tidy/checks/list.rst +++ docs/clang-tidy/checks/list.rst @@ -12,6 +12,7 @@ abseil-redundant-strcat-calls abseil-string-find-startswith abseil-str-cat-append + abseil-upgrade-duration-conversions android-cloexec-accept android-cloexec-accept4 android-cloexec-creat Index: docs/clang-tidy/checks/abseil-upgrade-duration-conversions.rst === --- docs/clang-tidy/checks/abseil-upgrade-duration-conversions.rst +++ docs/clang-tidy/checks/abseil-upgrade-duration-conversions.rst @@ -0,0 +1,43 @@ +.. title:: clang-tidy - abseil-upgrade-duration-conversions + +abseil-upgrade-duration-conversions +=== + +Finds calls to ``absl::Duration`` arithmetic operators and factories whose +argument needs an explicit cast to continue compiling after upcoming API +changes. + +The operators ``*=``, ``/=``, ``*``, and ``/`` for ``absl::Duration`` currently +accept an argument of class type that is convertible to an arithmetic type. Such +a call currently converts the value to an ``int64_t``, even in a case such as +``std::atomic`` that would result in lossy conversion. + +Additionally, the ``absl::Duration`` factory functions (``absl::Hours``, +``absl::Minutes``, etc) currently accept an ``int64_t`` or a floating-point +type. Similar to the arithmetic operators, calls with an argument of class type +that is convertible to an arithmetic type go through the ``int64_t`` path. + +These operators and factories will be changed to only accept arithmetic types to +prevent unintended behavior. After these changes are released, passing an +argument of class type will no longer compile, even if the type is implicitly +convertible to an arithmetic type. + +Here are example fixes created by this check: + +.. code-block:: c++ + + std::atomic a; + absl::Duration d = absl::Milliseconds(a); + d *= a; + +becomes + +.. code-block:: c++ + + std::atomic a; + absl::Duration d = absl::Milliseconds(static_cast(a)); + d *= static_cast(a); + +Note that this check always adds a cast to ``int64_t`` in order to preserve the +current behavior of user code. It is possible that this uncovers unintended +behavior due to types implicitly convertible to a floating-point type. Index: test/clang-tidy/abseil-upgrade-duration-conversions.cpp === --- test/clang-tidy/abseil-upgrade-duration-conversions.cpp +++ test/clang-tidy/abseil-upgrade-duration-conversions.cpp @@ -0,0 +1,451 @@ +// RUN: %check_clang_tidy %s abseil-upgrade-duration-conversions %t + +using int64_t = long long; + +// Partial implementation of relevant APIs from +// https://github.com/abseil/abseil-cpp/blob/master/absl/time/time.h +namespace absl { + +class Duration { +public: + Duration *=(int64_t r); + Duration *=(float r); + Duration *=(double r); + template Duration *=(T r); + + Duration /=(int64_t r); + Duration /=(float r); + Duration /=(double r); + template Duration /=(T r); +}; + +template Duration operator*(Duration lhs, T rhs); +template Duration operator*(T lhs, Duration rhs); +template Duration operator/(Duration lhs, T rhs); + +constexpr Duration Nanoseconds(int64_t n); +constexpr Duration Microseconds(int64_t n); +constexpr Duration Milliseconds(int64_t n); +constexpr Duration Seconds(int64_t n); +constexpr Duration Minutes(int64_t n); +constexpr Duration Hours(int64_t n); + +template struct EnableIfFloatImpl {}; +template <> struct EnableIfFloatImpl { typedef int Type; }; +template <> struct EnableIfFloatImpl { typedef int Type; }; +template <> struct EnableIfFloatImpl { typedef int Type; }; +template using EnableIfFloat = typename EnableIfFloatImpl::Type; + +template = 0> Duration Nanoseconds(T n); +template = 0> Duration Microseconds(T n); +template = 0> Duration Milliseconds(T n); +template = 0> Duration Seconds(T n); +template = 0> Duration Minutes(T n); +template = 0> Duration Hours(T n); + +} // namespace absl + +template struct ConvertibleTo { + operator T() const; +}; + +template +ConvertibleTo operator+(ConvertibleTo, ConvertibleTo); + +template +ConvertibleTo operator*(ConvertibleTo, ConvertibleTo); + +void arithmeticOperatorBasicPositive() {
[PATCH] D53998: [COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry
mgrang accepted this revision. mgrang added a comment. This revision is now accepted and ready to land. Since this is the same as https://reviews.llvm.org/D53684, we can go ahead and close this. Repository: rC Clang https://reviews.llvm.org/D53998 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r346024 - [COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry
Author: mgrang Date: Fri Nov 2 11:10:07 2018 New Revision: 346024 URL: http://llvm.org/viewvc/llvm-project?rev=346024=rev Log: [COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry Summary: ARM64 setjmp expects sp on entry instead of framepointer. Patch by: Yin Ma (yi...@codeaurora.org) Reviewers: mgrang, eli.friedman, ssijaric, mstorsjo, rnk, compnerd Reviewed By: mgrang Subscribers: efriedma, javed.absar, kristof.beyls, chrib, cfe-commits Differential Revision: https://reviews.llvm.org/D53998 Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp cfe/trunk/test/CodeGen/ms-setjmp.c Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=346024=346023=346024=diff == --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original) +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Fri Nov 2 11:10:07 2018 @@ -711,8 +711,11 @@ static RValue EmitMSVCRTSetJmp(CodeGenFu } else { Name = SJKind == MSVCSetJmpKind::_setjmp ? "_setjmp" : "_setjmpex"; Arg1Ty = CGF.Int8PtrTy; -Arg1 = CGF.Builder.CreateCall(CGF.CGM.getIntrinsic(Intrinsic::frameaddress), - llvm::ConstantInt::get(CGF.Int32Ty, 0)); +if (CGF.getTarget().getTriple().getArch() == llvm::Triple::aarch64) { + Arg1 = CGF.Builder.CreateCall(CGF.CGM.getIntrinsic(Intrinsic::sponentry)); +} else + Arg1 = CGF.Builder.CreateCall(CGF.CGM.getIntrinsic(Intrinsic::frameaddress), +llvm::ConstantInt::get(CGF.Int32Ty, 0)); } // Mark the call site and declaration with ReturnsTwice. Modified: cfe/trunk/test/CodeGen/ms-setjmp.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-setjmp.c?rev=346024=346023=346024=diff == --- cfe/trunk/test/CodeGen/ms-setjmp.c (original) +++ cfe/trunk/test/CodeGen/ms-setjmp.c Fri Nov 2 11:10:07 2018 @@ -25,7 +25,7 @@ int test_setjmp() { // X64-NEXT: ret i32 %[[call]] // AARCH64-LABEL: define dso_local i32 @test_setjmp - // AARCH64: %[[addr:.*]] = call i8* @llvm.frameaddress(i32 0) + // AARCH64: %[[addr:.*]] = call i8* @llvm.sponentry() // AARCH64: %[[call:.*]] = call i32 @_setjmpex(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @jb, i32 0, i32 0), i8* %[[addr]]) // AARCH64-NEXT: ret i32 %[[call]] } @@ -38,7 +38,7 @@ int test_setjmpex() { // X64-NEXT: ret i32 %[[call]] // AARCH64-LABEL: define dso_local i32 @test_setjmpex - // AARCH64: %[[addr:.*]] = call i8* @llvm.frameaddress(i32 0) + // AARCH64: %[[addr:.*]] = call i8* @llvm.sponentry() // AARCH64: %[[call:.*]] = call i32 @_setjmpex(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @jb, i32 0, i32 0), i8* %[[addr]]) // AARCH64-NEXT: ret i32 %[[call]] } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r346022 - Creating release candidate rc2 from release_701 branch
Author: tstellar Date: Fri Nov 2 11:09:42 2018 New Revision: 346022 URL: http://llvm.org/viewvc/llvm-project?rev=346022=rev Log: Creating release candidate rc2 from release_701 branch Added: libunwind/tags/RELEASE_701/rc2/ (props changed) - copied from r346021, libunwind/branches/release_70/ Propchange: libunwind/tags/RELEASE_701/rc2/ -- svn:mergeinfo = /libunwind/trunk:339217 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable
whisperity added inline comments. Comment at: docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst:18 +This for loop is an infinite loop because the short type can't represent all +values in the [0..size] interval. + Format the interval as code (monospace): `[0 .. size]` Comment at: docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst:24 + +int doSometinhg(const std::vector& items) { +for (short i = 0; i < items.size(); ++i) {} There is a typo in the function's name. Comment at: test/clang-tidy/bugprone-too-small-loop-variable.cpp:116 + +// TODO: handle those cases when the loop condition contains a floating point expression +void voidDoubleForCond() { (Misc: You might want to check out D52730 for floats later down the line.) Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D53974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D54010: [CodeGen] Fix a crash when updating a zeroinitialize designated initializer
This revision was automatically updated to reflect the committed changes. Closed by commit rC346004: [CodeGen] Fix a crash when updating a designated initializer (authored by epilk, committed by ). Changed prior to commit: https://reviews.llvm.org/D54010?vs=172306=172396#toc Repository: rC Clang https://reviews.llvm.org/D54010 Files: lib/CodeGen/CGExprConstant.cpp test/CodeGen/designated-initializers.c Index: test/CodeGen/designated-initializers.c === --- test/CodeGen/designated-initializers.c +++ test/CodeGen/designated-initializers.c @@ -142,14 +142,26 @@ // CHECK: @lab = global { [4 x i8], i32 } { [4 x i8] undef, i32 123 } struct leading_anon_bitfield { int : 32; int n; } lab = { .n = 123 }; +// rdar://45691981 +struct Base { + struct { +int A; + }; +}; +struct Derived { + struct Base B; +}; +struct Derived D = {{}, .B.A = 42}; +// CHECK: @D = global %struct.Derived { %struct.Base { %struct.anon.4 { i32 42 } } }, align 4 + void test1(int argc, char **argv) { // CHECK: internal global %struct.foo { i8* null, i32 1024 } static struct foo foo = { .b = 1024, }; - // CHECK: bitcast %union.anon.4* %u2 + // CHECK: bitcast %union.anon.5* %u2 // CHECK: call void @llvm.memset union { int i; float f; } u2 = { }; Index: lib/CodeGen/CGExprConstant.cpp === --- lib/CodeGen/CGExprConstant.cpp +++ lib/CodeGen/CGExprConstant.cpp @@ -47,7 +47,7 @@ public: static llvm::Constant *BuildStruct(ConstantEmitter , ConstExprEmitter *ExprEmitter, - llvm::ConstantStruct *Base, + llvm::Constant *Base, InitListExpr *Updater, QualType ValTy); static llvm::Constant *BuildStruct(ConstantEmitter , @@ -76,7 +76,7 @@ void ConvertStructToPacked(); bool Build(InitListExpr *ILE); - bool Build(ConstExprEmitter *Emitter, llvm::ConstantStruct *Base, + bool Build(ConstExprEmitter *Emitter, llvm::Constant *Base, InitListExpr *Updater); bool Build(const APValue , const RecordDecl *RD, bool IsPrimaryBase, const CXXRecordDecl *VTableClass, CharUnits BaseOffset); @@ -566,7 +566,7 @@ llvm::Constant *ConstStructBuilder::BuildStruct(ConstantEmitter , ConstExprEmitter *ExprEmitter, -llvm::ConstantStruct *Base, +llvm::Constant *Base, InitListExpr *Updater, QualType ValTy) { ConstStructBuilder Builder(Emitter); @@ -1027,8 +1027,8 @@ } if (destType->isRecordType()) - return ConstStructBuilder::BuildStruct(Emitter, this, - dyn_cast(Base), Updater, destType); + return ConstStructBuilder::BuildStruct(Emitter, this, Base, Updater, + destType); return nullptr; } @@ -1103,15 +1103,15 @@ } // end anonymous namespace. bool ConstStructBuilder::Build(ConstExprEmitter *ExprEmitter, - llvm::ConstantStruct *Base, + llvm::Constant *Base, InitListExpr *Updater) { assert(Base && "base expression should not be empty"); QualType ExprType = Updater->getType(); RecordDecl *RD = ExprType->getAs()->getDecl(); const ASTRecordLayout = CGM.getContext().getASTRecordLayout(RD); const llvm::StructLayout *BaseLayout = CGM.getDataLayout().getStructLayout( - Base->getType()); + cast(Base->getType())); unsigned FieldNo = -1; unsigned ElementNo = 0; @@ -1132,7 +1132,7 @@ if (Field->isUnnamedBitfield()) continue; -llvm::Constant *EltInit = Base->getOperand(ElementNo); +llvm::Constant *EltInit = Base->getAggregateElement(ElementNo); // Bail out if the type of the ConstantStruct does not have the same layout // as the type of the InitListExpr. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r346004 - [CodeGen] Fix a crash when updating a designated initializer
Author: epilk Date: Fri Nov 2 10:36:58 2018 New Revision: 346004 URL: http://llvm.org/viewvc/llvm-project?rev=346004=rev Log: [CodeGen] Fix a crash when updating a designated initializer We need to handle the ConstantAggregateZero case here too. rdar://45691981 Differential revision: https://reviews.llvm.org/D54010 Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp cfe/trunk/test/CodeGen/designated-initializers.c Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=346004=346003=346004=diff == --- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original) +++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Fri Nov 2 10:36:58 2018 @@ -47,7 +47,7 @@ class ConstStructBuilder { public: static llvm::Constant *BuildStruct(ConstantEmitter , ConstExprEmitter *ExprEmitter, - llvm::ConstantStruct *Base, + llvm::Constant *Base, InitListExpr *Updater, QualType ValTy); static llvm::Constant *BuildStruct(ConstantEmitter , @@ -76,7 +76,7 @@ private: void ConvertStructToPacked(); bool Build(InitListExpr *ILE); - bool Build(ConstExprEmitter *Emitter, llvm::ConstantStruct *Base, + bool Build(ConstExprEmitter *Emitter, llvm::Constant *Base, InitListExpr *Updater); bool Build(const APValue , const RecordDecl *RD, bool IsPrimaryBase, const CXXRecordDecl *VTableClass, CharUnits BaseOffset); @@ -566,7 +566,7 @@ llvm::Constant *ConstStructBuilder::Fina llvm::Constant *ConstStructBuilder::BuildStruct(ConstantEmitter , ConstExprEmitter *ExprEmitter, -llvm::ConstantStruct *Base, +llvm::Constant *Base, InitListExpr *Updater, QualType ValTy) { ConstStructBuilder Builder(Emitter); @@ -1027,8 +1027,8 @@ public: } if (destType->isRecordType()) - return ConstStructBuilder::BuildStruct(Emitter, this, - dyn_cast(Base), Updater, destType); + return ConstStructBuilder::BuildStruct(Emitter, this, Base, Updater, + destType); return nullptr; } @@ -1103,7 +1103,7 @@ public: } // end anonymous namespace. bool ConstStructBuilder::Build(ConstExprEmitter *ExprEmitter, - llvm::ConstantStruct *Base, + llvm::Constant *Base, InitListExpr *Updater) { assert(Base && "base expression should not be empty"); @@ -,7 +,7 @@ bool ConstStructBuilder::Build(ConstExpr RecordDecl *RD = ExprType->getAs()->getDecl(); const ASTRecordLayout = CGM.getContext().getASTRecordLayout(RD); const llvm::StructLayout *BaseLayout = CGM.getDataLayout().getStructLayout( - Base->getType()); + cast(Base->getType())); unsigned FieldNo = -1; unsigned ElementNo = 0; @@ -1132,7 +1132,7 @@ bool ConstStructBuilder::Build(ConstExpr if (Field->isUnnamedBitfield()) continue; -llvm::Constant *EltInit = Base->getOperand(ElementNo); +llvm::Constant *EltInit = Base->getAggregateElement(ElementNo); // Bail out if the type of the ConstantStruct does not have the same layout // as the type of the InitListExpr. Modified: cfe/trunk/test/CodeGen/designated-initializers.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/designated-initializers.c?rev=346004=346003=346004=diff == --- cfe/trunk/test/CodeGen/designated-initializers.c (original) +++ cfe/trunk/test/CodeGen/designated-initializers.c Fri Nov 2 10:36:58 2018 @@ -142,6 +142,18 @@ union_16644_t union_16644_instance_4[2] // CHECK: @lab = global { [4 x i8], i32 } { [4 x i8] undef, i32 123 } struct leading_anon_bitfield { int : 32; int n; } lab = { .n = 123 }; +// rdar://45691981 +struct Base { + struct { +int A; + }; +}; +struct Derived { + struct Base B; +}; +struct Derived D = {{}, .B.A = 42}; +// CHECK: @D = global %struct.Derived { %struct.Base { %struct.anon.4 { i32 42 } } }, align 4 + void test1(int argc, char **argv) { // CHECK: internal global %struct.foo { i8* null, i32 1024 } @@ -149,7 +161,7 @@ void test1(int argc, char **argv) .b = 1024, }; - // CHECK: bitcast %union.anon.4* %u2 + // CHECK: bitcast %union.anon.5* %u2 // CHECK: call void @llvm.memset union { int i; float f; } u2 = { }; ___ cfe-commits mailing list
[PATCH] D52615: Handle -fsanitize-address-poison-class-member-array-new-cookie in the driver and propagate it to cc1
filcab added a comment. Thanks for the review. Unfortunately, I forgot to edit the commit message. Let's hope no one gets too confused (phab reviews will be up anyway, so should be easy to figure out). Filipe Repository: rL LLVM https://reviews.llvm.org/D52615 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D52615: Handle -fsanitize-address-poison-class-member-array-new-cookie in the driver and propagate it to cc1
This revision was automatically updated to reflect the committed changes. Closed by commit rL346001: Change -fsanitize-address-poison-class-member-array-new-cookie to -fsanitize… (authored by filcab, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D52615 Files: cfe/trunk/docs/ClangCommandLineReference.rst cfe/trunk/docs/UsersManual.rst cfe/trunk/include/clang/Driver/Options.td cfe/trunk/include/clang/Driver/SanitizerArgs.h cfe/trunk/include/clang/Frontend/CodeGenOptions.def cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp cfe/trunk/lib/Driver/SanitizerArgs.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/test/CodeGen/address-sanitizer-and-array-cookie.cpp cfe/trunk/test/Driver/fsanitize.c Index: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp === --- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp +++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp @@ -1916,7 +1916,7 @@ // Handle the array cookie specially in ASan. if (CGM.getLangOpts().Sanitize.has(SanitizerKind::Address) && AS == 0 && (expr->getOperatorNew()->isReplaceableGlobalAllocationFunction() || - CGM.getCodeGenOpts().SanitizeAddressPoisonClassMemberArrayNewCookie)) { + CGM.getCodeGenOpts().SanitizeAddressPoisonCustomArrayCookie)) { // The store to the CookiePtr does not need to be instrumented. CGM.getSanitizerMetadata()->disableSanitizerForInstruction(SI); llvm::FunctionType *FTy = Index: cfe/trunk/lib/Driver/SanitizerArgs.cpp === --- cfe/trunk/lib/Driver/SanitizerArgs.cpp +++ cfe/trunk/lib/Driver/SanitizerArgs.cpp @@ -724,6 +724,11 @@ options::OPT_fsanitize_address_use_after_scope, options::OPT_fno_sanitize_address_use_after_scope, AsanUseAfterScope); +AsanPoisonCustomArrayCookie = Args.hasFlag( +options::OPT_fsanitize_address_poison_custom_array_cookie, +options::OPT_fno_sanitize_address_poison_custom_array_cookie, +AsanPoisonCustomArrayCookie); + // As a workaround for a bug in gold 2.26 and earlier, dead stripping of // globals in ASan is disabled by default on ELF targets. // See https://sourceware.org/bugzilla/show_bug.cgi?id=19002 @@ -897,6 +902,9 @@ if (AsanUseAfterScope) CmdArgs.push_back("-fsanitize-address-use-after-scope"); + if (AsanPoisonCustomArrayCookie) +CmdArgs.push_back("-fsanitize-address-poison-custom-array-cookie"); + if (AsanGlobalsDeadStripping) CmdArgs.push_back("-fsanitize-address-globals-dead-stripping"); Index: cfe/trunk/lib/Frontend/CompilerInvocation.cpp === --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp @@ -969,11 +969,11 @@ Args.hasArg(OPT_fsanitize_cfi_icall_generalize_pointers); Opts.SanitizeStats = Args.hasArg(OPT_fsanitize_stats); if (Arg *A = Args.getLastArg( - OPT_fsanitize_address_poison_class_member_array_new_cookie, - OPT_fno_sanitize_address_poison_class_member_array_new_cookie)) { -Opts.SanitizeAddressPoisonClassMemberArrayNewCookie = + OPT_fsanitize_address_poison_custom_array_cookie, + OPT_fno_sanitize_address_poison_custom_array_cookie)) { +Opts.SanitizeAddressPoisonCustomArrayCookie = A->getOption().getID() == -OPT_fsanitize_address_poison_class_member_array_new_cookie; +OPT_fsanitize_address_poison_custom_array_cookie; } if (Arg *A = Args.getLastArg(OPT_fsanitize_address_use_after_scope, OPT_fno_sanitize_address_use_after_scope)) { Index: cfe/trunk/docs/UsersManual.rst === --- cfe/trunk/docs/UsersManual.rst +++ cfe/trunk/docs/UsersManual.rst @@ -3000,8 +3000,8 @@ -fno-debug-macroDo not emit macro debug information -fno-delayed-template-parsing Disable delayed template parsing - -fno-sanitize-address-poison-class-member-array-new-cookie - Disable poisoning array cookies when using class member operator new[] in AddressSanitizer + -fno-sanitize-address-poison-custom-array-cookie + Disable poisoning array cookies when using custom operator new[] in AddressSanitizer -fno-sanitize-address-use-after-scope Disable use-after-scope detection in AddressSanitizer -fno-sanitize-blacklist Don't use blacklist file for sanitizers @@ -3037,8 +3037,8 @@ Level of field padding for AddressSanitizer -fsanitize-address-globals-dead-stripping Enable linker dead stripping of globals in AddressSanitizer - -fsanitize-address-poison-class-member-array-new-cookie -
[PATCH] D52615: Handle -fsanitize-address-poison-class-member-array-new-cookie in the driver and propagate it to cc1
This revision was automatically updated to reflect the committed changes. Closed by commit rC346001: Change -fsanitize-address-poison-class-member-array-new-cookie to -fsanitize… (authored by filcab, committed by ). Changed prior to commit: https://reviews.llvm.org/D52615?vs=172376=172392#toc Repository: rL LLVM https://reviews.llvm.org/D52615 Files: docs/ClangCommandLineReference.rst docs/UsersManual.rst include/clang/Driver/Options.td include/clang/Driver/SanitizerArgs.h include/clang/Frontend/CodeGenOptions.def lib/CodeGen/ItaniumCXXABI.cpp lib/Driver/SanitizerArgs.cpp lib/Frontend/CompilerInvocation.cpp test/CodeGen/address-sanitizer-and-array-cookie.cpp test/Driver/fsanitize.c Index: docs/ClangCommandLineReference.rst === --- docs/ClangCommandLineReference.rst +++ docs/ClangCommandLineReference.rst @@ -800,9 +800,11 @@ Enable linker dead stripping of globals in AddressSanitizer -.. option:: -fsanitize-address-poison-class-member-array-new-cookie, -fno-sanitize-address-poison-class-member-array-new-cookie +.. option:: -fsanitize-address-poison-custom-array-cookie, -fno-sanitize-address-poison-custom-array-cookie -Enable poisoning array cookies when using class member operator new\[\] in AddressSanitizer +Enable "poisoning" array cookies when allocating arrays with a custom operator new\[\] in Address Sanitizer, preventing accesses to the cookies from user code. An array cookie is a small implementation-defined header added to certain array allocations to record metadata such as the length of the array. Accesses to array cookies from user code are technically allowed by the standard but are more likely to be the result of an out-of-bounds array access. + +An operator new\[\] is "custom" if it is not one of the allocation functions provided by the C++ standard library. Array cookies from non-custom allocation functions are always poisoned. .. option:: -fsanitize-address-use-after-scope, -fno-sanitize-address-use-after-scope Index: docs/UsersManual.rst === --- docs/UsersManual.rst +++ docs/UsersManual.rst @@ -3000,8 +3000,8 @@ -fno-debug-macroDo not emit macro debug information -fno-delayed-template-parsing Disable delayed template parsing - -fno-sanitize-address-poison-class-member-array-new-cookie - Disable poisoning array cookies when using class member operator new[] in AddressSanitizer + -fno-sanitize-address-poison-custom-array-cookie + Disable poisoning array cookies when using custom operator new[] in AddressSanitizer -fno-sanitize-address-use-after-scope Disable use-after-scope detection in AddressSanitizer -fno-sanitize-blacklist Don't use blacklist file for sanitizers @@ -3037,8 +3037,8 @@ Level of field padding for AddressSanitizer -fsanitize-address-globals-dead-stripping Enable linker dead stripping of globals in AddressSanitizer - -fsanitize-address-poison-class-member-array-new-cookie - Enable poisoning array cookies when using class member operator new[] in AddressSanitizer + -fsanitize-address-poison-custom-array-cookie + Enable poisoning array cookies when using custom operator new[] in AddressSanitizer -fsanitize-address-use-after-scope Enable use-after-scope detection in AddressSanitizer -fsanitize-blacklist= Index: include/clang/Frontend/CodeGenOptions.def === --- include/clang/Frontend/CodeGenOptions.def +++ include/clang/Frontend/CodeGenOptions.def @@ -174,7 +174,7 @@ CODEGENOPT(SaveTempLabels, 1, 0) ///< Save temporary labels. CODEGENOPT(SanitizeAddressUseAfterScope , 1, 0) ///< Enable use-after-scope detection ///< in AddressSanitizer -CODEGENOPT(SanitizeAddressPoisonClassMemberArrayNewCookie, 1, +CODEGENOPT(SanitizeAddressPoisonCustomArrayCookie, 1, 0) ///< Enable poisoning operator new[] which is not a replaceable ///< global allocation function in AddressSanitizer CODEGENOPT(SanitizeAddressGlobalsDeadStripping, 1, 0) ///< Enable linker dead stripping Index: include/clang/Driver/SanitizerArgs.h === --- include/clang/Driver/SanitizerArgs.h +++ include/clang/Driver/SanitizerArgs.h @@ -36,6 +36,7 @@ int AsanFieldPadding = 0; bool SharedRuntime = false; bool AsanUseAfterScope = true; + bool AsanPoisonCustomArrayCookie = false; bool AsanGlobalsDeadStripping = false; bool LinkCXXRuntimes = false; bool NeedPIE = false; Index:
r346001 - Change -fsanitize-address-poison-class-member-array-new-cookie to -fsanitize-address-poison-custom-array-cookie
Author: filcab Date: Fri Nov 2 10:29:04 2018 New Revision: 346001 URL: http://llvm.org/viewvc/llvm-project?rev=346001=rev Log: Change -fsanitize-address-poison-class-member-array-new-cookie to -fsanitize-address-poison-custom-array-cookie Handle it in the driver and propagate it to cc1 Reviewers: rjmccall, kcc, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D52615 Modified: cfe/trunk/docs/ClangCommandLineReference.rst cfe/trunk/docs/UsersManual.rst cfe/trunk/include/clang/Driver/Options.td cfe/trunk/include/clang/Driver/SanitizerArgs.h cfe/trunk/include/clang/Frontend/CodeGenOptions.def cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp cfe/trunk/lib/Driver/SanitizerArgs.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/test/CodeGen/address-sanitizer-and-array-cookie.cpp cfe/trunk/test/Driver/fsanitize.c Modified: cfe/trunk/docs/ClangCommandLineReference.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCommandLineReference.rst?rev=346001=346000=346001=diff == --- cfe/trunk/docs/ClangCommandLineReference.rst (original) +++ cfe/trunk/docs/ClangCommandLineReference.rst Fri Nov 2 10:29:04 2018 @@ -800,9 +800,11 @@ Level of field padding for AddressSaniti Enable linker dead stripping of globals in AddressSanitizer -.. option:: -fsanitize-address-poison-class-member-array-new-cookie, -fno-sanitize-address-poison-class-member-array-new-cookie +.. option:: -fsanitize-address-poison-custom-array-cookie, -fno-sanitize-address-poison-custom-array-cookie -Enable poisoning array cookies when using class member operator new\[\] in AddressSanitizer +Enable "poisoning" array cookies when allocating arrays with a custom operator new\[\] in Address Sanitizer, preventing accesses to the cookies from user code. An array cookie is a small implementation-defined header added to certain array allocations to record metadata such as the length of the array. Accesses to array cookies from user code are technically allowed by the standard but are more likely to be the result of an out-of-bounds array access. + +An operator new\[\] is "custom" if it is not one of the allocation functions provided by the C++ standard library. Array cookies from non-custom allocation functions are always poisoned. .. option:: -fsanitize-address-use-after-scope, -fno-sanitize-address-use-after-scope Modified: cfe/trunk/docs/UsersManual.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=346001=346000=346001=diff == --- cfe/trunk/docs/UsersManual.rst (original) +++ cfe/trunk/docs/UsersManual.rst Fri Nov 2 10:29:04 2018 @@ -3000,8 +3000,8 @@ Execute ``clang-cl /?`` to see a list of -fno-debug-macroDo not emit macro debug information -fno-delayed-template-parsing Disable delayed template parsing - -fno-sanitize-address-poison-class-member-array-new-cookie - Disable poisoning array cookies when using class member operator new[] in AddressSanitizer + -fno-sanitize-address-poison-custom-array-cookie + Disable poisoning array cookies when using custom operator new[] in AddressSanitizer -fno-sanitize-address-use-after-scope Disable use-after-scope detection in AddressSanitizer -fno-sanitize-blacklist Don't use blacklist file for sanitizers @@ -3037,8 +3037,8 @@ Execute ``clang-cl /?`` to see a list of Level of field padding for AddressSanitizer -fsanitize-address-globals-dead-stripping Enable linker dead stripping of globals in AddressSanitizer - -fsanitize-address-poison-class-member-array-new-cookie - Enable poisoning array cookies when using class member operator new[] in AddressSanitizer + -fsanitize-address-poison-custom-array-cookie + Enable poisoning array cookies when using custom operator new[] in AddressSanitizer -fsanitize-address-use-after-scope Enable use-after-scope detection in AddressSanitizer -fsanitize-blacklist= Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=346001=346000=346001=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Fri Nov 2 10:29:04 2018 @@ -971,14 +971,14 @@ def fno_sanitize_address_use_after_scope Group, Flags<[CoreOption, DriverOption]>,
[PATCH] D52998: [benchmark] Disable exceptions in Microsoft STL
eandrews added a comment. Thanks! https://reviews.llvm.org/D52998 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r345993 - Didn't -> didnt, because #errors complains about untermianted '
On Fri, Nov 2, 2018 at 12:34 PM Kristof Umann via cfe-commits wrote: > > Author: szelethus > Date: Fri Nov 2 09:32:15 2018 > New Revision: 345993 > > URL: http://llvm.org/viewvc/llvm-project?rev=345993=rev > Log: > Didn't -> didnt, because #errors complains about untermianted ' Why not quote the string instead of making it ungrammatical? e.g., #error "If you didn't include this file with the intent of generating methods, define both 'ANALYZER_OPTION' " \ "and 'ANALYZER_OPTION_DEPENDS_ON_USER_MODE' macros!" ~Aaron > > Modified: > cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def > > Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def?rev=345993=345992=345993=diff > == > --- cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def (original) > +++ cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def Fri Nov > 2 09:32:15 2018 > @@ -41,14 +41,14 @@ > > #ifdef ANALYZER_OPTION > #ifndef ANALYZER_OPTION_DEPENDS_ON_USER_MODE > -#error If you didn't include this file with the intent of generating > methods, \ > +#error If you didnt include this file with the intent of generating methods, > \ > define both 'ANALYZER_OPTION' and 'ANALYZER_OPTION_DEPENDS_ON_USER_MODE' > macros! > #endif > #endif > > #ifndef ANALYZER_OPTION_DEPENDS_ON_USER_MODE > #ifdef ANALYZER_OPTION > -#error If you didn't include this file with the intent of generating > methods, \ > +#error If you didnt include this file with the intent of generating methods, > \ > define both 'ANALYZER_OPTION' and 'ANALYZER_OPTION_DEPENDS_ON_USER_MODE' > macros! > #endif > #endif > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D52615: Handle -fsanitize-address-poison-class-member-array-new-cookie in the driver and propagate it to cc1
rjmccall accepted this revision. rjmccall added a comment. This revision is now accepted and ready to land. Thanks, LGTM. Repository: rC Clang https://reviews.llvm.org/D52615 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r345997 - Remove the duplicated definition of size_t
Author: szelethus Date: Fri Nov 2 10:00:07 2018 New Revision: 345997 URL: http://llvm.org/viewvc/llvm-project?rev=345997=rev Log: Remove the duplicated definition of size_t So hopefully windows won't complain. Modified: cfe/trunk/test/Analysis/llvm-conventions.cpp Modified: cfe/trunk/test/Analysis/llvm-conventions.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/llvm-conventions.cpp?rev=345997=345996=345997=diff == --- cfe/trunk/test/Analysis/llvm-conventions.cpp (original) +++ cfe/trunk/test/Analysis/llvm-conventions.cpp Fri Nov 2 10:00:07 2018 @@ -7,7 +7,6 @@ // Forward declarations for StringRef tests. //===--===// -using size_t = unsigned long; using size_type = size_t; namespace std { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable
ztamas added a comment. Just to make it clear. I think this check is in a good shape now. I mean it catches usefull issues and also does not produce too many false positives, as I see. So my intention here is to get it in as it is now (of course after I fixed things reviewers find) and later it can be improved in separate patches (e.g. reduce false positives even more, handle other use cases like while loop etc.). I think it would be better to have smaller patches than polishing this big one until it gets ~prefect. In the test file I added some TODO comments. They were added as a documentation of future possibilities. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D53974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r345971 - Reapply Logging: make os_log buffer size an integer constant expression.
On 2 Nov 2018, at 15:28, Sam McCall wrote: > In that case, I don't think it makes sense to think of the format string > parser as part of the analyzer - as the build deps suggest, it's now part of > AST and gets reused by analyzer. (Similar to how the analyzer uses other bits > of AST/clang). If there are parts only relevant to analyzer, it'd be nice to > move them out of the AST library, but I don't know to what extent that's > feasible. The Scanf one could have been left there, but that seems even worse from a consistency point of view. > So it does seem to me like all the uses of analyzer namespaces are suspect - > moving code from Analyzer to AST is a semantic difference (the layers aren't > *just* about making the linker happy, after all!) But what it’s doing is still analysis. It seems like we’d just be making up another term for the sake of it if we changed it. Cheers. Tim ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D54036: [fix][clang-tidy] fix for r345961 that introduced a test failure on Windows builds
JonasToth closed this revision. JonasToth added a comment. Thank you very much for the patch! Committed in r345995. Repository: rL LLVM https://reviews.llvm.org/D54036 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r345995 - [fix][clang-tidy] fix for r345961 that introduced a test failure on Windows builds
Author: jonastoth Date: Fri Nov 2 09:36:21 2018 New Revision: 345995 URL: http://llvm.org/viewvc/llvm-project?rev=345995=rev Log: [fix][clang-tidy] fix for r345961 that introduced a test failure on Windows builds r345961 introduced a path check in .\tools\clang\tools\extra\test\clang-tidy\clang-tidy-run-with-database.cpp. r345961 added a check line for a path that only handled / on unix machines and not \ on windows machines. This patch handles both cases. Patch by TWeaver. Differential Revision: https://reviews.llvm.org/D54036 Modified: clang-tools-extra/trunk/test/clang-tidy/clang-tidy-run-with-database.cpp Modified: clang-tools-extra/trunk/test/clang-tidy/clang-tidy-run-with-database.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/clang-tidy-run-with-database.cpp?rev=345995=345994=345995=diff == --- clang-tools-extra/trunk/test/clang-tidy/clang-tidy-run-with-database.cpp (original) +++ clang-tools-extra/trunk/test/clang-tidy/clang-tidy-run-with-database.cpp Fri Nov 2 09:36:21 2018 @@ -11,7 +11,7 @@ // Regression test: shouldn't crash. // RUN: not clang-tidy --checks=-*,modernize-use-nullptr -p %T %T/compilation-database-test/b/not-exist -header-filter=.* 2>&1 | FileCheck %s -check-prefix=CHECK-NOT-EXIST -// CHECK-NOT-EXIST: Error while processing {{.*}}/not-exist. +// CHECK-NOT-EXIST: Error while processing {{.*[/\\]}}not-exist. // CHECK-NOT-EXIST: unable to handle compilation // CHECK-NOT-EXIST: Found compiler error ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r345993 - Didn't -> didnt, because #errors complains about untermianted '
Author: szelethus Date: Fri Nov 2 09:32:15 2018 New Revision: 345993 URL: http://llvm.org/viewvc/llvm-project?rev=345993=rev Log: Didn't -> didnt, because #errors complains about untermianted ' Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def?rev=345993=345992=345993=diff == --- cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def (original) +++ cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def Fri Nov 2 09:32:15 2018 @@ -41,14 +41,14 @@ #ifdef ANALYZER_OPTION #ifndef ANALYZER_OPTION_DEPENDS_ON_USER_MODE -#error If you didn't include this file with the intent of generating methods, \ +#error If you didnt include this file with the intent of generating methods, \ define both 'ANALYZER_OPTION' and 'ANALYZER_OPTION_DEPENDS_ON_USER_MODE' macros! #endif #endif #ifndef ANALYZER_OPTION_DEPENDS_ON_USER_MODE #ifdef ANALYZER_OPTION -#error If you didn't include this file with the intent of generating methods, \ +#error If you didnt include this file with the intent of generating methods, \ define both 'ANALYZER_OPTION' and 'ANALYZER_OPTION_DEPENDS_ON_USER_MODE' macros! #endif #endif ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D52998: [benchmark] Disable exceptions in Microsoft STL
kbobyrev accepted this revision. kbobyrev added a comment. This revision is now accepted and ready to land. The patch is good to go! Please add the commit reference to `utils/benchmark/README.LLVM` (https://github.com/google/benchmark/commit/a9b31c51b1ee7ec7b31438c647123c2cbac5d956) and the patch could be landed! https://reviews.llvm.org/D52998 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r345992 - [analyzer] Fix diagnostics/explicit-suppression.cpp
Author: maskray Date: Fri Nov 2 09:23:37 2018 New Revision: 345992 URL: http://llvm.org/viewvc/llvm-project?rev=345992=rev Log: [analyzer] Fix diagnostics/explicit-suppression.cpp *OI++ = *II++ is on line 670, not 668 Modified: cfe/trunk/test/Analysis/diagnostics/explicit-suppression.cpp Modified: cfe/trunk/test/Analysis/diagnostics/explicit-suppression.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/diagnostics/explicit-suppression.cpp?rev=345992=345991=345992=diff == --- cfe/trunk/test/Analysis/diagnostics/explicit-suppression.cpp (original) +++ cfe/trunk/test/Analysis/diagnostics/explicit-suppression.cpp Fri Nov 2 09:23:37 2018 @@ -19,6 +19,6 @@ class C { void testCopyNull(C *I, C *E) { std::copy(I, E, (C *)0); #ifndef SUPPRESSED - // expected-warning@../Inputs/system-header-simulator-cxx.h:668 {{Called C++ object pointer is null}} + // expected-warning@../Inputs/system-header-simulator-cxx.h:670 {{Called C++ object pointer is null}} #endif } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r345991 - [OPENMP][NVPTX]Use __kmpc_data_sharing_coalesced_push_stack function.
Author: abataev Date: Fri Nov 2 09:08:31 2018 New Revision: 345991 URL: http://llvm.org/viewvc/llvm-project?rev=345991=rev Log: [OPENMP][NVPTX]Use __kmpc_data_sharing_coalesced_push_stack function. Coalesced memory access requires use of the new function `__kmpc_data_sharing_coalesced_push_stack` instead of the `__kmpc_data_sharing_push_stack`. Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp cfe/trunk/test/OpenMP/declare_target_codegen_globalization.cpp cfe/trunk/test/OpenMP/nvptx_target_codegen.cpp Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp?rev=345991=345990=345991=diff == --- cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp (original) +++ cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp Fri Nov 2 09:08:31 2018 @@ -84,9 +84,9 @@ enum OpenMPRTLFunctionNVPTX { OMPRTL_NVPTX__kmpc_data_sharing_init_stack, /// Call to void __kmpc_data_sharing_init_stack_spmd(); OMPRTL_NVPTX__kmpc_data_sharing_init_stack_spmd, - /// Call to void* __kmpc_data_sharing_push_stack(size_t size, + /// Call to void* __kmpc_data_sharing_coalesced_push_stack(size_t size, /// int16_t UseSharedMemory); - OMPRTL_NVPTX__kmpc_data_sharing_push_stack, + OMPRTL_NVPTX__kmpc_data_sharing_coalesced_push_stack, /// Call to void __kmpc_data_sharing_pop_stack(void *a); OMPRTL_NVPTX__kmpc_data_sharing_pop_stack, /// Call to void __kmpc_begin_sharing_variables(void ***args, @@ -1745,14 +1745,14 @@ CGOpenMPRuntimeNVPTX::createNVPTXRuntime CGM.CreateRuntimeFunction(FnTy, "__kmpc_data_sharing_init_stack_spmd"); break; } - case OMPRTL_NVPTX__kmpc_data_sharing_push_stack: { -// Build void *__kmpc_data_sharing_push_stack(size_t size, + case OMPRTL_NVPTX__kmpc_data_sharing_coalesced_push_stack: { +// Build void *__kmpc_data_sharing_coalesced_push_stack(size_t size, // int16_t UseSharedMemory); llvm::Type *TypeParams[] = {CGM.SizeTy, CGM.Int16Ty}; auto *FnTy = llvm::FunctionType::get(CGM.VoidPtrTy, TypeParams, /*isVarArg=*/false); RTLFn = CGM.CreateRuntimeFunction( -FnTy, /*Name=*/"__kmpc_data_sharing_push_stack"); +FnTy, /*Name=*/"__kmpc_data_sharing_coalesced_push_stack"); break; } case OMPRTL_NVPTX__kmpc_data_sharing_pop_stack: { @@ -2105,10 +2105,10 @@ void CGOpenMPRuntimeNVPTX::emitGenericVa // the user, for now, default to global. llvm::Value *GlobalRecordSizeArg[] = { Size, CGF.Builder.getInt16(/*UseSharedMemory=*/0)}; - llvm::Value *GlobalRecValue = - CGF.EmitRuntimeCall(createNVPTXRuntimeFunction( - OMPRTL_NVPTX__kmpc_data_sharing_push_stack), - GlobalRecordSizeArg); + llvm::Value *GlobalRecValue = CGF.EmitRuntimeCall( + createNVPTXRuntimeFunction( + OMPRTL_NVPTX__kmpc_data_sharing_coalesced_push_stack), + GlobalRecordSizeArg); GlobalRecCastAddr = Bld.CreatePointerBitCastOrAddrSpaceCast( GlobalRecValue, GlobalRecPtrTy); CGF.EmitBlock(ExitBB); @@ -2182,10 +2182,10 @@ void CGOpenMPRuntimeNVPTX::emitGenericVa llvm::Value *GlobalRecordSizeArg[] = { llvm::ConstantInt::get(CGM.SizeTy, GlobalRecordSize), CGF.Builder.getInt16(/*UseSharedMemory=*/0)}; - llvm::Value *GlobalRecValue = - CGF.EmitRuntimeCall(createNVPTXRuntimeFunction( - OMPRTL_NVPTX__kmpc_data_sharing_push_stack), - GlobalRecordSizeArg); + llvm::Value *GlobalRecValue = CGF.EmitRuntimeCall( + createNVPTXRuntimeFunction( + OMPRTL_NVPTX__kmpc_data_sharing_coalesced_push_stack), + GlobalRecordSizeArg); GlobalRecCastAddr = Bld.CreatePointerBitCastOrAddrSpaceCast( GlobalRecValue, GlobalRecPtrTy); I->getSecond().GlobalRecordAddr = GlobalRecValue; @@ -2282,7 +2282,8 @@ void CGOpenMPRuntimeNVPTX::emitGenericVa llvm::Value *GlobalRecordSizeArg[] = { Size, CGF.Builder.getInt16(/*UseSharedMemory=*/0)}; llvm::Value *GlobalRecValue = CGF.EmitRuntimeCall( -createNVPTXRuntimeFunction(OMPRTL_NVPTX__kmpc_data_sharing_push_stack), +createNVPTXRuntimeFunction( +OMPRTL_NVPTX__kmpc_data_sharing_coalesced_push_stack), GlobalRecordSizeArg); llvm::Value *GlobalRecCastAddr = Bld.CreatePointerBitCastOrAddrSpaceCast( GlobalRecValue, CGF.ConvertTypeForMem(VD->getType())->getPointerTo()); Modified: cfe/trunk/test/OpenMP/declare_target_codegen_globalization.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/declare_target_codegen_globalization.cpp?rev=345991=345990=345991=diff == ---
[PATCH] D53856: [analyzer] Put llvm.Conventions back in alpha
This revision was automatically updated to reflect the committed changes. Closed by commit rC345990: [analyzer] Put llvm.Conventions back in alpha (authored by Szelethus, committed by ). Changed prior to commit: https://reviews.llvm.org/D53856?vs=172253=172380#toc Repository: rC Clang https://reviews.llvm.org/D53856 Files: include/clang/StaticAnalyzer/Checkers/Checkers.td lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp test/Analysis/Inputs/system-header-simulator-cxx.h test/Analysis/diagnostics/explicit-suppression.cpp test/Analysis/inner-pointer.cpp test/Analysis/llvm-conventions.cpp test/Analysis/temporaries.cpp www/analyzer/alpha_checks.html Index: include/clang/StaticAnalyzer/Checkers/Checkers.td === --- include/clang/StaticAnalyzer/Checkers/Checkers.td +++ include/clang/StaticAnalyzer/Checkers/Checkers.td @@ -83,6 +83,7 @@ def MPI : Package<"mpi">, InPackage; def LLVM : Package<"llvm">; +def LLVMAlpha : Package<"llvm">, InPackage, Hidden; // The APIModeling package is for checkers that model APIs and don't perform // any diagnostics. These checkers are always turned on; this package is @@ -730,7 +731,7 @@ //===--===// def LLVMConventionsChecker : Checker<"Conventions">, - InPackage, + InPackage, HelpText<"Check code for LLVM codebase conventions">, DescFile<"LLVMConventionsChecker.cpp">; Index: test/Analysis/inner-pointer.cpp === --- test/Analysis/inner-pointer.cpp +++ test/Analysis/inner-pointer.cpp @@ -1,43 +1,9 @@ -//RUN: %clang_analyze_cc1 -analyzer-checker=cplusplus.InnerPointer %s -analyzer-output=text -verify +// RUN: %clang_analyze_cc1 -analyzer-checker=cplusplus.InnerPointer \ +// RUN: %s -analyzer-output=text -verify +#include "Inputs/system-header-simulator-cxx.h" namespace std { -typedef int size_type; - -template -class basic_string { -public: - basic_string(); - basic_string(const CharT *s); - - ~basic_string(); - void clear(); - - basic_string =(const basic_string ); - basic_string +=(const basic_string ); - - const CharT *c_str() const; - const CharT *data() const; - CharT *data(); - - basic_string (size_type count, CharT ch); - basic_string (size_type count, CharT ch); - basic_string (size_type index, size_type count); - basic_string (size_type index, size_type count, CharT ch); - basic_string (size_type pos, size_type count, const basic_string ); - void pop_back(); - void push_back(CharT ch); - void reserve(size_type new_cap); - void resize(size_type count); - void shrink_to_fit(); - void swap(basic_string ); -}; - -typedef basic_string string; -typedef basic_string wstring; -typedef basic_string u16string; -typedef basic_string u32string; - template void func_ref(T ); Index: test/Analysis/llvm-conventions.cpp === --- test/Analysis/llvm-conventions.cpp +++ test/Analysis/llvm-conventions.cpp @@ -0,0 +1,226 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.llvm.Conventions \ +// RUN: -std=c++14 -verify %s + +#include "Inputs/system-header-simulator-cxx.h" + +//===--===// +// Forward declarations for StringRef tests. +//===--===// + +using size_t = unsigned long; +using size_type = size_t; + +namespace std { + +template +struct numeric_limits { const static bool is_signed; }; + +} // end of namespace std + +namespace llvm { + +template +struct iterator_range; + +template +struct function_ref; + +struct hash_code; + +template +struct SmallVectorImpl; + +struct APInt; + +class StringRef { +public: + static const size_t npos = ~size_t(0); + using iterator = const char *; + using const_iterator = const char *; + using size_type = size_t; + + /*implicit*/ StringRef() = default; + StringRef(std::nullptr_t) = delete; + /*implicit*/ StringRef(const char *Str); + /*implicit*/ constexpr StringRef(const char *data, size_t length); + /*implicit*/ StringRef(const std::string ); + + static StringRef withNullAsEmpty(const char *data); + iterator begin() const; + iterator end() const; + const unsigned char *bytes_begin() const; + const unsigned char *bytes_end() const; + iterator_range bytes() const; + const char *data() const; + bool empty() const; + size_t size() const; + char front() const; + char back() const; + template + StringRef copy(Allocator ) const; + bool equals(StringRef RHS) const; + bool equals_lower(StringRef RHS) const; + int compare(StringRef RHS) const; + int compare_lower(StringRef RHS) const; + int compare_numeric(StringRef RHS) const; + unsigned edit_distance(StringRef Other, bool AllowReplacements = true, + unsigned MaxEditDistance =
[PATCH] D53856: [analyzer] Put llvm.Conventions back in alpha
This revision was automatically updated to reflect the committed changes. Closed by commit rL345990: [analyzer] Put llvm.Conventions back in alpha (authored by Szelethus, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D53856?vs=172253=172379#toc Repository: rC Clang https://reviews.llvm.org/D53856 Files: cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td cfe/trunk/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp cfe/trunk/test/Analysis/Inputs/system-header-simulator-cxx.h cfe/trunk/test/Analysis/diagnostics/explicit-suppression.cpp cfe/trunk/test/Analysis/inner-pointer.cpp cfe/trunk/test/Analysis/llvm-conventions.cpp cfe/trunk/test/Analysis/temporaries.cpp cfe/trunk/www/analyzer/alpha_checks.html Index: cfe/trunk/www/analyzer/alpha_checks.html === --- cfe/trunk/www/analyzer/alpha_checks.html +++ cfe/trunk/www/analyzer/alpha_checks.html @@ -27,6 +27,7 @@ Clone Alpha Checkers Core Alpha Checkers C++ Alpha Checkers +LLVM Checkers Variable Argument Alpha Checkers Dead Code Alpha Checkers OS X Alpha Checkers @@ -583,6 +584,31 @@ + +LLVM Checkers + + +Name, DescriptionExample + + + +alpha.llvm.Conventions +(C) +Check code for LLVM codebase conventions: + + A StringRef should not be bound to a temporary std::string + whose lifetime is shorter than the StringRef's. + Clang AST nodes should not have fields that can allocate memory. + + + + + + + + + + OS X Alpha Checkers Index: cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td === --- cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td +++ cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td @@ -83,6 +83,7 @@ def MPI : Package<"mpi">, InPackage; def LLVM : Package<"llvm">; +def LLVMAlpha : Package<"llvm">, InPackage, Hidden; // The APIModeling package is for checkers that model APIs and don't perform // any diagnostics. These checkers are always turned on; this package is @@ -730,7 +731,7 @@ //===--===// def LLVMConventionsChecker : Checker<"Conventions">, - InPackage, + InPackage, HelpText<"Check code for LLVM codebase conventions">, DescFile<"LLVMConventionsChecker.cpp">; Index: cfe/trunk/test/Analysis/llvm-conventions.cpp === --- cfe/trunk/test/Analysis/llvm-conventions.cpp +++ cfe/trunk/test/Analysis/llvm-conventions.cpp @@ -0,0 +1,226 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.llvm.Conventions \ +// RUN: -std=c++14 -verify %s + +#include "Inputs/system-header-simulator-cxx.h" + +//===--===// +// Forward declarations for StringRef tests. +//===--===// + +using size_t = unsigned long; +using size_type = size_t; + +namespace std { + +template +struct numeric_limits { const static bool is_signed; }; + +} // end of namespace std + +namespace llvm { + +template +struct iterator_range; + +template +struct function_ref; + +struct hash_code; + +template +struct SmallVectorImpl; + +struct APInt; + +class StringRef { +public: + static const size_t npos = ~size_t(0); + using iterator = const char *; + using const_iterator = const char *; + using size_type = size_t; + + /*implicit*/ StringRef() = default; + StringRef(std::nullptr_t) = delete; + /*implicit*/ StringRef(const char *Str); + /*implicit*/ constexpr StringRef(const char *data, size_t length); + /*implicit*/ StringRef(const std::string ); + + static StringRef withNullAsEmpty(const char *data); + iterator begin() const; + iterator end() const; + const unsigned char *bytes_begin() const; + const unsigned char *bytes_end() const; + iterator_range bytes() const; + const char *data() const; + bool empty() const; + size_t size() const; + char front() const; + char back() const; + template + StringRef copy(Allocator ) const; + bool equals(StringRef RHS) const; + bool equals_lower(StringRef RHS) const; + int compare(StringRef RHS) const; + int compare_lower(StringRef RHS) const; + int compare_numeric(StringRef RHS) const; + unsigned edit_distance(StringRef Other, bool AllowReplacements = true, + unsigned MaxEditDistance = 0) const; + std::string str() const; + char operator[](size_t Index) const; + template + typename std::enable_if::value, + StringRef>::type & + operator=(T &) = delete; + operator std::string() const; + bool startswith(StringRef Prefix) const; + bool startswith_lower(StringRef Prefix) const; + bool endswith(StringRef Suffix) const; + bool endswith_lower(StringRef Suffix) const; + size_t find(char C, size_t From = 0) const; + size_t