[PATCH] D47630: [Sema] Allow creating types with multiple of the same addrspace.
ebevhan added a comment. Thanks! I do not have commit access, so it would be great if someone could commit this. https://reviews.llvm.org/D47630 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48188: [SPIR] Prevent SPIR targets from using half conversion intrinsics
SjoerdMeijer added a comment. No problem, will commit this today. https://reviews.llvm.org/D48188 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47953: [builtin] Add bitfield support for __builtin_dump_struct
paulsemel added a comment. I will for sure add tests @lebedev.ri . Fact is that, for the moment, this is not working as expected. This is why I am asking for a bit of help about this bitfield handling :) Comment at: lib/CodeGen/CGBuiltin.cpp:1250 + if (Info.IsSigned) { +unsigned HighBits = Info.StorageSize - Info.Offset - Info.Size; +if (HighBits) aaron.ballman wrote: > What happens if this overflows due to being < 0? How could this be < 0 ? If it is, it means that there was a problem during bitfield construction isn't it ? I mean StorageSize is always greater that Offset + Size Repository: rC Clang https://reviews.llvm.org/D47953 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r335103 - [Sema] Allow creating types with multiple of the same addrspace.
Author: bader Date: Wed Jun 20 01:31:24 2018 New Revision: 335103 URL: http://llvm.org/viewvc/llvm-project?rev=335103&view=rev Log: [Sema] Allow creating types with multiple of the same addrspace. Summary: The comment with the OpenCL clause about this clearly says: "No type shall be qualified by qualifiers for two or more different address spaces." This must mean that two or more qualifiers for the _same_ address space is allowed. However, it is likely unintended by the programmer, so emit a warning. For dependent address space types, reject them like before since we cannot know what the address space will be. Patch by Bevin Hansson (ebevhan). Reviewers: Anastasia Reviewed By: Anastasia Subscribers: bader, cfe-commits Differential Revision: https://reviews.llvm.org/D47630 Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/Sema/SemaType.cpp cfe/trunk/test/Sema/address_spaces.c cfe/trunk/test/SemaOpenCL/address-spaces.cl Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=335103&r1=335102&r2=335103&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Jun 20 01:31:24 2018 @@ -2576,6 +2576,9 @@ def err_attribute_address_space_too_high "address space is larger than the maximum supported (%0)">; def err_attribute_address_multiple_qualifiers : Error< "multiple address spaces specified for type">; +def warn_attribute_address_multiple_identical_qualifiers : Warning< + "multiple identical address spaces specified for type">, + InGroup; def err_attribute_address_function_type : Error< "function type may not be qualified with an address space">; def err_as_qualified_auto_decl : Error< Modified: cfe/trunk/lib/Sema/SemaType.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=335103&r1=335102&r2=335103&view=diff == --- cfe/trunk/lib/Sema/SemaType.cpp (original) +++ cfe/trunk/lib/Sema/SemaType.cpp Wed Jun 20 01:31:24 2018 @@ -5758,14 +5758,6 @@ QualType Sema::BuildAddressSpaceAttr(Qua SourceLocation AttrLoc) { if (!AddrSpace->isValueDependent()) { -// If this type is already address space qualified, reject it. -// ISO/IEC TR 18037 S5.3 (amending C99 6.7.3): "No type shall be qualified -// by qualifiers for two or more different address spaces." -if (T.getAddressSpace() != LangAS::Default) { - Diag(AttrLoc, diag::err_attribute_address_multiple_qualifiers); - return QualType(); -} - llvm::APSInt addrSpace(32); if (!AddrSpace->isIntegerConstantExpr(addrSpace, Context)) { Diag(AttrLoc, diag::err_attribute_argument_type) @@ -5796,6 +5788,20 @@ QualType Sema::BuildAddressSpaceAttr(Qua LangAS ASIdx = getLangASFromTargetAS(static_cast(addrSpace.getZExtValue())); +// If this type is already address space qualified with a different +// address space, reject it. +// ISO/IEC TR 18037 S5.3 (amending C99 6.7.3): "No type shall be qualified +// by qualifiers for two or more different address spaces." +if (T.getAddressSpace() != LangAS::Default) { + if (T.getAddressSpace() != ASIdx) { +Diag(AttrLoc, diag::err_attribute_address_multiple_qualifiers); +return QualType(); + } else +// Emit a warning if they are identical; it's likely unintended. +Diag(AttrLoc, + diag::warn_attribute_address_multiple_identical_qualifiers); +} + return Context.getAddrSpaceQualType(T, ASIdx); } @@ -5817,15 +5823,6 @@ QualType Sema::BuildAddressSpaceAttr(Qua /// space for the type. static void HandleAddressSpaceTypeAttribute(QualType &Type, const AttributeList &Attr, Sema &S){ - // If this type is already address space qualified, reject it. - // ISO/IEC TR 18037 S5.3 (amending C99 6.7.3): "No type shall be qualified by - // qualifiers for two or more different address spaces." - if (Type.getAddressSpace() != LangAS::Default) { -S.Diag(Attr.getLoc(), diag::err_attribute_address_multiple_qualifiers); -Attr.setInvalid(); -return; - } - // ISO/IEC TR 18037 S5.3 (amending C99 6.7.3): "A function type shall not be // qualified by an address-space qualifier." if (Type->isFunctionType()) { @@ -5888,6 +5885,21 @@ static void HandleAddressSpaceTypeAttrib llvm_unreachable("Invalid address space"); } +// If this type is already address space qualified with a different +// address space, reject it. +// ISO/IEC TR 18037 S5.3 (amending C99 6.7.3): "No type shall be qualified by +// qualifiers for two or more different address spaces." +i
[PATCH] D47630: [Sema] Allow creating types with multiple of the same addrspace.
This revision was automatically updated to reflect the committed changes. Closed by commit rC335103: [Sema] Allow creating types with multiple of the same addrspace. (authored by bader, committed by ). Changed prior to commit: https://reviews.llvm.org/D47630?vs=150683&id=152033#toc Repository: rC Clang https://reviews.llvm.org/D47630 Files: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaType.cpp test/Sema/address_spaces.c test/SemaOpenCL/address-spaces.cl Index: test/SemaOpenCL/address-spaces.cl === --- test/SemaOpenCL/address-spaces.cl +++ test/SemaOpenCL/address-spaces.cl @@ -62,4 +62,6 @@ __private __local int *var2; // expected-error {{multiple address spaces specified for type}} __local private_int_t var3; // expected-error {{multiple address spaces specified for type}} __local private_int_t *var4; // expected-error {{multiple address spaces specified for type}} + __private private_int_t var5; // expected-warning {{multiple identical address spaces specified for type}} + __private private_int_t *var6;// expected-warning {{multiple identical address spaces specified for type}} } Index: test/Sema/address_spaces.c === --- test/Sema/address_spaces.c +++ test/Sema/address_spaces.c @@ -14,6 +14,7 @@ int _AS1 _AS2 *Y; // expected-error {{multiple address spaces specified for type}} int *_AS1 _AS2 *Z; // expected-error {{multiple address spaces specified for type}} + int *_AS1 _AS1 *M; // expected-warning {{multiple identical address spaces specified for type}} _AS1 int local; // expected-error {{automatic variable qualified with an address space}} _AS1 int array[5]; // expected-error {{automatic variable qualified with an address space}} Index: lib/Sema/SemaType.cpp === --- lib/Sema/SemaType.cpp +++ lib/Sema/SemaType.cpp @@ -5758,14 +5758,6 @@ SourceLocation AttrLoc) { if (!AddrSpace->isValueDependent()) { -// If this type is already address space qualified, reject it. -// ISO/IEC TR 18037 S5.3 (amending C99 6.7.3): "No type shall be qualified -// by qualifiers for two or more different address spaces." -if (T.getAddressSpace() != LangAS::Default) { - Diag(AttrLoc, diag::err_attribute_address_multiple_qualifiers); - return QualType(); -} - llvm::APSInt addrSpace(32); if (!AddrSpace->isIntegerConstantExpr(addrSpace, Context)) { Diag(AttrLoc, diag::err_attribute_argument_type) @@ -5796,6 +5788,20 @@ LangAS ASIdx = getLangASFromTargetAS(static_cast(addrSpace.getZExtValue())); +// If this type is already address space qualified with a different +// address space, reject it. +// ISO/IEC TR 18037 S5.3 (amending C99 6.7.3): "No type shall be qualified +// by qualifiers for two or more different address spaces." +if (T.getAddressSpace() != LangAS::Default) { + if (T.getAddressSpace() != ASIdx) { +Diag(AttrLoc, diag::err_attribute_address_multiple_qualifiers); +return QualType(); + } else +// Emit a warning if they are identical; it's likely unintended. +Diag(AttrLoc, + diag::warn_attribute_address_multiple_identical_qualifiers); +} + return Context.getAddrSpaceQualType(T, ASIdx); } @@ -5817,15 +5823,6 @@ /// space for the type. static void HandleAddressSpaceTypeAttribute(QualType &Type, const AttributeList &Attr, Sema &S){ - // If this type is already address space qualified, reject it. - // ISO/IEC TR 18037 S5.3 (amending C99 6.7.3): "No type shall be qualified by - // qualifiers for two or more different address spaces." - if (Type.getAddressSpace() != LangAS::Default) { -S.Diag(Attr.getLoc(), diag::err_attribute_address_multiple_qualifiers); -Attr.setInvalid(); -return; - } - // ISO/IEC TR 18037 S5.3 (amending C99 6.7.3): "A function type shall not be // qualified by an address-space qualifier." if (Type->isFunctionType()) { @@ -5888,6 +5885,21 @@ llvm_unreachable("Invalid address space"); } +// If this type is already address space qualified with a different +// address space, reject it. +// ISO/IEC TR 18037 S5.3 (amending C99 6.7.3): "No type shall be qualified by +// qualifiers for two or more different address spaces." +if (Type.getAddressSpace() != LangAS::Default) { + if (Type.getAddressSpace() != ASIdx) { +S.Diag(Attr.getLoc(), diag::err_attribute_address_multiple_qualifiers); +Attr.setInvalid(); +return; + } else +// Emit a warning if they are identical; it's likely unintended. +S.Diag(Attr.getLoc(), + diag::warn_attribute_address_multiple_identical_qualifiers); +} + Type = S.Conte
[PATCH] D48352: [clang-format] Improve ObjC method expressions formatting
jolesiak created this revision. Herald added a subscriber: cfe-commits. 1. Fix counting parameters/arguments for ObjC. 2. Fix split priorities for ObjC methods. 3. Fix breaking after square bracket starting ObjC method expression. 4. Fix putting ObjC method arguments into one line when they fit. Repository: rC Clang https://reviews.llvm.org/D48352 Files: lib/Format/ContinuationIndenter.cpp lib/Format/FormatToken.h lib/Format/TokenAnnotator.cpp unittests/Format/FormatTestObjC.cpp Index: unittests/Format/FormatTestObjC.cpp === --- unittests/Format/FormatTestObjC.cpp +++ unittests/Format/FormatTestObjC.cpp @@ -678,6 +678,16 @@ verifyFormat("[(id)foo bar:(id) ? baz : quux];"); verifyFormat("4 > 4 ? (id)a : (id)baz;"); + unsigned PreviousColumnLimit = Style.ColumnLimit; + Style.ColumnLimit = 50; + verifyFormat("bool a = ([object a:42] == 0 ||\n" + " [object a:42 b:42] == 0);"); + // Instead of: + // bool a = + // ([object a:42] == 0 || [object a:42 + //b:42] == 0); + Style.ColumnLimit = PreviousColumnLimit; + // This tests that the formatter doesn't break after "backing" but before ":", // which would be at 80 columns. verifyFormat( @@ -803,6 +813,50 @@ verifyFormat("[((Foo *)foo) bar];"); verifyFormat("[((Foo *)foo) bar:1 blech:2];"); + // Message receiver taking multiple lines. + Style.ColumnLimit = 20; + // Non-corner case. + verifyFormat("[[object block:^{\n" + " return 42;\n" + "}] a:42 b:42];"); + // Arguments just fit into one line. + verifyFormat("[[object block:^{\n" + " return 42;\n" + "}] aaa:42 b:42];"); + // Arguments just over a column limit. + verifyFormat("[[object block:^{\n" + " return 42;\n" + "}] aaa:42\n" + "bb:42];"); + // Arguments just fit into one line. + Style.ColumnLimit = 23; + verifyFormat("[[obj a:42\n" + " b:42\n" + " c:42\n" + " d:42] e:42 f:42];"); + + // Arguments do not fit into one line with a receiver. + Style.ColumnLimit = 20; + verifyFormat("[[obj a:42] a:42\n" + "b:42];"); + verifyFormat("[[obj a:42] a:42\n" + "b:42\n" + "c:42];"); + verifyFormat("[[obj aa:42\n" + " b:42]\n" + "cc:42\n" + " d:42];"); + + // Avoid breaking receiver expression. + Style.ColumnLimit = 30; + verifyFormat("fooo =\n" + "[[obj fooo] aaa:42\n" + "aaa:42];"); + verifyFormat("[[[obj foo] bar] aa:42\n" + " bb:42\n" + " cc:42];"); + + Style.ColumnLimit = 70; verifyFormat( "void f() {\n" Index: lib/Format/TokenAnnotator.cpp === --- lib/Format/TokenAnnotator.cpp +++ lib/Format/TokenAnnotator.cpp @@ -515,11 +515,24 @@ } Left->MatchingParen = CurrentToken; CurrentToken->MatchingParen = Left; +// FirstObjCSelectorName is set when a colon is found. This does +// not work, however, when method has no parameters. +// Here, we set FirstObjCSelectorName when the end of the expression is +// reached, in case it was not set already. +if (!Contexts.back().FirstObjCSelectorName) { +FormatToken* Previous = CurrentToken->getPreviousNonComment(); +if (Previous && Previous->is(TT_SelectorName)) { + Previous->ObjCSelectorNameParts = 1; + Contexts.back().FirstObjCSelectorName = Previous; +} +} else { + Left->ParameterCount = + Contexts.back().FirstObjCSelectorName->ObjCSelectorNameParts; +} + if (Contexts.back().FirstObjCSelectorName) { Contexts.back().FirstObjCSelectorName->LongestObjCSelectorName = Contexts.back().LongestObjCSelectorName; - Contexts.back().FirstObjCSelectorName->ObjCSelectorNameParts = - Left->ParameterCount; if (Left->BlockParameterCount > 1) Contexts.back().FirstObjCSelectorName->LongestObjCSelectorName = 0; } @@ -539,11 +552,6 @@ TT_DesignatedInitializerLSquare)) { Left->Type = TT_ObjCMethodExpr; StartsObjCMethodExpr = true; - // ParameterCount might have been set to 1 before expression was - // recognized as ObjCMethodExpr (as '1 + number of commas' formula is - // used for other expression types). Parameter counter has to be, - // therefore, reset to 0. - Left->ParameterCount = 0; Contexts.back().ColonIsObjCMethodExpr = true; if (Parent
[PATCH] D48352: [clang-format] Improve ObjC method expressions formatting
jolesiak updated this revision to Diff 152043. jolesiak added a comment. - Add test Repository: rC Clang https://reviews.llvm.org/D48352 Files: lib/Format/ContinuationIndenter.cpp lib/Format/FormatToken.h lib/Format/TokenAnnotator.cpp unittests/Format/FormatTestObjC.cpp Index: unittests/Format/FormatTestObjC.cpp === --- unittests/Format/FormatTestObjC.cpp +++ unittests/Format/FormatTestObjC.cpp @@ -678,6 +678,18 @@ verifyFormat("[(id)foo bar:(id) ? baz : quux];"); verifyFormat("4 > 4 ? (id)a : (id)baz;"); + unsigned PreviousColumnLimit = Style.ColumnLimit; + Style.ColumnLimit = 50; + // Instead of: + // bool a = + // ([object a:42] == 0 || [object a:42 + //b:42] == 0); + verifyFormat("bool a = ([object a:42] == 0 ||\n" + " [object a:42 b:42] == 0);"); + Style.ColumnLimit = PreviousColumnLimit; + verifyFormat("bool a = ([ a] == a ||\n" + " [ a] == );"); + // This tests that the formatter doesn't break after "backing" but before ":", // which would be at 80 columns. verifyFormat( @@ -754,11 +766,10 @@ "[self a:aaa, aaa, aaa,\n" "aaa, aaa, aaa,\n" "aaa, aaa];"); + verifyFormat("[self // break\n" " a:a\n" "aaa:aaa];"); - verifyFormat("bool a = ([ a] == a ||\n" - " [ a] == );"); // Formats pair-parameters. verifyFormat("[I drawRectOn:surface ofSize:aa:bbb atOrigin:cc:dd];"); @@ -803,6 +814,53 @@ verifyFormat("[((Foo *)foo) bar];"); verifyFormat("[((Foo *)foo) bar:1 blech:2];"); + Style.ColumnLimit = 20; + verifyFormat("a = [a aa:aa\n" + " aa:aa];"); + + // Message receiver taking multiple lines. + // Non-corner case. + verifyFormat("[[object block:^{\n" + " return 42;\n" + "}] a:42 b:42];"); + // Arguments just fit into one line. + verifyFormat("[[object block:^{\n" + " return 42;\n" + "}] aaa:42 b:42];"); + // Arguments just over a column limit. + verifyFormat("[[object block:^{\n" + " return 42;\n" + "}] aaa:42\n" + "bb:42];"); + // Arguments just fit into one line. + Style.ColumnLimit = 23; + verifyFormat("[[obj a:42\n" + " b:42\n" + " c:42\n" + " d:42] e:42 f:42];"); + + // Arguments do not fit into one line with a receiver. + Style.ColumnLimit = 20; + verifyFormat("[[obj a:42] a:42\n" + "b:42];"); + verifyFormat("[[obj a:42] a:42\n" + "b:42\n" + "c:42];"); + verifyFormat("[[obj aa:42\n" + " b:42]\n" + "cc:42\n" + " d:42];"); + + // Avoid breaking receiver expression. + Style.ColumnLimit = 30; + verifyFormat("fooo =\n" + "[[obj fooo] aaa:42\n" + "aaa:42];"); + verifyFormat("[[[obj foo] bar] aa:42\n" + " bb:42\n" + " cc:42];"); + + Style.ColumnLimit = 70; verifyFormat( "void f() {\n" Index: lib/Format/TokenAnnotator.cpp === --- lib/Format/TokenAnnotator.cpp +++ lib/Format/TokenAnnotator.cpp @@ -515,11 +515,24 @@ } Left->MatchingParen = CurrentToken; CurrentToken->MatchingParen = Left; +// FirstObjCSelectorName is set when a colon is found. This does +// not work, however, when method has no parameters. +// Here, we set FirstObjCSelectorName when the end of the expression is +// reached, in case it was not set already. +if (!Contexts.back().FirstObjCSelectorName) { +FormatToken* Previous = CurrentToken->getPreviousNonComment(); +if (Previous && Previous->is(TT_SelectorName)) { + Previous->ObjCSelectorNameParts = 1; + Contexts.back().FirstObjCSelectorName = Previous; +} +} else { + Left->ParameterCount = + Contexts.back().FirstObjCSelectorName->ObjCSelectorNameParts; +} + if (Contexts.back().FirstObjCSelectorName) { Contexts.back().FirstObjCSelectorName->LongestObjCSelectorName = Contexts.back().LongestObjCSelectorName; - Contexts.back().FirstObjCSelectorName->ObjCSelectorNameParts = - Left->ParameterCount; if (Left->BlockParameterCount > 1) Contexts.back().FirstObjCSel
r335111 - [SPIR] Prevent SPIR targets from using half conversion intrinsics
Author: sjoerdmeijer Date: Wed Jun 20 02:49:40 2018 New Revision: 335111 URL: http://llvm.org/viewvc/llvm-project?rev=335111&view=rev Log: [SPIR] Prevent SPIR targets from using half conversion intrinsics The SPIR target currently allows for half precision floating point types to be emitted using the LLVM intrinsic functions which convert half types to floats and doubles. However, this is illegal in SPIR as the only intrinsic allowed by SPIR is memcpy, as per section 3 of the SPIR specification. Currently this is leading to an assert being hit in the Clang CodeGen when attempting to emit a constant or literal _Float16 type in a comparison operation on a SPIR or SPIR64 target. This assert stems from the CodeGen attempting to emit a constant half value as an integer because the backend has specified that it is using these half conversion intrinsics (which represents half as i16). This patch prevents SPIR targets from using these intrinsics by overloading the responsible target info method, marks SPIR targets as having a legal half type and provides additional regression testing for the _Float16 type on SPIR targets. Patch by: Stephen McGroarty Differential Revision: https://reviews.llvm.org/D48188 Added: cfe/trunk/test/CodeGen/spir-half-type.cpp Modified: cfe/trunk/lib/Basic/Targets/SPIR.h Modified: cfe/trunk/lib/Basic/Targets/SPIR.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/SPIR.h?rev=335111&r1=335110&r2=335111&view=diff == --- cfe/trunk/lib/Basic/Targets/SPIR.h (original) +++ cfe/trunk/lib/Basic/Targets/SPIR.h Wed Jun 20 02:49:40 2018 @@ -47,6 +47,7 @@ public: LongWidth = LongAlign = 64; AddrSpaceMap = &SPIRAddrSpaceMap; UseAddrSpaceMapMangling = true; +HasLegalHalfType = true; // Define available target features // These must be defined in sorted order! NoAsmVariants = true; @@ -59,6 +60,10 @@ public: return Feature == "spir"; } + // SPIR supports the half type and the only llvm intrinsic allowed in SPIR is + // memcpy as per section 3 of the SPIR spec. + bool useFP16ConversionIntrinsics() const override { return false; } + ArrayRef getTargetBuiltins() const override { return None; } const char *getClobbers() const override { return ""; } Added: cfe/trunk/test/CodeGen/spir-half-type.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/spir-half-type.cpp?rev=335111&view=auto == --- cfe/trunk/test/CodeGen/spir-half-type.cpp (added) +++ cfe/trunk/test/CodeGen/spir-half-type.cpp Wed Jun 20 02:49:40 2018 @@ -0,0 +1,146 @@ +// RUN: %clang_cc1 -O0 -triple spir -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -O0 -triple spir64 -emit-llvm %s -o - | FileCheck %s + +// This file tests that using the _Float16 type with the spir target will not +// use the llvm intrinsics but instead will use the half arithmetic +// instructions directly. + +// Previously attempting to use a constant _Float16 with a comparison +// instruction when the target is spir or spir64 lead to an assert being hit. +bool fcmp_const() { + _Float16 a = 0.0f16; + const _Float16 b = 1.0f16; + + // CHECK-NOT: llvm.convert.to.fp16 + // CHECK-NOT: llvm.convert.from.fp16 + + // CHECK: [[REG1:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp olt half [[REG1]], 0xH3C00 + + // CHECK: [[REG2:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp olt half [[REG2]], 0xH4000 + + // CHECK: [[REG3:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp ogt half [[REG3]], 0xH3C00 + + // CHECK: [[REG4:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp ogt half [[REG4]], 0xH4200 + + // CHECK: [[REG5:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp oeq half [[REG5]], 0xH3C00 + + // CHECK: [[REG7:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp oeq half [[REG7]], 0xH4400 + + // CHECK: [[REG8:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp une half [[REG8]], 0xH3C00 + + // CHECK: [[REG9:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp une half [[REG9]], 0xH4500 + + // CHECK: [[REG10:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp ole half [[REG10]], 0xH3C00 + + // CHECK: [[REG11:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp ole half [[REG11]], 0xH4600 + + // CHECK: [[REG12:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp oge half [[REG12]], 0xH3C00 + + // CHECK: [[REG13:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp oge half [[REG13]], 0xH4700 + return a < b || a < 2.0f16 || a > b || a > 3.0f16 || a == b || a == 4.0f16 || + a != b || a != 5.0f16 || a <= b || a <= 6.0f16 || a >= b || + a >= 7.0f16; +} + +bool fcmp() { + _Float16 a = 0.0f16; + _Float16 b = 1.0f16; + + // CHECK-NOT: llvm.convert.to.fp16 + // CHECK-NOT: llvm.convert.from.fp16 + //
[PATCH] D48188: [SPIR] Prevent SPIR targets from using half conversion intrinsics
This revision was automatically updated to reflect the committed changes. Closed by commit rC335111: [SPIR] Prevent SPIR targets from using half conversion intrinsics (authored by SjoerdMeijer, committed by ). Changed prior to commit: https://reviews.llvm.org/D48188?vs=151938&id=152045#toc Repository: rC Clang https://reviews.llvm.org/D48188 Files: lib/Basic/Targets/SPIR.h test/CodeGen/spir-half-type.cpp Index: test/CodeGen/spir-half-type.cpp === --- test/CodeGen/spir-half-type.cpp +++ test/CodeGen/spir-half-type.cpp @@ -0,0 +1,146 @@ +// RUN: %clang_cc1 -O0 -triple spir -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -O0 -triple spir64 -emit-llvm %s -o - | FileCheck %s + +// This file tests that using the _Float16 type with the spir target will not +// use the llvm intrinsics but instead will use the half arithmetic +// instructions directly. + +// Previously attempting to use a constant _Float16 with a comparison +// instruction when the target is spir or spir64 lead to an assert being hit. +bool fcmp_const() { + _Float16 a = 0.0f16; + const _Float16 b = 1.0f16; + + // CHECK-NOT: llvm.convert.to.fp16 + // CHECK-NOT: llvm.convert.from.fp16 + + // CHECK: [[REG1:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp olt half [[REG1]], 0xH3C00 + + // CHECK: [[REG2:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp olt half [[REG2]], 0xH4000 + + // CHECK: [[REG3:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp ogt half [[REG3]], 0xH3C00 + + // CHECK: [[REG4:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp ogt half [[REG4]], 0xH4200 + + // CHECK: [[REG5:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp oeq half [[REG5]], 0xH3C00 + + // CHECK: [[REG7:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp oeq half [[REG7]], 0xH4400 + + // CHECK: [[REG8:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp une half [[REG8]], 0xH3C00 + + // CHECK: [[REG9:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp une half [[REG9]], 0xH4500 + + // CHECK: [[REG10:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp ole half [[REG10]], 0xH3C00 + + // CHECK: [[REG11:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp ole half [[REG11]], 0xH4600 + + // CHECK: [[REG12:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp oge half [[REG12]], 0xH3C00 + + // CHECK: [[REG13:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: fcmp oge half [[REG13]], 0xH4700 + return a < b || a < 2.0f16 || a > b || a > 3.0f16 || a == b || a == 4.0f16 || + a != b || a != 5.0f16 || a <= b || a <= 6.0f16 || a >= b || + a >= 7.0f16; +} + +bool fcmp() { + _Float16 a = 0.0f16; + _Float16 b = 1.0f16; + + // CHECK-NOT: llvm.convert.to.fp16 + // CHECK-NOT: llvm.convert.from.fp16 + // CHECK: [[REG1:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: [[REG2:%.*]] = load half, half* %b, align 2 + // CHECK-NEXT: fcmp olt half [[REG1]], [[REG2]] + + // CHECK: [[REG3:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: [[REG4:%.*]] = load half, half* %b, align 2 + // CHECK-NEXT: fcmp ogt half [[REG3]], [[REG4]] + + // CHECK: [[REG5:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: [[REG6:%.*]] = load half, half* %b, align 2 + // CHECK-NEXT: fcmp oeq half [[REG5]], [[REG6]] + + // CHECK: [[REG7:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: [[REG8:%.*]] = load half, half* %b, align 2 + // CHECK-NEXT: fcmp une half [[REG7]], [[REG8]] + + // CHECK: [[REG7:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: [[REG8:%.*]] = load half, half* %b, align 2 + // CHECK-NEXT: fcmp ole half [[REG7]], [[REG8]] + + // CHECK: [[REG7:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: [[REG8:%.*]] = load half, half* %b, align 2 + // CHECK-NEXT: fcmp oge half [[REG7]], [[REG8]] + return a < b || a > b || a == b || a != b || a <= b || a >= b; +} + +_Float16 fadd() { + _Float16 a = 1.0f16; + const _Float16 b = 2.0f16; + + // CHECK-NOT: llvm.convert.to.fp16 + // CHECK-NOT: llvm.convert.from.fp16 + + // CHECK: [[REG1:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: [[REG2:%.*]] = fadd half [[REG1]], 0xH4000 + // CHECK-NEXT: [[REG3:%.*]] = fadd half [[REG2]], 0xH4200 + // CHECK-NEXT: ret half [[REG3]] + return a + b + 3.0f16; +} + +_Float16 fsub() { + _Float16 a = 1.0f16; + const _Float16 b = 2.0f16; + + // CHECK-NOT: llvm.convert.to.fp16 + // CHECK-NOT: llvm.convert.from.fp16 + + // CHECK: [[REG1:%.*]] = load half, half* %a, align 2 + // CHECK-NEXT: [[REG2:%.*]] = fsub half [[REG1]], 0xH4000 + // CHECK-NEXT: [[REG3:%.*]] = fsub half [[REG2]], 0xH4200 + // CHECK-NEXT: ret half [[REG3]] + return a - b - 3.0f16; +} + +// CHECK: define spir_func half @_Z4fmulDF16_(half %arg) +_Float16 fmul(_Float16 arg) { + _Float16 a = 1.0f16; + const _Float16 b = 2.0f16; + + // CHECK-NOT: llvm.convert.to.fp16 + // CHECK-NOT: llvm.conver
[PATCH] D48355: [libcxxabi] [CMake] Convert paths to the right form in standalone builds on Windows
mstorsjo created this revision. mstorsjo added reviewers: mgorny, compnerd. Herald added a reviewer: EricWF. The paths output from llvm-config --cmakedir and from clang --print-libgcc-file-name can contain backslashes, while CMake can't handle the paths in this form. This matches what compiler-rt already does (since SVN r203789 and r293195). Repository: rCXXA libc++abi https://reviews.llvm.org/D48355 Files: cmake/Modules/HandleCompilerRT.cmake cmake/Modules/HandleOutOfTreeLLVM.cmake Index: cmake/Modules/HandleOutOfTreeLLVM.cmake === --- cmake/Modules/HandleOutOfTreeLLVM.cmake +++ cmake/Modules/HandleOutOfTreeLLVM.cmake @@ -46,10 +46,11 @@ OUTPUT_VARIABLE CONFIG_OUTPUT ERROR_QUIET) if(NOT HAD_ERROR) - string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG) + file(TO_CMAKE_PATH ${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG} LLVM_CMAKE_PATH) else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") endif() else() set(LLVM_FOUND OFF) Index: cmake/Modules/HandleCompilerRT.cmake === --- cmake/Modules/HandleCompilerRT.cmake +++ cmake/Modules/HandleCompilerRT.cmake @@ -14,6 +14,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) + file(TO_CMAKE_PATH ${LIBRARY_FILE} LIBRARY_FILE) string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}") if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}") message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}") @@ -37,6 +38,7 @@ OUTPUT_VARIABLE LIBRARY_DIR ) string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR) +file(TO_CMAKE_PATH ${LIBRARY_DIR} LIBRARY_DIR) set(LIBRARY_DIR "${LIBRARY_DIR}/darwin") else() set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXXABI_COMPILE_FLAGS} @@ -47,6 +49,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) +file(TO_CMAKE_PATH ${LIBRARY_FILE} LIBRARY_FILE) get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY) endif() if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}") Index: cmake/Modules/HandleOutOfTreeLLVM.cmake === --- cmake/Modules/HandleOutOfTreeLLVM.cmake +++ cmake/Modules/HandleOutOfTreeLLVM.cmake @@ -46,10 +46,11 @@ OUTPUT_VARIABLE CONFIG_OUTPUT ERROR_QUIET) if(NOT HAD_ERROR) - string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG) + file(TO_CMAKE_PATH ${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG} LLVM_CMAKE_PATH) else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") endif() else() set(LLVM_FOUND OFF) Index: cmake/Modules/HandleCompilerRT.cmake === --- cmake/Modules/HandleCompilerRT.cmake +++ cmake/Modules/HandleCompilerRT.cmake @@ -14,6 +14,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) + file(TO_CMAKE_PATH ${LIBRARY_FILE} LIBRARY_FILE) string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}") if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}") message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}") @@ -37,6 +38,7 @@ OUTPUT_VARIABLE LIBRARY_DIR ) string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR) +file(TO_CMAKE_PATH ${LIBRARY_DIR} LIBRARY_DIR) set(LIBRARY_DIR "${LIBRARY_DIR}/darwin") else() set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXXABI_COMPILE_FLAGS} @@ -47,6 +49,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) +file(TO_CMAKE_PATH ${LIBRARY_FILE} LIBRARY_FILE) get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY) endif() if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}") ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48353: [libunwind] [CMake] Convert paths to the right form in standalone builds on Windows
mstorsjo created this revision. mstorsjo added reviewers: mgorny, compnerd. Herald added a subscriber: chrib. The paths output from llvm-config --cmakedir and from clang --print-libgcc-file-name can contain backslashes, while CMake can't handle the paths in this form. This matches what compiler-rt already does (since SVN r203789 and r293195). Repository: rUNW libunwind https://reviews.llvm.org/D48353 Files: CMakeLists.txt cmake/Modules/HandleCompilerRT.cmake Index: cmake/Modules/HandleCompilerRT.cmake === --- cmake/Modules/HandleCompilerRT.cmake +++ cmake/Modules/HandleCompilerRT.cmake @@ -14,6 +14,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) + file(TO_CMAKE_PATH ${LIBRARY_FILE} LIBRARY_FILE) string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}") if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}") message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}") @@ -37,6 +38,7 @@ OUTPUT_VARIABLE LIBRARY_DIR ) string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR) +file(TO_CMAKE_PATH ${LIBRARY_DIR} LIBRARY_DIR) set(LIBRARY_DIR "${LIBRARY_DIR}/darwin") else() set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBUNWIND_COMPILE_FLAGS} @@ -47,6 +49,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) +file(TO_CMAKE_PATH ${LIBRARY_FILE} LIBRARY_FILE) get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY) endif() if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}") Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -59,10 +59,11 @@ OUTPUT_VARIABLE CONFIG_OUTPUT ERROR_QUIET) if(NOT HAD_ERROR) - string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG) + file(TO_CMAKE_PATH ${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG} LLVM_CMAKE_PATH) else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") endif() else() message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. " Index: cmake/Modules/HandleCompilerRT.cmake === --- cmake/Modules/HandleCompilerRT.cmake +++ cmake/Modules/HandleCompilerRT.cmake @@ -14,6 +14,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) + file(TO_CMAKE_PATH ${LIBRARY_FILE} LIBRARY_FILE) string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}") if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}") message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}") @@ -37,6 +38,7 @@ OUTPUT_VARIABLE LIBRARY_DIR ) string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR) +file(TO_CMAKE_PATH ${LIBRARY_DIR} LIBRARY_DIR) set(LIBRARY_DIR "${LIBRARY_DIR}/darwin") else() set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBUNWIND_COMPILE_FLAGS} @@ -47,6 +49,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) +file(TO_CMAKE_PATH ${LIBRARY_FILE} LIBRARY_FILE) get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY) endif() if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}") Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -59,10 +59,11 @@ OUTPUT_VARIABLE CONFIG_OUTPUT ERROR_QUIET) if(NOT HAD_ERROR) - string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG) + file(TO_CMAKE_PATH ${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG} LLVM_CMAKE_PATH) else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") endif() else() message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. " ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48354: [LoopIdiomRecognize] Support for loops that use LSHR instruction added.
ovmold created this revision. ovmold added a reviewer: craig.topper. ovmold added a project: clang. Herald added a subscriber: cfe-commits. In the 'detectCTLZIdiom' function support for loops that use LSHR instruction instead of ASHR has been added. The problem is that for the following piece of code no '@llvm.ctlz' instruction has been generated in the resulting test.ll file when compiling as "clang -S -O3 -march=core-avx2 -emit-llvm test.c". The reason for this is that the LSHR instruction is used instead of ASHR in the LLVM IR when we get into the 'detectCTLZIdiom' function. int lzcnt(int x) { int count = 0; while (x > 0) { count++; x = x >> 1; } return count; } int main() { int x; scanf("%d", &x); int y = lzcnt(x); printf("count = %d\n", y); return 0; } = Repository: rC Clang https://reviews.llvm.org/D48354 Files: lib/Transforms/Scalar/LoopIdiomRecognize.cpp test/Transforms/LoopIdiom/X86/ctlz.ll Index: test/Transforms/LoopIdiom/X86/ctlz.ll === --- test/Transforms/LoopIdiom/X86/ctlz.ll +++ test/Transforms/LoopIdiom/X86/ctlz.ll @@ -115,6 +115,34 @@ ret i32 %i.0.lcssa } +; Function Attrs: norecurse nounwind readnone uwtable +define i32 @ctlz_zero_check_lshr(i32 %n) { +entry: + %c = icmp sgt i32 %n, 0 + %negn = sub nsw i32 0, %n + %abs_n = select i1 %c, i32 %n, i32 %negn + %tobool4 = icmp eq i32 %abs_n, 0 + br i1 %tobool4, label %while.end, label %while.body.preheader + +while.body.preheader: ; preds = %entry + br label %while.body + +while.body: ; preds = %while.body.preheader, %while.body + %i.06 = phi i32 [ %inc, %while.body ], [ 0, %while.body.preheader ] + %n.addr.05 = phi i32 [ %shr, %while.body ], [ %abs_n, %while.body.preheader ] + %shr = lshr i32 %n.addr.05, 1 + %inc = add nsw i32 %i.06, 1 + %tobool = icmp eq i32 %shr, 0 + br i1 %tobool, label %while.end.loopexit, label %while.body + +while.end.loopexit: ; preds = %while.body + br label %while.end + +while.end:; preds = %while.end.loopexit, %entry + %i.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %while.end.loopexit ] + ret i32 %i.0.lcssa +} + ; Recognize CTLZ builtin pattern. ; Here it will replace the loop - ; assume builtin is always profitable. @@ -157,6 +185,48 @@ ret i32 %i.0 } +; Recognize CTLZ builtin pattern. +; Here it will replace the loop - +; assume builtin is always profitable. +; +; int ctlz_lshr(int n) +; { +; n = n >= 0 ? n : -n; +; int i = 0; +; while(n >>= 1) { +; i++; +; } +; return i; +; } +; +; ALL: entry +; ALL: %0 = lshr i32 %abs_n, 1 +; ALL-NEXT: %1 = call i32 @llvm.ctlz.i32(i32 %0, i1 false) +; ALL-NEXT: %2 = sub i32 32, %1 +; ALL-NEXT: %3 = add i32 %2, 1 +; ALL: %i.0.lcssa = phi i32 [ %2, %while.cond ] +; ALL: ret i32 %i.0.lcssa + +; Function Attrs: norecurse nounwind readnone uwtable +define i32 @ctlz_lshr(i32 %n) { +entry: + %c = icmp sgt i32 %n, 0 + %negn = sub nsw i32 0, %n + %abs_n = select i1 %c, i32 %n, i32 %negn + br label %while.cond + +while.cond: ; preds = %while.cond, %entry + %n.addr.0 = phi i32 [ %abs_n, %entry ], [ %shr, %while.cond ] + %i.0 = phi i32 [ 0, %entry ], [ %inc, %while.cond ] + %shr = lshr i32 %n.addr.0, 1 + %tobool = icmp eq i32 %shr, 0 + %inc = add nsw i32 %i.0, 1 + br i1 %tobool, label %while.end, label %while.cond + +while.end:; preds = %while.cond + ret i32 %i.0 +} + ; Recognize CTLZ builtin pattern. ; Here it will replace the loop - ; assume builtin is always profitable. @@ -200,6 +270,49 @@ ret i32 %i.0 } +; Recognize CTLZ builtin pattern. +; Here it will replace the loop - +; assume builtin is always profitable. +; +; int ctlz_add_lshr(int n, int i0) +; { +; n = n >= 0 ? n : -n; +; int i = i0; +; while(n >>= 1) { +; i++; +; } +; return i; +; } +; +; ALL: entry +; ALL: %0 = lshr i32 %abs_n, 1 +; ALL-NEXT: %1 = call i32 @llvm.ctlz.i32(i32 %0, i1 false) +; ALL-NEXT: %2 = sub i32 32, %1 +; ALL-NEXT: %3 = add i32 %2, 1 +; ALL-NEXT: %4 = add i32 %2, %i0 +; ALL: %i.0.lcssa = phi i32 [ %4, %while.cond ] +; ALL: ret i32 %i.0.lcssa +; +; Function Attrs: norecurse nounwind readnone uwtable +define i32 @ctlz_add_lshr(i32 %n, i32 %i0) { +entry: + %c = icmp sgt i32 %n, 0 + %negn = sub nsw i32 0, %n + %abs_n = select i1 %c, i32 %n, i32 %negn + br label %while.cond + +while.cond: ; preds = %while.cond, %entry + %n.addr.0 = phi i32 [ %abs_n, %entry ], [ %shr, %while.cond ] + %i.0 = phi i32 [ %i0, %entry ], [ %inc, %while.cond ] + %shr = lshr i32 %n.addr.0, 1 + %tobool = icmp eq i32 %shr, 0 + %inc = add nsw i32 %i.0, 1 + br i1 %tobool, label %while.end, label %while.cond + +while.end:; preds =
[PATCH] D48356: [libcxx] [CMake] Convert paths to the right form in standalone builds on Windows
mstorsjo created this revision. mstorsjo added reviewers: mgorny, compnerd. Herald added a reviewer: EricWF. The paths output from llvm-config --cmakedir and from clang --print-libgcc-file-name can contain backslashes, while CMake can't handle the paths in this form. This matches what compiler-rt already does (since SVN r203789 and r293195). Repository: rCXX libc++ https://reviews.llvm.org/D48356 Files: cmake/Modules/HandleCompilerRT.cmake cmake/Modules/HandleOutOfTreeLLVM.cmake Index: cmake/Modules/HandleOutOfTreeLLVM.cmake === --- cmake/Modules/HandleOutOfTreeLLVM.cmake +++ cmake/Modules/HandleOutOfTreeLLVM.cmake @@ -46,10 +46,11 @@ OUTPUT_VARIABLE CONFIG_OUTPUT ERROR_QUIET) if(NOT HAD_ERROR) - string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG) + file(TO_CMAKE_PATH ${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG} LLVM_CMAKE_PATH) else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") endif() else() set(LLVM_FOUND OFF) Index: cmake/Modules/HandleCompilerRT.cmake === --- cmake/Modules/HandleCompilerRT.cmake +++ cmake/Modules/HandleCompilerRT.cmake @@ -14,6 +14,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) + file(TO_CMAKE_PATH ${LIBRARY_FILE} LIBRARY_FILE) string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}") if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}") message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}") @@ -37,6 +38,7 @@ OUTPUT_VARIABLE LIBRARY_DIR ) string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR) +file(TO_CMAKE_PATH ${LIBRARY_DIR} LIBRARY_DIR) set(LIBRARY_DIR "${LIBRARY_DIR}/darwin") else() set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXX_COMPILE_FLAGS} @@ -47,6 +49,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) +file(TO_CMAKE_PATH ${LIBRARY_FILE} LIBRARY_FILE) get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY) endif() if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}") Index: cmake/Modules/HandleOutOfTreeLLVM.cmake === --- cmake/Modules/HandleOutOfTreeLLVM.cmake +++ cmake/Modules/HandleOutOfTreeLLVM.cmake @@ -46,10 +46,11 @@ OUTPUT_VARIABLE CONFIG_OUTPUT ERROR_QUIET) if(NOT HAD_ERROR) - string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG) + file(TO_CMAKE_PATH ${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG} LLVM_CMAKE_PATH) else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") endif() else() set(LLVM_FOUND OFF) Index: cmake/Modules/HandleCompilerRT.cmake === --- cmake/Modules/HandleCompilerRT.cmake +++ cmake/Modules/HandleCompilerRT.cmake @@ -14,6 +14,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) + file(TO_CMAKE_PATH ${LIBRARY_FILE} LIBRARY_FILE) string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}") if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}") message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}") @@ -37,6 +38,7 @@ OUTPUT_VARIABLE LIBRARY_DIR ) string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR) +file(TO_CMAKE_PATH ${LIBRARY_DIR} LIBRARY_DIR) set(LIBRARY_DIR "${LIBRARY_DIR}/darwin") else() set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXX_COMPILE_FLAGS} @@ -47,6 +49,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) +file(TO_CMAKE_PATH ${LIBRARY_FILE} LIBRARY_FILE) get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY) endif() if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}") ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48357: [RISCV] Remove duplicated logic when determining the target ABI
rogfer01 created this revision. rogfer01 added a reviewer: asb. Herald added subscribers: mgrang, edward-jones, zzheng, shiva0217, kito-cheng, niosHD, sabuasal, apazos, simoncook, johnrusso, rbar. We were calculating twice ilp32/lp64. Do this just in one place instead. https://reviews.llvm.org/D48357 Files: lib/Driver/ToolChains/Arch/RISCV.cpp lib/Driver/ToolChains/Clang.cpp Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -1681,21 +1681,11 @@ void Clang::AddRISCVTargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const { - // FIXME: currently defaults to the soft-float ABIs. Will need to be - // expanded to select ilp32f, ilp32d, lp64f, lp64d when appropriate. - const char *ABIName = nullptr; const llvm::Triple &Triple = getToolChain().getTriple(); - if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) -ABIName = A->getValue(); - else if (Triple.getArch() == llvm::Triple::riscv32) -ABIName = "ilp32"; - else if (Triple.getArch() == llvm::Triple::riscv64) -ABIName = "lp64"; - else -llvm_unreachable("Unexpected triple!"); + StringRef ABIName = riscv::getRISCVABI(Args, Triple); CmdArgs.push_back("-target-abi"); - CmdArgs.push_back(ABIName); + CmdArgs.push_back(ABIName.data()); } void Clang::AddSparcTargetArgs(const ArgList &Args, Index: lib/Driver/ToolChains/Arch/RISCV.cpp === --- lib/Driver/ToolChains/Arch/RISCV.cpp +++ lib/Driver/ToolChains/Arch/RISCV.cpp @@ -371,8 +371,14 @@ } StringRef riscv::getRISCVABI(const ArgList &Args, const llvm::Triple &Triple) { - if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) + assert((Triple.getArch() == llvm::Triple::riscv32 || + Triple.getArch() == llvm::Triple::riscv64) && + "Unexpected triple"); + + if (const Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) return A->getValue(); + // FIXME: currently defaults to the soft-float ABIs. Will need to be + // expanded to select ilp32f, ilp32d, lp64f, lp64d when appropriate. return Triple.getArch() == llvm::Triple::riscv32 ? "ilp32" : "lp64"; } Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -1681,21 +1681,11 @@ void Clang::AddRISCVTargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const { - // FIXME: currently defaults to the soft-float ABIs. Will need to be - // expanded to select ilp32f, ilp32d, lp64f, lp64d when appropriate. - const char *ABIName = nullptr; const llvm::Triple &Triple = getToolChain().getTriple(); - if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) -ABIName = A->getValue(); - else if (Triple.getArch() == llvm::Triple::riscv32) -ABIName = "ilp32"; - else if (Triple.getArch() == llvm::Triple::riscv64) -ABIName = "lp64"; - else -llvm_unreachable("Unexpected triple!"); + StringRef ABIName = riscv::getRISCVABI(Args, Triple); CmdArgs.push_back("-target-abi"); - CmdArgs.push_back(ABIName); + CmdArgs.push_back(ABIName.data()); } void Clang::AddSparcTargetArgs(const ArgList &Args, Index: lib/Driver/ToolChains/Arch/RISCV.cpp === --- lib/Driver/ToolChains/Arch/RISCV.cpp +++ lib/Driver/ToolChains/Arch/RISCV.cpp @@ -371,8 +371,14 @@ } StringRef riscv::getRISCVABI(const ArgList &Args, const llvm::Triple &Triple) { - if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) + assert((Triple.getArch() == llvm::Triple::riscv32 || + Triple.getArch() == llvm::Triple::riscv64) && + "Unexpected triple"); + + if (const Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) return A->getValue(); + // FIXME: currently defaults to the soft-float ABIs. Will need to be + // expanded to select ilp32f, ilp32d, lp64f, lp64d when appropriate. return Triple.getArch() == llvm::Triple::riscv32 ? "ilp32" : "lp64"; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48357: [RISCV] Remove duplicated logic when determining the target ABI
rogfer01 added inline comments. Comment at: lib/Driver/ToolChains/Arch/RISCV.cpp:381 + // FIXME: currently defaults to the soft-float ABIs. Will need to be + // expanded to select ilp32f, ilp32d, lp64f, lp64d when appropriate. When 64-bit is upstreamed and `lp64d` implemented, I plan to default `riscv64-unknown-linux-gnu` to `lp64d` here. Does this sound sensible? https://reviews.llvm.org/D48357 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47946: [ASTmporter] Fix infinite recursion on function import with struct definition in parameters
gerazo updated this revision to Diff 152055. gerazo added a comment. Added @martong 's suggestions. https://reviews.llvm.org/D47946 Files: lib/AST/ASTImporter.cpp unittests/AST/ASTImporterTest.cpp Index: unittests/AST/ASTImporterTest.cpp === --- unittests/AST/ASTImporterTest.cpp +++ unittests/AST/ASTImporterTest.cpp @@ -165,19 +165,43 @@ // Buffer for the To context, must live in the test scope. std::string ToCode; + // Represents a "From" translation unit and holds an importer object which we + // use to import from this translation unit. struct TU { // Buffer for the context, must live in the test scope. std::string Code; std::string FileName; std::unique_ptr Unit; TranslationUnitDecl *TUDecl = nullptr; +std::unique_ptr Importer; + TU(StringRef Code, StringRef FileName, ArgVector Args) : Code(Code), FileName(FileName), Unit(tooling::buildASTFromCodeWithArgs(this->Code, Args, this->FileName)), TUDecl(Unit->getASTContext().getTranslationUnitDecl()) { Unit->enableSourceFileDiagnostics(); } + +void lazyInitImporter(ASTUnit *ToAST) { + assert(ToAST); + if (!Importer) { +Importer.reset(new ASTImporter( +ToAST->getASTContext(), ToAST->getFileManager(), +Unit->getASTContext(), Unit->getFileManager(), false)); + } + assert(&ToAST->getASTContext() == &Importer->getToContext()); +} + +Decl *import(ASTUnit *ToAST, Decl *FromDecl) { + lazyInitImporter(ToAST); + return Importer->Import(FromDecl); + } + +QualType import(ASTUnit *ToAST, QualType FromType) { + lazyInitImporter(ToAST); + return Importer->Import(FromType); +} }; // We may have several From contexts and related translation units. In each @@ -189,6 +213,28 @@ // vector is expanding, with the list we won't have these issues. std::list FromTUs; + void lazyInitToAST(Language ToLang) { +if (ToAST) + return; +ArgVector ToArgs = getArgVectorForLanguage(ToLang); +// Build the AST from an empty file. +ToAST = tooling::buildASTFromCodeWithArgs(/*Code=*/"", ToArgs, "empty.cc"); +ToAST->enableSourceFileDiagnostics(); + } + + TU *findFromTU(Decl *From) { +// Create a virtual file in the To Ctx which corresponds to the file from +// which we want to import the `From` Decl. Without this source locations +// will be invalid in the ToCtx. +auto It = std::find_if(FromTUs.begin(), FromTUs.end(), [From](const TU &E) { + return E.TUDecl == From->getTranslationUnitDecl(); +}); +assert(It != FromTUs.end()); +assert(ToAST); +createVirtualFileIfNeeded(ToAST.get(), It->FileName, It->Code); +return &*It; + } + public: // We may have several From context but only one To context. std::unique_ptr ToAST; @@ -221,14 +267,10 @@ ToAST = tooling::buildASTFromCodeWithArgs(ToCode, ToArgs, OutputFileName); ToAST->enableSourceFileDiagnostics(); -ASTContext &FromCtx = FromTU.Unit->getASTContext(), - &ToCtx = ToAST->getASTContext(); +ASTContext &FromCtx = FromTU.Unit->getASTContext(); createVirtualFileIfNeeded(ToAST.get(), InputFileName, FromTU.Code); -ASTImporter Importer(ToCtx, ToAST->getFileManager(), FromCtx, - FromTU.Unit->getFileManager(), false); - IdentifierInfo *ImportedII = &FromCtx.Idents.get(Identifier); assert(ImportedII && "Declaration with the given identifier " "should be specified in test!"); @@ -239,7 +281,7 @@ assert(FoundDecls.size() == 1); -Decl *Imported = Importer.Import(FoundDecls.front()); +Decl *Imported = FromTU.import(ToAST.get(), FoundDecls.front()); assert(Imported); return std::make_tuple(*FoundDecls.begin(), Imported); } @@ -276,30 +318,17 @@ // May be called several times in a given test. // The different instances of the param From may have different ASTContext. Decl *Import(Decl *From, Language ToLang) { -if (!ToAST) { - ArgVector ToArgs = getArgVectorForLanguage(ToLang); - // Build the AST from an empty file. - ToAST = - tooling::buildASTFromCodeWithArgs(/*Code=*/"", ToArgs, "empty.cc"); - ToAST->enableSourceFileDiagnostics(); -} - -// Create a virtual file in the To Ctx which corresponds to the file from -// which we want to import the `From` Decl. Without this source locations -// will be invalid in the ToCtx. -auto It = std::find_if(FromTUs.begin(), FromTUs.end(), [From](const TU &E) { - return E.TUDecl == From->getTranslationUnitDecl(); -}); -assert(It != FromTUs.end()); -createVirtualFileIfNeeded(ToAST.get(), It->FileName, It->Code); - -ASTContext &FromCtx = From->getASTContext(), - &ToCtx = ToAST->getASTContext(); -ASTImporter I
[PATCH] D47698: [ASTImporter] import macro source locations
r.stahl added inline comments. Comment at: lib/AST/ASTImporter.cpp:7058 +const SrcMgr::ExpansionInfo &FromEx = FromSLoc.getExpansion(); +SourceLocation ToSpLoc = Import(FromEx.getSpellingLoc()); +SourceLocation ToExLocS = Import(FromEx.getExpansionLocStart()); martong wrote: > Let's say we import a `SourceLocation` with > `ASTImporter::Import(SourceLocation FromLoc)`. > That calls into `ASTImporter::Import(FileID FromID)` where we again import > other source locations. > Could the initial `FromLoc` be equal with any of these locations > (`FromEx.getSpellingLoc()`, `FromEx.getExpansionLocStart()`) ? > My understanding is that this is not possible because we cannot have > recursive macros, but please confirm. Yes, that was my understanding as well. If some compiler error is a macro expansion it eventually stops at some point while walking this chain. Comment at: unittests/AST/ASTImporterTest.cpp:1521 +static void CompareSourceLocs(SourceLocation Loc1, SourceLocation Loc2, + SourceManager &SM1, SourceManager &SM2) { martong wrote: > Perhaps it would be more concise and less error prone to use a > `FullSourceLoc` which wraps one simple `SourceLocation` and a `SourceManager`. Will do, thanks! Repository: rC Clang https://reviews.llvm.org/D47698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D45616: [X86] Lower _mm[256|512]_cmp[.]_mask intrinsics to native llvm IR
GBuella updated this revision to Diff 152060. GBuella edited the summary of this revision. https://reviews.llvm.org/D45616 Files: lib/CodeGen/CGBuiltin.cpp test/CodeGen/avx-builtins.c test/CodeGen/avx-cmp-builtins.c test/CodeGen/avx2-builtins.c test/CodeGen/avx512f-builtins.c test/CodeGen/avx512vl-builtins.c Index: test/CodeGen/avx512vl-builtins.c === --- test/CodeGen/avx512vl-builtins.c +++ test/CodeGen/avx512vl-builtins.c @@ -1073,53 +1073,168 @@ __mmask8 test_mm256_cmp_ps_mask(__m256 __A, __m256 __B) { // CHECK-LABEL: @test_mm256_cmp_ps_mask - // CHECK: call <8 x i1> @llvm.x86.avx512.mask.cmp.ps.256 + // CHECK: fcmp oeq <8 x float> %{{.*}}, %{{.*}} return (__mmask8)_mm256_cmp_ps_mask(__A, __B, 0); } +__mmask8 test_mm256_cmp_ps_mask_true_uq(__m256 __A, __m256 __B) { + // CHECK-LABEL: @test_mm256_cmp_ps_mask_true_uq + // CHECK-NOT: call + // CHECK: ret i8 -1 + return (__mmask8)_mm256_cmp_ps_mask(__A, __B, _CMP_TRUE_UQ); +} + +__mmask8 test_mm256_cmp_ps_mask_true_us(__m256 __A, __m256 __B) { + // CHECK-LABEL: @test_mm256_cmp_ps_mask_true_us + // CHECK-NOT: call + // CHECK: ret i8 -1 + return (__mmask8)_mm256_cmp_ps_mask(__A, __B, _CMP_TRUE_US); +} + +__mmask8 test_mm256_cmp_ps_mask_false_oq(__m256 __A, __m256 __B) { + // CHECK-LABEL: @test_mm256_cmp_ps_mask_false_oq + // CHECK-NOT: call + // CHECK: ret i8 0 + return (__mmask8)_mm256_cmp_ps_mask(__A, __B, _CMP_FALSE_OQ); +} + +__mmask8 test_mm256_cmp_ps_mask_false_os(__m256 __A, __m256 __B) { + // CHECK-LABEL: @test_mm256_cmp_ps_mask_false_os + // CHECK-NOT: call + // CHECK: ret i8 0 + return (__mmask8)_mm256_cmp_ps_mask(__A, __B, _CMP_FALSE_OS); +} + __mmask8 test_mm256_mask_cmp_ps_mask(__mmask8 m, __m256 __A, __m256 __B) { // CHECK-LABEL: @test_mm256_mask_cmp_ps_mask - // CHECK: [[CMP:%.*]] = call <8 x i1> @llvm.x86.avx512.mask.cmp.ps.256 - // CHECK: and <8 x i1> [[CMP]], {{.*}} + // CHECK: fcmp oeq <8 x float> %{{.*}}, %{{.*}} + // CHECK: and <8 x i1> %{{.*}}, %{{.*}} return _mm256_mask_cmp_ps_mask(m, __A, __B, 0); } __mmask8 test_mm_cmp_ps_mask(__m128 __A, __m128 __B) { // CHECK-LABEL: @test_mm_cmp_ps_mask - // CHECK: call <4 x i1> @llvm.x86.avx512.mask.cmp.ps.128 + // CHECK: fcmp oeq <4 x float> %{{.*}}, %{{.*}} return (__mmask8)_mm_cmp_ps_mask(__A, __B, 0); } +__mmask8 test_mm_cmp_ps_mask_true_uq(__m128 __A, __m128 __B) { + // CHECK-LABEL: @test_mm_cmp_ps_mask_true_uq + // CHECK-NOT: call + // CHECK: ret i8 -1 + return (__mmask8)_mm_cmp_ps_mask(__A, __B, _CMP_TRUE_UQ); +} + +__mmask8 test_mm_cmp_ps_mask_true_us(__m128 __A, __m128 __B) { + // CHECK-LABEL: @test_mm_cmp_ps_mask_true_us + // CHECK-NOT: call + // CHECK: ret i8 -1 + return (__mmask8)_mm_cmp_ps_mask(__A, __B, _CMP_TRUE_US); +} + +__mmask8 test_mm_cmp_ps_mask_false_oq(__m128 __A, __m128 __B) { + // CHECK-LABEL: @test_mm_cmp_ps_mask_false_oq + // CHECK-NOT: call + // CHECK: ret i8 0 + return (__mmask8)_mm_cmp_ps_mask(__A, __B, _CMP_FALSE_OQ); +} + +__mmask8 test_mm_cmp_ps_mask_false_os(__m128 __A, __m128 __B) { + // CHECK-LABEL: @test_mm_cmp_ps_mask_false_os + // CHECK-NOT: call + // CHECK: ret i8 0 + return (__mmask8)_mm_cmp_ps_mask(__A, __B, _CMP_FALSE_OS); +} + __mmask8 test_mm_mask_cmp_ps_mask(__mmask8 m, __m128 __A, __m128 __B) { // CHECK-LABEL: @test_mm_mask_cmp_ps_mask - // CHECK: [[CMP:%.*]] = call <4 x i1> @llvm.x86.avx512.mask.cmp.ps.128 - // CHECK: and <4 x i1> [[CMP]], {{.*}} + // CHECK: fcmp oeq <4 x float> %{{.*}}, %{{.*}} + // CHECK: shufflevector <8 x i1> %{{.*}}, <8 x i1> %{{.*}}, <4 x i32> + // CHECK: and <4 x i1> %{{.*}}, %{{.*}} return _mm_mask_cmp_ps_mask(m, __A, __B, 0); } __mmask8 test_mm256_cmp_pd_mask(__m256d __A, __m256d __B) { // CHECK-LABEL: @test_mm256_cmp_pd_mask - // CHECK: call <4 x i1> @llvm.x86.avx512.mask.cmp.pd.256 + // CHECK: fcmp oeq <4 x double> %{{.*}}, %{{.*}} return (__mmask8)_mm256_cmp_pd_mask(__A, __B, 0); } +__mmask8 test_mm256_cmp_pd_mask_true_uq(__m256d __A, __m256d __B) { + // CHECK-LABEL: @test_mm256_cmp_pd_mask_true_uq + // CHECK-NOT: call + // CHECK: ret i8 -1 + return (__mmask8)_mm256_cmp_pd_mask(__A, __B, _CMP_TRUE_UQ); +} + +__mmask8 test_mm256_cmp_pd_mask_true_us(__m256d __A, __m256d __B) { + // CHECK-LABEL: @test_mm256_cmp_pd_mask_true_us + // CHECK-NOT: call + // CHECK: ret i8 -1 + return (__mmask8)_mm256_cmp_pd_mask(__A, __B, _CMP_TRUE_US); +} + +__mmask8 test_mm256_cmp_pd_mask_false_oq(__m256d __A, __m256d __B) { + // CHECK-LABEL: @test_mm256_cmp_pd_mask_false_oq + // CHECK-NOT: call + // CHECK: ret i8 0 + return (__mmask8)_mm256_cmp_pd_mask(__A, __B, _CMP_FALSE_OQ); +} + +__mmask8 test_mm256_cmp_pd_mask_false_os(__m256d __A, __m256d __B) { + // CHECK-LABEL: @test_mm256_cmp_pd_mask_false_os + // CHECK-NOT: call + // CHECK: ret i8 0 + return (__mmask8)_mm256_cmp_pd_mask(__A, __B, _CMP_FALSE_OS); +} + __mmask8 test_mm256_mask_cmp_pd_mask(__mmask
[PATCH] D45616: [X86] Lower _mm[256|512]_cmp[.]_mask intrinsics to native llvm IR
GBuella added a comment. I was overzealous with the intrinsics, I lower really only the packed comparison now. https://reviews.llvm.org/D45616 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48363: [clang-format] Enable text proto formatting in common functions
krasimir created this revision. Herald added a subscriber: cfe-commits. Repository: rC Clang https://reviews.llvm.org/D48363 Files: lib/Format/Format.cpp Index: lib/Format/Format.cpp === --- lib/Format/Format.cpp +++ lib/Format/Format.cpp @@ -774,7 +774,10 @@ "PROTO", }, /*EnclosingFunctionNames=*/ - {}, + { + "PARSE_TEXT_PROTO", + "EqualsProto", + }, /*CanonicalDelimiter=*/"", /*BasedOnStyle=*/"google", }, Index: lib/Format/Format.cpp === --- lib/Format/Format.cpp +++ lib/Format/Format.cpp @@ -774,7 +774,10 @@ "PROTO", }, /*EnclosingFunctionNames=*/ - {}, + { + "PARSE_TEXT_PROTO", + "EqualsProto", + }, /*CanonicalDelimiter=*/"", /*BasedOnStyle=*/"google", }, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48346: [X86] Rewrite the add/mul/or/and reduction intrinsics to make better use of other intrinsics and remove undef shuffle indices.
RKSimon added inline comments. Comment at: test/CodeGen/avx512-reduceIntrin.c:1 // RUN: %clang_cc1 -ffreestanding %s -O2 -triple=x86_64-apple-darwin -target-cpu skylake-avx512 -emit-llvm -o - -Wall -Werror | FileCheck %s We're using -O2 here but most codegen tests use -O0 - is that OK? It makes much more recognisable codegen, but I don't know what people expect from these intrinsics without optimization. Repository: rC Clang https://reviews.llvm.org/D48346 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48367: [modules] Fix 37878; Autoload subdirectory modulemaps with specific LangOpts
yamaguchi created this revision. yamaguchi added reviewers: rsmith, aprantl, bruno. Reproducer and errors: https://bugs.llvm.org/show_bug.cgi?id=37878 lookupModule was falling back to loadSubdirectoryModuleMaps when it couldn't find ModuleName in (proper) search paths. This was causing iteration over all files in the search path subdirectories for example "/usr/include/foobar" in bugzilla case. Users don't expect Clang to load modulemaps in subdirectories implicitly, and also the disk access is not cheap. if (ModMap.getLangOpts().ObjC1) is because I heard that this subdirectory autoloading was supposed to happen only with ObjC. https://reviews.llvm.org/D48367 Files: clang/include/clang/Lex/ModuleMap.h clang/lib/Lex/HeaderSearch.cpp Index: clang/lib/Lex/HeaderSearch.cpp === --- clang/lib/Lex/HeaderSearch.cpp +++ clang/lib/Lex/HeaderSearch.cpp @@ -282,7 +282,8 @@ // Load all module maps in the immediate subdirectories of this search // directory. -loadSubdirectoryModuleMaps(SearchDirs[Idx]); +if (ModMap.getLangOpts().ObjC1) + loadSubdirectoryModuleMaps(SearchDirs[Idx]); // Look again for the module. Module = ModMap.findModule(ModuleName); Index: clang/include/clang/Lex/ModuleMap.h === --- clang/include/clang/Lex/ModuleMap.h +++ clang/include/clang/Lex/ModuleMap.h @@ -110,6 +110,10 @@ llvm::StringMap> PendingLinkAsModule; public: + const LangOptions getLangOpts() { +return LangOpts; + } + /// Use PendingLinkAsModule information to mark top level link names that /// are going to be replaced by export_as aliases. void resolveLinkAsDependencies(Module *Mod); Index: clang/lib/Lex/HeaderSearch.cpp === --- clang/lib/Lex/HeaderSearch.cpp +++ clang/lib/Lex/HeaderSearch.cpp @@ -282,7 +282,8 @@ // Load all module maps in the immediate subdirectories of this search // directory. -loadSubdirectoryModuleMaps(SearchDirs[Idx]); +if (ModMap.getLangOpts().ObjC1) + loadSubdirectoryModuleMaps(SearchDirs[Idx]); // Look again for the module. Module = ModMap.findModule(ModuleName); Index: clang/include/clang/Lex/ModuleMap.h === --- clang/include/clang/Lex/ModuleMap.h +++ clang/include/clang/Lex/ModuleMap.h @@ -110,6 +110,10 @@ llvm::StringMap> PendingLinkAsModule; public: + const LangOptions getLangOpts() { +return LangOpts; + } + /// Use PendingLinkAsModule information to mark top level link names that /// are going to be replaced by export_as aliases. void resolveLinkAsDependencies(Module *Mod); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r335116 - [analyzer] Optimize constraint generation when the range is a concrete value
Author: mramalho Date: Wed Jun 20 04:42:12 2018 New Revision: 335116 URL: http://llvm.org/viewvc/llvm-project?rev=335116&view=rev Log: [analyzer] Optimize constraint generation when the range is a concrete value Summary: If a constraint is something like: ``` $0 = [1,1] ``` it'll now be created as: ``` assert($0 == 1) ``` instead of: ``` assert($0 >= 1 && $0 <= 1) ``` In general, ~3% speedup when solving per query in my machine. Biggest improvement was when verifying sqlite3, total time went down from 3000s to 2200s. I couldn't create a test for this as there is no way to dump the formula yet. D48221 adds a method to dump the formula but there is no way to do it from the command line. Also, a test that prints the formula will most likely fail in the future, as different solvers print the formula in different formats. Reviewers: NoQ, george.karpenkov, ddcc Reviewed By: george.karpenkov Subscribers: xazax.hun, szepet, a.sidorin Differential Revision: https://reviews.llvm.org/D48227 Modified: cfe/trunk/lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp Modified: cfe/trunk/lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp?rev=335116&r1=335115&r2=335116&view=diff == --- cfe/trunk/lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp Wed Jun 20 04:42:12 2018 @@ -994,6 +994,11 @@ private: BinaryOperator::Opcode Op, const Z3Expr &RHS, QualType RTy, QualType *RetTy) const; + // Wrapper to generate Z3Expr from a range. If From == To, an equality will + // be created instead. + Z3Expr getZ3RangeExpr(SymbolRef Sym, const llvm::APSInt &From, +const llvm::APSInt &To, bool InRange); + //===--===// // Helper functions. //===--===// @@ -1052,35 +1057,7 @@ ProgramStateRef Z3ConstraintManager::ass ProgramStateRef Z3ConstraintManager::assumeSymInclusiveRange( ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &From, const llvm::APSInt &To, bool InRange) { - QualType RetTy; - // The expression may be casted, so we cannot call getZ3DataExpr() directly - Z3Expr Exp = getZ3Expr(Sym, &RetTy); - - QualType FromTy; - llvm::APSInt NewFromInt; - std::tie(NewFromInt, FromTy) = fixAPSInt(From); - Z3Expr FromExp = Z3Expr::fromAPSInt(NewFromInt); - - // Construct single (in)equality - if (From == To) -return assumeZ3Expr(State, Sym, -getZ3BinExpr(Exp, RetTy, InRange ? BO_EQ : BO_NE, - FromExp, FromTy, nullptr)); - - QualType ToTy; - llvm::APSInt NewToInt; - std::tie(NewToInt, ToTy) = fixAPSInt(To); - Z3Expr ToExp = Z3Expr::fromAPSInt(NewToInt); - assert(FromTy == ToTy && "Range values have different types!"); - // Construct two (in)equalities, and a logical and/or - Z3Expr LHS = getZ3BinExpr(Exp, RetTy, InRange ? BO_GE : BO_LT, FromExp, -FromTy, nullptr); - Z3Expr RHS = - getZ3BinExpr(Exp, RetTy, InRange ? BO_LE : BO_GT, ToExp, ToTy, nullptr); - return assumeZ3Expr( - State, Sym, - Z3Expr::fromBinOp(LHS, InRange ? BO_LAnd : BO_LOr, RHS, -RetTy->isSignedIntegerOrEnumerationType())); + return assumeZ3Expr(State, Sym, getZ3RangeExpr(Sym, From, To, InRange)); } ProgramStateRef Z3ConstraintManager::assumeSymUnsupported(ProgramStateRef State, @@ -1264,31 +1241,14 @@ void Z3ConstraintManager::addRangeConstr SymbolRef Sym = I.first; Z3Expr Constraints = Z3Expr::fromBoolean(false); - for (const auto &Range : I.second) { - const llvm::APSInt &From = Range.From(); - const llvm::APSInt &To = Range.To(); + Z3Expr SymRange = + getZ3RangeExpr(Sym, Range.From(), Range.To(), /*InRange=*/true); - QualType FromTy; - llvm::APSInt NewFromInt; - std::tie(NewFromInt, FromTy) = fixAPSInt(From); - Z3Expr FromExp = Z3Expr::fromAPSInt(NewFromInt); - QualType SymTy; - Z3Expr Exp = getZ3Expr(Sym, &SymTy); - bool IsSignedTy = SymTy->isSignedIntegerOrEnumerationType(); - QualType ToTy; - llvm::APSInt NewToInt; - std::tie(NewToInt, ToTy) = fixAPSInt(To); - Z3Expr ToExp = Z3Expr::fromAPSInt(NewToInt); - assert(FromTy == ToTy && "Range values have different types!"); - - Z3Expr LHS = - getZ3BinExpr(Exp, SymTy, BO_GE, FromExp, FromTy, /*RetTy=*/nullptr); - Z3Expr RHS = - getZ3BinExpr(Exp, SymTy, BO_LE, ToExp, FromTy, /*RetTy=*/nullptr); - Z3Expr SymRange = Z3Expr::fromBinOp(LHS, BO_LAnd, RHS, IsSignedTy); + // FIXME: the last argument (isSigned) is not used when generating the + // or expression, as
r335084 - Append new attributes to the end of an AttributeList.
Author: meinersbur Date: Tue Jun 19 16:46:52 2018 New Revision: 335084 URL: http://llvm.org/viewvc/llvm-project?rev=335084&view=rev Log: Append new attributes to the end of an AttributeList. ... instead of prepending it at the beginning (the original behavior since implemented in r122535 2010-12-23). This builds up an AttributeList in the the order in which the attributes appear in the source. The reverse order caused nodes for attributes in the AST (e.g. LoopHint) to be in the reverse, and therefore printed in the wrong order by -ast-dump. Some TODO comments mention this. The order was explicitly reversed for enable_if attribute overload resolution and name mangling, which is not necessary anymore with this patch. The change unfortunately has some secondary effects, especially for diagnostic output. In the simplest cases, the CHECK lines or expected diagnostic were changed to the the new output. If the kind of error/warning changed, the attribute's order was changed instead. It also causes some 'previous occurrence here' hints to be textually after the main marker. This typically happens when attributes are merged, but are incompatible. Interchanging the role of the the main and note SourceLocation will also cause the case where two different declaration's attributes (in contrast to multiple attributes of the same declaration) are merged to be reversed. There is no easy fix because sometimes previous attributes are merged into a new declaration's attribute list, sometimes new attributes are added to a previous declaration's attribute list. Since 'previous occurrence here' pointing to locations after the main marker is not rare, I left the markers as-is; it is only relevant when the attributes are declared in the same declaration anyway, which often is on the same line. Differential Revision: https://reviews.llvm.org/D48100 Modified: cfe/trunk/include/clang/Sema/AttributeList.h cfe/trunk/lib/AST/ItaniumMangle.cpp cfe/trunk/lib/Parse/ParseDecl.cpp cfe/trunk/lib/Sema/SemaOverload.cpp cfe/trunk/lib/Serialization/ASTReaderDecl.cpp cfe/trunk/test/Index/annotate-comments-availability-attrs.cpp cfe/trunk/test/Index/complete-with-annotations.cpp cfe/trunk/test/Misc/ast-print-pragmas.cpp cfe/trunk/test/PCH/pragma-loop.cpp cfe/trunk/test/Parser/pragma-loop-safety.cpp cfe/trunk/test/Parser/pragma-loop.cpp cfe/trunk/test/Parser/pragma-unroll.cpp cfe/trunk/test/Sema/attr-availability-tvos.c cfe/trunk/test/Sema/attr-availability.c cfe/trunk/test/Sema/attr-coldhot.c cfe/trunk/test/Sema/attr-disable-tail-calls.c cfe/trunk/test/Sema/attr-long-call.c cfe/trunk/test/Sema/attr-micromips.c cfe/trunk/test/Sema/attr-notail.c cfe/trunk/test/Sema/attr-ownership.c cfe/trunk/test/Sema/attr-ownership.cpp cfe/trunk/test/Sema/attr-print.c cfe/trunk/test/Sema/attr-swiftcall.c cfe/trunk/test/Sema/attr-target-mv.c cfe/trunk/test/Sema/attr-visibility.c cfe/trunk/test/Sema/internal_linkage.c cfe/trunk/test/Sema/mips-interrupt-attr.c cfe/trunk/test/Sema/ms_abi-sysv_abi.c cfe/trunk/test/Sema/nullability.c cfe/trunk/test/Sema/stdcall-fastcall.c cfe/trunk/test/SemaCXX/attr-print.cpp cfe/trunk/test/SemaCXX/attr-swiftcall.cpp cfe/trunk/test/SemaCXX/decl-microsoft-call-conv.cpp cfe/trunk/test/SemaCXX/ms-uuid.cpp cfe/trunk/test/SemaOpenCL/address-spaces.cl cfe/trunk/test/SemaTemplate/attributes.cpp Modified: cfe/trunk/include/clang/Sema/AttributeList.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/AttributeList.h?rev=335084&r1=335083&r2=335084&view=diff == --- cfe/trunk/include/clang/Sema/AttributeList.h (original) +++ cfe/trunk/include/clang/Sema/AttributeList.h Tue Jun 19 16:46:52 2018 @@ -764,8 +764,11 @@ public: void add(AttributeList *newAttr) { assert(newAttr); assert(newAttr->getNext() == nullptr); -newAttr->setNext(list); -list = newAttr; + +// FIXME: AttributeList is a singly linked list, i.e. appending to the end +// requires walking to the last element. For adding n attributes, this +// requires O(n^2) time. However, AttributeLists should be very short. +addAllAtEnd(newAttr); } void addAll(AttributeList *newList) { Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=335084&r1=335083&r2=335084&view=diff == --- cfe/trunk/lib/AST/ItaniumMangle.cpp (original) +++ cfe/trunk/lib/AST/ItaniumMangle.cpp Tue Jun 19 16:46:52 2018 @@ -707,10 +707,8 @@ void CXXNameMangler::mangleFunctionEncod if (FD->hasAttr()) { FunctionTypeDepthState Saved = FunctionTypeDepth.push(); Out << "Ua9enable_ifI"; -// FIXME: specific_attr_iterator iterates in reverse order. Fix that and use -// it here. -
[PATCH] D48367: [modules] Fix 37878; Autoload subdirectory modulemaps with specific LangOpts
yamaguchi updated this revision to Diff 152086. yamaguchi added a comment. Update commmit message and comment, add ObjC2 https://reviews.llvm.org/D48367 Files: clang/include/clang/Lex/ModuleMap.h clang/lib/Lex/HeaderSearch.cpp Index: clang/lib/Lex/HeaderSearch.cpp === --- clang/lib/Lex/HeaderSearch.cpp +++ clang/lib/Lex/HeaderSearch.cpp @@ -282,7 +282,8 @@ // Load all module maps in the immediate subdirectories of this search // directory. -loadSubdirectoryModuleMaps(SearchDirs[Idx]); +if (ModMap.getLangOpts().ObjC1 || ModMap.getLangOpts().ObjC2) + loadSubdirectoryModuleMaps(SearchDirs[Idx]); // Look again for the module. Module = ModMap.findModule(ModuleName); Index: clang/include/clang/Lex/ModuleMap.h === --- clang/include/clang/Lex/ModuleMap.h +++ clang/include/clang/Lex/ModuleMap.h @@ -110,6 +110,11 @@ llvm::StringMap> PendingLinkAsModule; public: + /// Get LangOpts of ModuleMap + const LangOptions& getLangOpts() { +return LangOpts; + } + /// Use PendingLinkAsModule information to mark top level link names that /// are going to be replaced by export_as aliases. void resolveLinkAsDependencies(Module *Mod); Index: clang/lib/Lex/HeaderSearch.cpp === --- clang/lib/Lex/HeaderSearch.cpp +++ clang/lib/Lex/HeaderSearch.cpp @@ -282,7 +282,8 @@ // Load all module maps in the immediate subdirectories of this search // directory. -loadSubdirectoryModuleMaps(SearchDirs[Idx]); +if (ModMap.getLangOpts().ObjC1 || ModMap.getLangOpts().ObjC2) + loadSubdirectoryModuleMaps(SearchDirs[Idx]); // Look again for the module. Module = ModMap.findModule(ModuleName); Index: clang/include/clang/Lex/ModuleMap.h === --- clang/include/clang/Lex/ModuleMap.h +++ clang/include/clang/Lex/ModuleMap.h @@ -110,6 +110,11 @@ llvm::StringMap> PendingLinkAsModule; public: + /// Get LangOpts of ModuleMap + const LangOptions& getLangOpts() { +return LangOpts; + } + /// Use PendingLinkAsModule information to mark top level link names that /// are going to be replaced by export_as aliases. void resolveLinkAsDependencies(Module *Mod); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48368: [clangd] Sema ranking tweaks: downrank keywords and injected names.
sammccall created this revision. Herald added subscribers: cfe-commits, jkorous, MaskRay, ioeric, ilya-biryukov. Injected names being ranked too high was just a bug. The high boost for keywords was intended, but was too much given how useless keywords are. We should probably boost them on a case-by-case basis eventually. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D48368 Files: clangd/Quality.cpp unittests/clangd/QualityTests.cpp Index: unittests/clangd/QualityTests.cpp === --- unittests/clangd/QualityTests.cpp +++ unittests/clangd/QualityTests.cpp @@ -84,6 +84,7 @@ int deprecated() { return 0; } namespace { struct X { void y() { int z; } }; } +struct S{} )cpp"; auto AST = Test.build(); @@ -115,6 +116,10 @@ Relevance = {}; Relevance.merge(CodeCompletionResult(&findAnyDecl(AST, "z"), 42)); EXPECT_EQ(Relevance.Scope, SymbolRelevanceSignals::FunctionScope); + // The injected class name is treated as the outer class name. + Relevance = {}; + Relevance.merge(CodeCompletionResult(&findDecl(AST, "S::S"), 42)); + EXPECT_EQ(Relevance.Scope, SymbolRelevanceSignals::GlobalScope); } // Do the signals move the scores in the direction we expect? Index: clangd/Quality.cpp === --- clangd/Quality.cpp +++ clangd/Quality.cpp @@ -156,8 +156,8 @@ Score *= 0.1f; switch (Category) { -case Keyword: // Usually relevant, but misses most signals. - Score *= 10; +case Keyword: // Often relevant, but misses most signals. + Score *= 4; // FIXME: important keywords should have specific boosts. break; case Type: case Function: @@ -241,18 +241,22 @@ } static SymbolRelevanceSignals::AccessibleScope -ComputeScope(const NamedDecl &D) { +ComputeScope(const NamedDecl *D) { + // Injected "Foo" within the class "Foo" has file scope, not class scope. + const DeclContext *DC = D->getDeclContext(); + if (auto *R = dyn_cast_or_null(D)) +if (R->isInjectedClassName()) + DC = DC->getParent(); bool InClass = false; - for (const DeclContext *DC = D.getDeclContext(); !DC->isFileContext(); - DC = DC->getParent()) { + for (; !DC->isFileContext(); DC = DC->getParent()) { if (DC->isFunctionOrMethod()) return SymbolRelevanceSignals::FunctionScope; InClass = InClass || DC->isRecord(); } if (InClass) return SymbolRelevanceSignals::ClassScope; // This threshold could be tweaked, e.g. to treat module-visible as global. - if (D.getLinkageInternal() < ExternalLinkage) + if (D->getLinkageInternal() < ExternalLinkage) return SymbolRelevanceSignals::FileScope; return SymbolRelevanceSignals::GlobalScope; } @@ -280,7 +284,7 @@ // Declarations are scoped, others (like macros) are assumed global. if (SemaCCResult.Declaration) -Scope = std::min(Scope, ComputeScope(*SemaCCResult.Declaration)); +Scope = std::min(Scope, ComputeScope(SemaCCResult.Declaration)); } float SymbolRelevanceSignals::evaluate() const { Index: unittests/clangd/QualityTests.cpp === --- unittests/clangd/QualityTests.cpp +++ unittests/clangd/QualityTests.cpp @@ -84,6 +84,7 @@ int deprecated() { return 0; } namespace { struct X { void y() { int z; } }; } +struct S{} )cpp"; auto AST = Test.build(); @@ -115,6 +116,10 @@ Relevance = {}; Relevance.merge(CodeCompletionResult(&findAnyDecl(AST, "z"), 42)); EXPECT_EQ(Relevance.Scope, SymbolRelevanceSignals::FunctionScope); + // The injected class name is treated as the outer class name. + Relevance = {}; + Relevance.merge(CodeCompletionResult(&findDecl(AST, "S::S"), 42)); + EXPECT_EQ(Relevance.Scope, SymbolRelevanceSignals::GlobalScope); } // Do the signals move the scores in the direction we expect? Index: clangd/Quality.cpp === --- clangd/Quality.cpp +++ clangd/Quality.cpp @@ -156,8 +156,8 @@ Score *= 0.1f; switch (Category) { -case Keyword: // Usually relevant, but misses most signals. - Score *= 10; +case Keyword: // Often relevant, but misses most signals. + Score *= 4; // FIXME: important keywords should have specific boosts. break; case Type: case Function: @@ -241,18 +241,22 @@ } static SymbolRelevanceSignals::AccessibleScope -ComputeScope(const NamedDecl &D) { +ComputeScope(const NamedDecl *D) { + // Injected "Foo" within the class "Foo" has file scope, not class scope. + const DeclContext *DC = D->getDeclContext(); + if (auto *R = dyn_cast_or_null(D)) +if (R->isInjectedClassName()) + DC = DC->getParent(); bool InClass = false; - for (const DeclContext *DC = D.getDeclContext(); !DC->isFileContext(); - DC = DC->getParent()) { + for (; !DC->isFileContext(); DC = DC->getParent()) { if
[PATCH] D48373: [Driver] Make scudo compatible with -fsanitize-minimal-runtime
cryptoad created this revision. cryptoad added a reviewer: eugenis. Herald added a subscriber: cfe-commits. This is the clang side of the change, there is a compiler-rt counterpart. Scudo works with UBSan using `-fsanitize=scudo,integer` for example, and to do so it embeds UBSan runtime. This makes it not compatible with the UBSan minimal runtime, but this is something we want for production purposes. The idea is to have a Scudo minimal runtime on the compiler-rt side that will not embed UBSan. This is basically the runtime that is currently in use for Fuchsia, without coverage, stacktraces or symbolization. With this, Scudo becomes compatible with `-fsanitize-minimal-runtime`. If this approach is suitable, I'll add the tests as well, otherwise I am open to other options. Repository: rC Clang https://reviews.llvm.org/D48373 Files: lib/Driver/SanitizerArgs.cpp lib/Driver/ToolChains/CommonArgs.cpp Index: lib/Driver/ToolChains/CommonArgs.cpp === --- lib/Driver/ToolChains/CommonArgs.cpp +++ lib/Driver/ToolChains/CommonArgs.cpp @@ -593,14 +593,17 @@ HelperStaticRuntimes.push_back("asan-preinit"); } if (SanArgs.needsUbsanRt()) { - if (SanArgs.requiresMinimalRuntime()) { + if (SanArgs.requiresMinimalRuntime()) SharedRuntimes.push_back("ubsan_minimal"); - } else { + else SharedRuntimes.push_back("ubsan_standalone"); - } } -if (SanArgs.needsScudoRt()) - SharedRuntimes.push_back("scudo"); +if (SanArgs.needsScudoRt()) { + if (SanArgs.requiresMinimalRuntime()) +SharedRuntimes.push_back("scudo_minimal"); + else +SharedRuntimes.push_back("scudo"); +} if (SanArgs.needsHwasanRt()) SharedRuntimes.push_back("hwasan"); } @@ -666,9 +669,15 @@ if (SanArgs.needsEsanRt()) StaticRuntimes.push_back("esan"); if (SanArgs.needsScudoRt()) { -StaticRuntimes.push_back("scudo"); -if (SanArgs.linkCXXRuntimes()) - StaticRuntimes.push_back("scudo_cxx"); +if (SanArgs.requiresMinimalRuntime()) { + StaticRuntimes.push_back("scudo_minimal"); + if (SanArgs.linkCXXRuntimes()) +StaticRuntimes.push_back("scudo_cxx_minimal"); +} else { + StaticRuntimes.push_back("scudo"); + if (SanArgs.linkCXXRuntimes()) +StaticRuntimes.push_back("scudo_cxx"); +} } } Index: lib/Driver/SanitizerArgs.cpp === --- lib/Driver/SanitizerArgs.cpp +++ lib/Driver/SanitizerArgs.cpp @@ -45,7 +45,7 @@ Nullability | LocalBounds | CFI, TrappingDefault = CFI, CFIClasses = CFIVCall | CFINVCall | CFIDerivedCast | CFIUnrelatedCast, - CompatibleWithMinimalRuntime = TrappingSupported, + CompatibleWithMinimalRuntime = TrappingSupported | Scudo, }; enum CoverageFeature { @@ -179,7 +179,8 @@ bool SanitizerArgs::needsUbsanRt() const { // All of these include ubsan. if (needsAsanRt() || needsMsanRt() || needsHwasanRt() || needsTsanRt() || - needsDfsanRt() || needsLsanRt() || needsCfiDiagRt() || needsScudoRt()) + needsDfsanRt() || needsLsanRt() || needsCfiDiagRt() || + (needsScudoRt() && !requiresMinimalRuntime())) return false; return (Sanitizers.Mask & NeedsUbsanRt & ~TrapSanitizers.Mask) || Index: lib/Driver/ToolChains/CommonArgs.cpp === --- lib/Driver/ToolChains/CommonArgs.cpp +++ lib/Driver/ToolChains/CommonArgs.cpp @@ -593,14 +593,17 @@ HelperStaticRuntimes.push_back("asan-preinit"); } if (SanArgs.needsUbsanRt()) { - if (SanArgs.requiresMinimalRuntime()) { + if (SanArgs.requiresMinimalRuntime()) SharedRuntimes.push_back("ubsan_minimal"); - } else { + else SharedRuntimes.push_back("ubsan_standalone"); - } } -if (SanArgs.needsScudoRt()) - SharedRuntimes.push_back("scudo"); +if (SanArgs.needsScudoRt()) { + if (SanArgs.requiresMinimalRuntime()) +SharedRuntimes.push_back("scudo_minimal"); + else +SharedRuntimes.push_back("scudo"); +} if (SanArgs.needsHwasanRt()) SharedRuntimes.push_back("hwasan"); } @@ -666,9 +669,15 @@ if (SanArgs.needsEsanRt()) StaticRuntimes.push_back("esan"); if (SanArgs.needsScudoRt()) { -StaticRuntimes.push_back("scudo"); -if (SanArgs.linkCXXRuntimes()) - StaticRuntimes.push_back("scudo_cxx"); +if (SanArgs.requiresMinimalRuntime()) { + StaticRuntimes.push_back("scudo_minimal"); + if (SanArgs.linkCXXRuntimes()) +StaticRuntimes.push_back("scudo_cxx_minimal"); +} else { + StaticRuntimes.push_back("scudo"); + if (SanArgs.linkCXXRuntimes()) +StaticRuntimes.push_back("scudo_cxx"); +} } } Index: lib/Driver/SanitizerArgs.cpp === --- lib/Driver/
r335139 - Simplify. No behavior change.
Author: nico Date: Wed Jun 20 08:57:38 2018 New Revision: 335139 URL: http://llvm.org/viewvc/llvm-project?rev=335139&view=rev Log: Simplify. No behavior change. Modified: cfe/trunk/lib/Sema/SemaInit.cpp Modified: cfe/trunk/lib/Sema/SemaInit.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=335139&r1=335138&r2=335139&view=diff == --- cfe/trunk/lib/Sema/SemaInit.cpp (original) +++ cfe/trunk/lib/Sema/SemaInit.cpp Wed Jun 20 08:57:38 2018 @@ -6446,13 +6446,7 @@ static void CheckMoveOnConstruction(Sema // Find the std::move call and get the argument. const CallExpr *CE = dyn_cast(InitExpr->IgnoreParens()); - if (!CE || CE->getNumArgs() != 1) -return; - - const FunctionDecl *MoveFunction = CE->getDirectCallee(); - if (!MoveFunction || !MoveFunction->isInStdNamespace() || - !MoveFunction->getIdentifier() || - !MoveFunction->getIdentifier()->isStr("move")) + if (!CE || !CE->isCallToStdMove()) return; const Expr *Arg = CE->getArg(0)->IgnoreImplicit(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48375: [clangd] Remove FilterText from the index.
sammccall created this revision. sammccall added a reviewer: ioeric. Herald added subscribers: cfe-commits, jkorous, MaskRay, ilya-biryukov. It's almost always identical to Name, and in fact we never used it (we used name instead). The only case where they differ is objc method selectors (foo: vs foo:bar:). We can live with the latter for both name and filterText, so I've made that change too. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D48375 Files: clangd/CodeComplete.cpp clangd/CodeCompletionStrings.cpp clangd/CodeCompletionStrings.h clangd/index/Index.cpp clangd/index/Index.h clangd/index/Merge.cpp clangd/index/SymbolCollector.cpp clangd/index/SymbolYAML.cpp unittests/clangd/CodeCompletionStringsTests.cpp Index: unittests/clangd/CodeCompletionStringsTests.cpp === --- unittests/clangd/CodeCompletionStringsTests.cpp +++ unittests/clangd/CodeCompletionStringsTests.cpp @@ -43,13 +43,6 @@ EXPECT_EQ(getDetail(*Builder.TakeString()), "result"); } -TEST_F(CompletionStringTest, FilterText) { - Builder.AddTypedTextChunk("typed"); - Builder.AddTypedTextChunk("redundant typed no no"); - auto *S = Builder.TakeString(); - EXPECT_EQ(getFilterText(*S), "typed"); -} - TEST_F(CompletionStringTest, Documentation) { Builder.addBriefComment("This is ignored"); EXPECT_EQ(formatDocumentation(*Builder.TakeString(), "Is this brief?"), @@ -115,7 +108,6 @@ EXPECT_EQ(Label, "Foo(p1, p2)"); EXPECT_EQ(InsertText, "Foo(${1:p1}, ${2:p2})"); EXPECT_EQ(formatDocumentation(*CCS, "Foo's comment"), "Foo's comment"); - EXPECT_EQ(getFilterText(*CCS), "Foo"); } TEST_F(CompletionStringTest, EscapeSnippet) { Index: clangd/index/SymbolYAML.cpp === --- clangd/index/SymbolYAML.cpp +++ clangd/index/SymbolYAML.cpp @@ -111,7 +111,6 @@ IO.mapOptional("IsIndexedForCodeCompletion", Sym.IsIndexedForCodeCompletion, false); IO.mapRequired("CompletionLabel", Sym.CompletionLabel); -IO.mapRequired("CompletionFilterText", Sym.CompletionFilterText); IO.mapRequired("CompletionPlainInsertText", Sym.CompletionPlainInsertText); IO.mapOptional("CompletionSnippetInsertText", Index: clangd/index/SymbolCollector.cpp === --- clangd/index/SymbolCollector.cpp +++ clangd/index/SymbolCollector.cpp @@ -402,7 +402,6 @@ /*EnableSnippets=*/true); getLabelAndInsertText(*CCS, &IgnoredLabel, &PlainInsertText, /*EnableSnippets=*/false); - std::string FilterText = getFilterText(*CCS); std::string Documentation = formatDocumentation(*CCS, getDocComment(Ctx, SymbolCompletion, /*CommentsFromHeaders=*/true)); @@ -416,7 +415,6 @@ QName, SM, SM.getExpansionLoc(ND.getLocation()), Opts)) Include = std::move(*Header); } - S.CompletionFilterText = FilterText; S.CompletionLabel = Label; S.CompletionPlainInsertText = PlainInsertText; S.CompletionSnippetInsertText = SnippetInsertText; Index: clangd/index/Merge.cpp === --- clangd/index/Merge.cpp +++ clangd/index/Merge.cpp @@ -98,8 +98,6 @@ S.References += O.References; if (S.CompletionLabel == "") S.CompletionLabel = O.CompletionLabel; - if (S.CompletionFilterText == "") -S.CompletionFilterText = O.CompletionFilterText; if (S.CompletionPlainInsertText == "") S.CompletionPlainInsertText = O.CompletionPlainInsertText; if (S.CompletionSnippetInsertText == "") Index: clangd/index/Index.h === --- clangd/index/Index.h +++ clangd/index/Index.h @@ -156,10 +156,6 @@ /// candidate list. For example, "Foo(X x, Y y) const" is a label for a /// function. llvm::StringRef CompletionLabel; - /// The piece of text that the user is expected to type to match the - /// code-completion string, typically a keyword or the name of a declarator or - /// macro. - llvm::StringRef CompletionFilterText; /// What to insert when completing this symbol (plain text version). llvm::StringRef CompletionPlainInsertText; /// What to insert when completing this symbol (snippet version). This is Index: clangd/index/Index.cpp === --- clangd/index/Index.cpp +++ clangd/index/Index.cpp @@ -85,7 +85,6 @@ Intern(S.Definition.FileURI); Intern(S.CompletionLabel); - Intern(S.CompletionFilterText); Intern(S.CompletionPlainInsertText); Intern(S.CompletionSnippetInsertText); Index: clangd/CodeCompletionStrings.h === --- clangd/CodeCompletionStrings.h +++ clangd/CodeCompletionStrings.h @@ -65,11 +65,6 @@ /// is usually the return typ
[PATCH] D48367: [modules] Fix 37878; Autoload subdirectory modulemaps with specific LangOpts
aprantl added inline comments. Comment at: clang/lib/Lex/HeaderSearch.cpp:285 // directory. -loadSubdirectoryModuleMaps(SearchDirs[Idx]); +if (ModMap.getLangOpts().ObjC1 || ModMap.getLangOpts().ObjC2) + loadSubdirectoryModuleMaps(SearchDirs[Idx]); Are these flags also enabled in Objective-C++ mode? https://reviews.llvm.org/D48367 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48291: [analyzer][UninitializedObjectChecker] Fixed captured lambda variable name
Szelethus updated this revision to Diff 152105. Szelethus added a comment. Fixes according to inline comments. https://reviews.llvm.org/D48291 Files: lib/StaticAnalyzer/Checkers/UninitializedObjectChecker.cpp test/Analysis/cxx-uninitialized-object.cpp Index: test/Analysis/cxx-uninitialized-object.cpp === --- test/Analysis/cxx-uninitialized-object.cpp +++ test/Analysis/cxx-uninitialized-object.cpp @@ -737,6 +737,22 @@ //===--===// template +struct LambdaThisTest { + Callable functor; + + LambdaThisTest(const Callable &functor, int) : functor(functor) { +// All good! + } +}; + +struct HasCapturableThis { + void fLambdaThisTest() { +auto isEven = [this](int a) { return a % 2 == 0; }; // no-crash +LambdaThisTest(isEven, int()); + } +}; + +template struct LambdaTest1 { Callable functor; @@ -760,7 +776,7 @@ void fLambdaTest2() { int b; - auto equals = [&b](int a) { return a == b; }; // expected-note{{uninitialized field 'this->functor.'}} + auto equals = [&b](int a) { return a == b; }; // expected-note{{uninitialized field 'this->functor.b'}} LambdaTest2(equals, int()); } #else @@ -782,8 +798,8 @@ namespace LT3Detail { struct RecordType { - int x; // expected-note{{uninitialized field 'this->functor..x'}} - int y; // expected-note{{uninitialized field 'this->functor..y'}} + int x; // expected-note{{uninitialized field 'this->functor.rec1.x'}} + int y; // expected-note{{uninitialized field 'this->functor.rec1.y'}} }; } // namespace LT3Detail @@ -826,6 +842,35 @@ } #endif //PEDANTIC +template +struct MultipleLambdaCapturesTest1 { + Callable functor; + int dontGetFilteredByNonPedanticMode = 0; + + MultipleLambdaCapturesTest1(const Callable &functor, int) : functor(functor) {} // expected-warning{{2 uninitialized field}} +}; + +void fMultipleLambdaCapturesTest1() { + int b1, b2 = 3, b3; + auto equals = [&b1, &b2, &b3](int a) { return a == b1 == b2 == b3; }; // expected-note{{uninitialized field 'this->functor.b1'}} + // expected-note@-1{{uninitialized field 'this->functor.b3'}} + MultipleLambdaCapturesTest1(equals, int()); +} + +template +struct MultipleLambdaCapturesTest2 { + Callable functor; + int dontGetFilteredByNonPedanticMode = 0; + + MultipleLambdaCapturesTest2(const Callable &functor, int) : functor(functor) {} // expected-warning{{1 uninitialized field}} +}; + +void fMultipleLambdaCapturesTest2() { + int b1, b2 = 3, b3; + auto equals = [b1, &b2, &b3](int a) { return a == b1 == b2 == b3; }; // expected-note{{uninitialized field 'this->functor.b3'}} + MultipleLambdaCapturesTest2(equals, int()); +} + //===--===// // System header tests. //===--===// Index: lib/StaticAnalyzer/Checkers/UninitializedObjectChecker.cpp === --- lib/StaticAnalyzer/Checkers/UninitializedObjectChecker.cpp +++ lib/StaticAnalyzer/Checkers/UninitializedObjectChecker.cpp @@ -230,6 +230,10 @@ /// Constructs a note message for a given FieldChainInfo object. void printNoteMessage(llvm::raw_ostream &Out, const FieldChainInfo &Chain); +/// Returns with Field's name. This is a helper function to get the correct name +/// even if Field is a captured lambda variable. +StringRef getVariableName(const FieldDecl *Field); + } // end of anonymous namespace //===--===// @@ -604,30 +608,14 @@ // "uninitialized field 'this->x'", but we can't refer to 'x' directly, // we need an explicit namespace resolution whether the uninit field was // 'D1::x' or 'D2::x'. -// -// TODO: If a field in the fieldchain is a captured lambda parameter, this -// function constructs an empty string for it: -// -// template struct A { -// Callable c; -// A(const Callable &c, int) : c(c) {} -// }; -// -// int b; // say that this isn't zero initialized -// auto alwaysTrue = [&b](int a) { return true; }; -// -// A call with these parameters: A::A(alwaysTrue, int()) -// will emit a note with the message "uninitialized field: 'this->c.'". If -// possible, the lambda parameter name should be retrieved or be replaced with a -// "" or something similar. void FieldChainInfo::print(llvm::raw_ostream &Out) const { if (Chain.isEmpty()) return; const llvm::ImmutableListImpl *L = Chain.getInternalPointer(); printTail(Out, L->getTail()); - Out << L->getHead()->getDecl()->getNameAsString(); + Out << getVariableName(L->getHead()->getDecl()); } void FieldChainInfo::printTail( @@ -638,7 +626,7 @@ printTail(Out, L->getTail()); const FieldDecl *Field = L->getHead()->getDecl(); - Out << Field->getNameAsString(); + Out << getVariableName(Field); Out << (F
[PATCH] D47720: [DebugInfo] Inline for without DebugLocation
probinson added a comment. In https://reviews.llvm.org/D47720#1136585, @gramanas wrote: > ping! should I commit this? @vsk accepted it, so yes go ahead. Repository: rC Clang https://reviews.llvm.org/D47720 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D45616: [X86] Lower _mm[256|512]_cmp[.]_mask intrinsics to native llvm IR
craig.topper accepted this revision. craig.topper added a comment. This revision is now accepted and ready to land. LGTM https://reviews.llvm.org/D45616 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48367: [modules] Fix 37878; Autoload subdirectory modulemaps with specific LangOpts
bruno added a comment. Hi Yuka, thanks for working on this. Comment at: clang/lib/Lex/HeaderSearch.cpp:285 // directory. -loadSubdirectoryModuleMaps(SearchDirs[Idx]); +if (ModMap.getLangOpts().ObjC1 || ModMap.getLangOpts().ObjC2) + loadSubdirectoryModuleMaps(SearchDirs[Idx]); aprantl wrote: > Are these flags also enabled in Objective-C++ mode? Looks like all this logic was introduced in r177621 to allow the names of modules to differ from the name of their subdirectory in the include path. Instead of having this to be based on the language, it's probably better if we have it based on @import name lookup, which is the scenario where we actually currently look more aggressively, did you try that path? This is also lacking a testcase, can you create one? https://reviews.llvm.org/D48367 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48375: [clangd] Remove FilterText from the index.
sammccall updated this revision to Diff 152108. sammccall added a comment. use foo: instead of foo:bar: for name. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D48375 Files: clangd/CodeComplete.cpp clangd/CodeCompletionStrings.cpp clangd/CodeCompletionStrings.h clangd/index/Index.cpp clangd/index/Index.h clangd/index/Merge.cpp clangd/index/SymbolCollector.cpp clangd/index/SymbolYAML.cpp unittests/clangd/CodeCompletionStringsTests.cpp Index: unittests/clangd/CodeCompletionStringsTests.cpp === --- unittests/clangd/CodeCompletionStringsTests.cpp +++ unittests/clangd/CodeCompletionStringsTests.cpp @@ -43,13 +43,6 @@ EXPECT_EQ(getDetail(*Builder.TakeString()), "result"); } -TEST_F(CompletionStringTest, FilterText) { - Builder.AddTypedTextChunk("typed"); - Builder.AddTypedTextChunk("redundant typed no no"); - auto *S = Builder.TakeString(); - EXPECT_EQ(getFilterText(*S), "typed"); -} - TEST_F(CompletionStringTest, Documentation) { Builder.addBriefComment("This is ignored"); EXPECT_EQ(formatDocumentation(*Builder.TakeString(), "Is this brief?"), @@ -115,7 +108,6 @@ EXPECT_EQ(Label, "Foo(p1, p2)"); EXPECT_EQ(InsertText, "Foo(${1:p1}, ${2:p2})"); EXPECT_EQ(formatDocumentation(*CCS, "Foo's comment"), "Foo's comment"); - EXPECT_EQ(getFilterText(*CCS), "Foo"); } TEST_F(CompletionStringTest, EscapeSnippet) { Index: clangd/index/SymbolYAML.cpp === --- clangd/index/SymbolYAML.cpp +++ clangd/index/SymbolYAML.cpp @@ -111,7 +111,6 @@ IO.mapOptional("IsIndexedForCodeCompletion", Sym.IsIndexedForCodeCompletion, false); IO.mapRequired("CompletionLabel", Sym.CompletionLabel); -IO.mapRequired("CompletionFilterText", Sym.CompletionFilterText); IO.mapRequired("CompletionPlainInsertText", Sym.CompletionPlainInsertText); IO.mapOptional("CompletionSnippetInsertText", Index: clangd/index/SymbolCollector.cpp === --- clangd/index/SymbolCollector.cpp +++ clangd/index/SymbolCollector.cpp @@ -377,6 +377,8 @@ Symbol S; S.ID = std::move(ID); std::tie(S.Scope, S.Name) = splitQualifiedName(QName); + // FIXME: this returns foo:bar: for objective-C methods, we prefer only foo: + // for consistency with CodeCompletionString and a clean name/signature split. S.IsIndexedForCodeCompletion = isIndexedForCodeCompletion(ND, Ctx); S.SymInfo = index::getSymbolInfo(&ND); @@ -402,7 +404,6 @@ /*EnableSnippets=*/true); getLabelAndInsertText(*CCS, &IgnoredLabel, &PlainInsertText, /*EnableSnippets=*/false); - std::string FilterText = getFilterText(*CCS); std::string Documentation = formatDocumentation(*CCS, getDocComment(Ctx, SymbolCompletion, /*CommentsFromHeaders=*/true)); @@ -416,7 +417,6 @@ QName, SM, SM.getExpansionLoc(ND.getLocation()), Opts)) Include = std::move(*Header); } - S.CompletionFilterText = FilterText; S.CompletionLabel = Label; S.CompletionPlainInsertText = PlainInsertText; S.CompletionSnippetInsertText = SnippetInsertText; Index: clangd/index/Merge.cpp === --- clangd/index/Merge.cpp +++ clangd/index/Merge.cpp @@ -98,8 +98,6 @@ S.References += O.References; if (S.CompletionLabel == "") S.CompletionLabel = O.CompletionLabel; - if (S.CompletionFilterText == "") -S.CompletionFilterText = O.CompletionFilterText; if (S.CompletionPlainInsertText == "") S.CompletionPlainInsertText = O.CompletionPlainInsertText; if (S.CompletionSnippetInsertText == "") Index: clangd/index/Index.h === --- clangd/index/Index.h +++ clangd/index/Index.h @@ -156,10 +156,6 @@ /// candidate list. For example, "Foo(X x, Y y) const" is a label for a /// function. llvm::StringRef CompletionLabel; - /// The piece of text that the user is expected to type to match the - /// code-completion string, typically a keyword or the name of a declarator or - /// macro. - llvm::StringRef CompletionFilterText; /// What to insert when completing this symbol (plain text version). llvm::StringRef CompletionPlainInsertText; /// What to insert when completing this symbol (snippet version). This is Index: clangd/index/Index.cpp === --- clangd/index/Index.cpp +++ clangd/index/Index.cpp @@ -85,7 +85,6 @@ Intern(S.Definition.FileURI); Intern(S.CompletionLabel); - Intern(S.CompletionFilterText); Intern(S.CompletionPlainInsertText); Intern(S.CompletionSnippetInsertText); Index: clangd/CodeCompletionStrings.h === --- clang
[PATCH] D34156: [LTO] Enable module summary emission by default for regular LTO
tobiasvk added a comment. @pcc, @tejohnson: Are you OK with this going in now that https://reviews.llvm.org/D47898 has merged? https://reviews.llvm.org/D34156 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D44788: Add an option to support debug fission on implicit ThinLTO.
yunlian added inline comments. Comment at: lib/Driver/ToolChains/CommonArgs.cpp:428 + + if (Args.hasArg(options::OPT_gsplit_dwarf)) { +if (!Args.getLastArg(options::OPT_gsplit_dwarf_EQ)) { pcc wrote: > If you make this `else if (Args.hasArg(options::OPT_gsplit_dwarf)) {` you > wouldn't need the if on line 429. Will do. https://reviews.llvm.org/D44788 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34156: [LTO] Enable module summary emission by default for regular LTO
tejohnson accepted this revision. tejohnson added a comment. LGTM with following suggestions. Comment at: clang/lib/CodeGen/BackendUtil.cpp:776 + bool EmitLTOSummary = + (CodeGenOpts.PrepareForLTO && !CodeGenOpts.PrepareForThinLTO && + llvm::Triple(TheModule->getTargetTriple()).getVendor() != Perhaps sink all this code into the use site of EmitLTOSummary below, especially because you don't need to check !CodeGenOpts.PrepareForThinLTO. Comment at: clang/lib/CodeGen/BackendUtil.cpp:998 + bool EmitLTOSummary = + (CodeGenOpts.PrepareForLTO && !CodeGenOpts.PrepareForThinLTO && + llvm::Triple(TheModule->getTargetTriple()).getVendor() != Ditto here. https://reviews.llvm.org/D34156 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r335148 - [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals
Author: leonardchan Date: Wed Jun 20 10:19:40 2018 New Revision: 335148 URL: http://llvm.org/viewvc/llvm-project?rev=335148&view=rev Log: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals This diff includes the logic for setting the precision bits for each primary fixed point type in the target info and logic for initializing a fixed point literal. Fixed point literals are declared using the suffixes ``` hr: short _Fract uhr: unsigned short _Fract r: _Fract ur: unsigned _Fract lr: long _Fract ulr: unsigned long _Fract hk: short _Accum uhk: unsigned short _Accum k: _Accum uk: unsigned _Accum ``` Errors are also thrown for illegal literal values ``` unsigned short _Accum u_short_accum = 256.0uhk; // expected-error{{the integral part of this literal is too large for this unsigned _Accum type}} ``` Differential Revision: https://reviews.llvm.org/D46915 Added: cfe/trunk/test/Frontend/fixed_point_declarations.c cfe/trunk/test/Frontend/fixed_point_same_fbits.c Modified: cfe/trunk/include/clang-c/Index.h cfe/trunk/include/clang/AST/ASTContext.h cfe/trunk/include/clang/AST/Expr.h cfe/trunk/include/clang/AST/RecursiveASTVisitor.h cfe/trunk/include/clang/AST/Type.h cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td cfe/trunk/include/clang/Basic/LangOptions.def cfe/trunk/include/clang/Basic/StmtNodes.td cfe/trunk/include/clang/Basic/TargetInfo.h cfe/trunk/include/clang/Driver/Options.td cfe/trunk/include/clang/Lex/LiteralSupport.h cfe/trunk/lib/AST/ASTContext.cpp cfe/trunk/lib/AST/ASTDumper.cpp cfe/trunk/lib/AST/Expr.cpp cfe/trunk/lib/AST/ExprClassification.cpp cfe/trunk/lib/AST/ExprConstant.cpp cfe/trunk/lib/AST/ItaniumMangle.cpp cfe/trunk/lib/AST/StmtPrinter.cpp cfe/trunk/lib/AST/StmtProfile.cpp cfe/trunk/lib/AST/Type.cpp cfe/trunk/lib/Basic/TargetInfo.cpp cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/lib/CodeGen/CGExprAgg.cpp cfe/trunk/lib/CodeGen/CGExprScalar.cpp cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/lib/Lex/LiteralSupport.cpp cfe/trunk/lib/Sema/SemaExceptionSpec.cpp cfe/trunk/lib/Sema/SemaExpr.cpp cfe/trunk/lib/Sema/TreeTransform.h cfe/trunk/lib/Serialization/ASTReaderStmt.cpp cfe/trunk/lib/Serialization/ASTWriterStmt.cpp cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp cfe/trunk/test/Frontend/fixed_point.c cfe/trunk/test/Frontend/fixed_point_bit_widths.c cfe/trunk/test/Frontend/fixed_point_errors.c cfe/trunk/tools/libclang/CIndex.cpp cfe/trunk/tools/libclang/CXCursor.cpp Modified: cfe/trunk/include/clang-c/Index.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=335148&r1=335147&r2=335148&view=diff == --- cfe/trunk/include/clang-c/Index.h (original) +++ cfe/trunk/include/clang-c/Index.h Wed Jun 20 10:19:40 2018 @@ -2170,7 +2170,12 @@ enum CXCursorKind { */ CXCursor_ObjCAvailabilityCheckExpr = 148, - CXCursor_LastExpr = CXCursor_ObjCAvailabilityCheckExpr, + /** + * Fixed point literal + */ + CXCursor_FixedPointLiteral = 149, + + CXCursor_LastExpr = CXCursor_FixedPointLiteral, /* Statements */ CXCursor_FirstStmt = 200, Modified: cfe/trunk/include/clang/AST/ASTContext.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=335148&r1=335147&r2=335148&view=diff == --- cfe/trunk/include/clang/AST/ASTContext.h (original) +++ cfe/trunk/include/clang/AST/ASTContext.h Wed Jun 20 10:19:40 2018 @@ -1947,6 +1947,9 @@ public: return getQualifiedType(type.getUnqualifiedType(), Qs); } + unsigned char getFixedPointScale(QualType Ty) const; + unsigned char getFixedPointIBits(QualType Ty) const; + DeclarationNameInfo getNameForTemplate(TemplateName Name, SourceLocation NameLoc) const; Modified: cfe/trunk/include/clang/AST/Expr.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=335148&r1=335147&r2=335148&view=diff == --- cfe/trunk/include/clang/AST/Expr.h (original) +++ cfe/trunk/include/clang/AST/Expr.h Wed Jun 20 10:19:40 2018 @@ -1351,6 +1351,47 @@ public: } }; +class FixedPointLiteral : public Expr, public APIntStorage { + SourceLocation Loc; + unsigned Scale; + + /// \brief Construct an empty integer literal. + explicit FixedPointLiteral(EmptyShell Empty) + : Expr(FixedPointLiteralClass, Empty) {} + + public: + FixedPointLiteral(const ASTContext &C, const llvm::APInt &V, QualType type, +SourceLocation l, unsigned Scale); + + // Store the int as is without a
[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals
This revision was automatically updated to reflect the committed changes. leonardchan marked an inline comment as done. Closed by commit rC335148: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals (authored by leonardchan, committed by ). Repository: rC Clang https://reviews.llvm.org/D46915 Files: include/clang-c/Index.h include/clang/AST/ASTContext.h include/clang/AST/Expr.h include/clang/AST/RecursiveASTVisitor.h include/clang/AST/Type.h include/clang/Basic/DiagnosticCommonKinds.td include/clang/Basic/LangOptions.def include/clang/Basic/StmtNodes.td include/clang/Basic/TargetInfo.h include/clang/Driver/Options.td include/clang/Lex/LiteralSupport.h lib/AST/ASTContext.cpp lib/AST/ASTDumper.cpp lib/AST/Expr.cpp lib/AST/ExprClassification.cpp lib/AST/ExprConstant.cpp lib/AST/ItaniumMangle.cpp lib/AST/StmtPrinter.cpp lib/AST/StmtProfile.cpp lib/AST/Type.cpp lib/Basic/TargetInfo.cpp lib/Basic/Targets.cpp lib/CodeGen/CGExprAgg.cpp lib/CodeGen/CGExprScalar.cpp lib/Driver/ToolChains/Clang.cpp lib/Frontend/CompilerInvocation.cpp lib/Lex/LiteralSupport.cpp lib/Sema/SemaExceptionSpec.cpp lib/Sema/SemaExpr.cpp lib/Sema/TreeTransform.h lib/Serialization/ASTReaderStmt.cpp lib/Serialization/ASTWriterStmt.cpp lib/StaticAnalyzer/Core/ExprEngine.cpp test/Frontend/fixed_point.c test/Frontend/fixed_point_bit_widths.c test/Frontend/fixed_point_declarations.c test/Frontend/fixed_point_errors.c test/Frontend/fixed_point_same_fbits.c tools/libclang/CIndex.cpp tools/libclang/CXCursor.cpp Index: lib/Lex/LiteralSupport.cpp === --- lib/Lex/LiteralSupport.cpp +++ lib/Lex/LiteralSupport.cpp @@ -538,6 +538,7 @@ saw_exponent = false; saw_period = false; saw_ud_suffix = false; + saw_fixed_point_suffix = false; isLong = false; isUnsigned = false; isLongLong = false; @@ -547,6 +548,8 @@ isFloat16 = false; isFloat128 = false; MicrosoftInteger = 0; + isFract = false; + isAccum = false; hadError = false; if (*s == '0') { // parse radix @@ -568,19 +571,37 @@ SuffixBegin = s; checkSeparator(TokLoc, s, CSK_AfterDigits); + // Initial scan to lookahead for fixed point suffix. + for (const char *c = s; c != ThisTokEnd; ++c) { +if (*c == 'r' || *c == 'k' || *c == 'R' || *c == 'K') { + saw_fixed_point_suffix = true; + break; +} + } + // Parse the suffix. At this point we can classify whether we have an FP or // integer constant. bool isFPConstant = isFloatingLiteral(); // Loop over all of the characters of the suffix. If we see something bad, // we break out of the loop. for (; s != ThisTokEnd; ++s) { switch (*s) { +case 'R': +case 'r': + if (isFract || isAccum) break; + isFract = true; + continue; +case 'K': +case 'k': + if (isFract || isAccum) break; + isAccum = true; + continue; case 'h': // FP Suffix for "half". case 'H': // OpenCL Extension v1.2 s9.5 - h or H suffix for half type. - if (!PP.getLangOpts().Half) break; - if (!isFPConstant) break; // Error for integer constant. + if (!(PP.getLangOpts().Half || PP.getLangOpts().FixedPoint)) break; + if (isIntegerLiteral()) break; // Error for integer constant. if (isHalf || isFloat || isLong) break; // HH, FH, LH invalid. isHalf = true; continue; // Success. @@ -693,6 +714,9 @@ isHalf = false; isImaginary = false; MicrosoftInteger = 0; +saw_fixed_point_suffix = false; +isFract = false; +isAccum = false; } saw_ud_suffix = true; @@ -707,6 +731,11 @@ hadError = true; } } + + if (!hadError && saw_fixed_point_suffix) { +assert(isFract || isAccum); +assert(radix == 16 || radix == 10); + } } /// ParseDecimalOrOctalCommon - This method is called for decimal or octal @@ -1012,6 +1041,126 @@ return Result.convertFromString(Str, APFloat::rmNearestTiesToEven); } +static inline bool IsExponentPart(char c) { + return c == 'p' || c == 'P' || c == 'e' || c == 'E'; +} + +bool NumericLiteralParser::GetFixedPointValue(llvm::APInt &StoreVal, unsigned Scale) { + assert(radix == 16 || radix == 10); + + // Find how many digits are needed to store the whole literal. + unsigned NumDigits = SuffixBegin - DigitsBegin; + if (saw_period) --NumDigits; + + // Initial scan of the exponent if it exists + bool ExpOverflowOccurred = false; + bool NegativeExponent = false; + const char *ExponentBegin; + uint64_t Exponent = 0; + int64_t BaseShift = 0; + if (saw_exponent) { +const char *Ptr = DigitsBegin; + +while (!IsExponentPart(*Ptr)) ++Ptr; +ExponentBegin = Ptr; +++Ptr; +NegativeExponent = *Ptr == '-'; +if (NegativeExponent) ++Ptr; + +unsigned NumExpDigits = SuffixBegin - Ptr; +if (alwaysFitsInto64Bits(radix, Num
[PATCH] D44788: Add an option to support debug fission on implicit ThinLTO.
yunlian updated this revision to Diff 152120. yunlian added a comment. Removed redundant 'if' statement https://reviews.llvm.org/D44788 Files: include/clang/Driver/Options.td lib/Driver/ToolChains/CommonArgs.cpp test/Driver/lto-dwo.c Index: test/Driver/lto-dwo.c === --- /dev/null +++ test/Driver/lto-dwo.c @@ -0,0 +1,12 @@ +// Confirm that -gsplit-dwarf=DIR is passed to linker + +// RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin -gsplit-dwarf=DIR -o a.out 2> %t +// RUN: FileCheck -check-prefix=CHECK-LINK-DWO-DIR < %t %s +// +// CHECK-LINK-DWO-DIR: "-plugin-opt=dwo_dir=DIR{{.*}}a.out_dwo" +// + +// RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin -gsplit-dwarf -o a.out 2> %t +// RUN: FileCheck -check-prefix=CHECK-LINK-DWO-DIR-DEFAULT < %t %s +// +// CHECK-LINK-DWO-DIR-DEFAULT: "-plugin-opt=dwo_dir=a.out_dwo" Index: lib/Driver/ToolChains/CommonArgs.cpp === --- lib/Driver/ToolChains/CommonArgs.cpp +++ lib/Driver/ToolChains/CommonArgs.cpp @@ -416,6 +416,20 @@ CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=O") + OOpt)); } + if (Arg *A = Args.getLastArg(options::OPT_gsplit_dwarf_EQ)) { +StringRef Dwo_Dir = A->getValue(); +SmallString<1024> DwoDir; +llvm::sys::path::native(Dwo_Dir, DwoDir); +llvm::sys::path::append(DwoDir, Twine(Output.getFilename()) + "_dwo"); +CmdArgs.push_back( +Args.MakeArgString(Twine("-plugin-opt=dwo_dir=") + DwoDir)); + } + else if (Args.hasArg(options::OPT_gsplit_dwarf)) { +CmdArgs.push_back( +Args.MakeArgString(Twine("-plugin-opt=dwo_dir=") + +Output.getFilename() + "_dwo")); + } + if (IsThinLTO) CmdArgs.push_back("-plugin-opt=thinlto"); Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1788,6 +1788,7 @@ def gcolumn_info : Flag<["-"], "gcolumn-info">, Group, Flags<[CoreOption]>; def gno_column_info : Flag<["-"], "gno-column-info">, Group, Flags<[CoreOption]>; def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group; +def gsplit_dwarf_EQ : Joined<["-"], "gsplit-dwarf=">, Group; def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group, Flags<[CC1Option]>; def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group; def gmodules : Flag <["-"], "gmodules">, Group, Index: test/Driver/lto-dwo.c === --- /dev/null +++ test/Driver/lto-dwo.c @@ -0,0 +1,12 @@ +// Confirm that -gsplit-dwarf=DIR is passed to linker + +// RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin -gsplit-dwarf=DIR -o a.out 2> %t +// RUN: FileCheck -check-prefix=CHECK-LINK-DWO-DIR < %t %s +// +// CHECK-LINK-DWO-DIR: "-plugin-opt=dwo_dir=DIR{{.*}}a.out_dwo" +// + +// RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin -gsplit-dwarf -o a.out 2> %t +// RUN: FileCheck -check-prefix=CHECK-LINK-DWO-DIR-DEFAULT < %t %s +// +// CHECK-LINK-DWO-DIR-DEFAULT: "-plugin-opt=dwo_dir=a.out_dwo" Index: lib/Driver/ToolChains/CommonArgs.cpp === --- lib/Driver/ToolChains/CommonArgs.cpp +++ lib/Driver/ToolChains/CommonArgs.cpp @@ -416,6 +416,20 @@ CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=O") + OOpt)); } + if (Arg *A = Args.getLastArg(options::OPT_gsplit_dwarf_EQ)) { +StringRef Dwo_Dir = A->getValue(); +SmallString<1024> DwoDir; +llvm::sys::path::native(Dwo_Dir, DwoDir); +llvm::sys::path::append(DwoDir, Twine(Output.getFilename()) + "_dwo"); +CmdArgs.push_back( +Args.MakeArgString(Twine("-plugin-opt=dwo_dir=") + DwoDir)); + } + else if (Args.hasArg(options::OPT_gsplit_dwarf)) { +CmdArgs.push_back( +Args.MakeArgString(Twine("-plugin-opt=dwo_dir=") + +Output.getFilename() + "_dwo")); + } + if (IsThinLTO) CmdArgs.push_back("-plugin-opt=thinlto"); Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1788,6 +1788,7 @@ def gcolumn_info : Flag<["-"], "gcolumn-info">, Group, Flags<[CoreOption]>; def gno_column_info : Flag<["-"], "gno-column-info">, Group, Flags<[CoreOption]>; def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group; +def gsplit_dwarf_EQ : Joined<["-"], "gsplit-dwarf=">, Group; def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group, Flags<[CC1Option]>; def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group; def gmodules : Flag <["-"], "gmodules">, Group, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47953: [builtin] Add bitfield support for __builtin_dump_struct
aaron.ballman added reviewers: echristo, rsmith, dblaikie. aaron.ballman added a comment. In https://reviews.llvm.org/D47953#1137375, @paulsemel wrote: > I will for sure add tests @lebedev.ri . Fact is that, for the moment, this is > not working as expected. > This is why I am asking for a bit of help about this bitfield handling :) Adding a few more reviewers to see if they have ideas on the bitfield handling. Can you describe a bit more about what's incorrect with it when the structures are packed? Code examples might help. Comment at: lib/CodeGen/CGBuiltin.cpp:1250 + if (Info.IsSigned) { +unsigned HighBits = Info.StorageSize - Info.Offset - Info.Size; +if (HighBits) paulsemel wrote: > aaron.ballman wrote: > > What happens if this overflows due to being < 0? > How could this be < 0 ? > If it is, it means that there was a problem during bitfield construction > isn't it ? > I mean StorageSize is always greater that Offset + Size I don't think it should happen in the normal course of things. I'd probably just put in an assert to ensure that the high bit is never set in `HighBits` unless it's also set in `StorageSize`. Repository: rC Clang https://reviews.llvm.org/D47953 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r335155 - Fixed test that failed when checking what variable a value was stored
Author: leonardchan Date: Wed Jun 20 11:48:05 2018 New Revision: 335155 URL: http://llvm.org/viewvc/llvm-project?rev=335155&view=rev Log: Fixed test that failed when checking what variable a value was stored in for fixed point types. Modified: cfe/trunk/test/Frontend/fixed_point_same_fbits.c Modified: cfe/trunk/test/Frontend/fixed_point_same_fbits.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/fixed_point_same_fbits.c?rev=335155&r1=335154&r2=335155&view=diff == --- cfe/trunk/test/Frontend/fixed_point_same_fbits.c (original) +++ cfe/trunk/test/Frontend/fixed_point_same_fbits.c Wed Jun 20 11:48:05 2018 @@ -12,17 +12,17 @@ void func() { unsigned _Fract u_fract = 0.5ur; unsigned long _Fract u_long_fract = 0.5ulr; -// DEFAULT: store i16 128, i16* %u_short_accum, align 2 -// DEFAULT: store i32 32768, i32* %u_accum, align 4 -// DEFAULT: store i64 2147483648, i64* %u_long_accum, align 8 -// DEFAULT: store i8 -128, i8* %u_short_fract, align 1 -// DEFAULT: store i16 -32768, i16* %u_fract, align 2 -// DEFAULT: store i32 -2147483648, i32* %u_long_fract, align 4 +// DEFAULT: store i16 128, i16* {{.*}}, align 2 +// DEFAULT: store i32 32768, i32* {{.*}}, align 4 +// DEFAULT: store i64 2147483648, i64* {{.*}}, align 8 +// DEFAULT: store i8 -128, i8* {{.*}}, align 1 +// DEFAULT: store i16 -32768, i16* {{.*}}, align 2 +// DEFAULT: store i32 -2147483648, i32* {{.*}}, align 4 -// SAME: store i16 64, i16* %u_short_accum, align 2 -// SAME: store i32 16384, i32* %u_accum, align 4 -// SAME: store i64 1073741824, i64* %u_long_accum, align 8 -// SAME: store i8 64, i8* %u_short_fract, align 1 -// SAME: store i16 16384, i16* %u_fract, align 2 -// SAME: store i32 1073741824, i32* %u_long_fract, align 4 +// SAME: store i16 64, i16* {{.*}}, align 2 +// SAME: store i32 16384, i32* {{.*}}, align 4 +// SAME: store i64 1073741824, i64* {{.*}}, align 8 +// SAME: store i8 64, i8* {{.*}}, align 1 +// SAME: store i16 16384, i16* {{.*}}, align 2 +// SAME: store i32 1073741824, i32* {{.*}}, align 4 } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48373: [Driver] Make scudo compatible with -fsanitize-minimal-runtime
eugenis requested changes to this revision. eugenis added a comment. This revision now requires changes to proceed. Please add a test. Repository: rC Clang https://reviews.llvm.org/D48373 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48356: [libcxx] [CMake] Convert paths to the right form in standalone builds on Windows
smeenai accepted this revision. smeenai added a comment. This revision is now accepted and ready to land. Looks good with the quotes added. Comment at: cmake/Modules/HandleCompilerRT.cmake:17 string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) + file(TO_CMAKE_PATH ${LIBRARY_FILE} LIBRARY_FILE) string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}") Nit: cmake recommends always putting quotes around the path argument to ensure it's treated as a single argument, i.e. file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) That needs to happen in all other uses as well. Comment at: cmake/Modules/HandleOutOfTreeLLVM.cmake:52 else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") Is there ever a chance LLVM_BINARY_DIR will have backslashes, or are you just being extra careful (or going for consistency)? Repository: rCXX libc++ https://reviews.llvm.org/D48356 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48355: [libcxxabi] [CMake] Convert paths to the right form in standalone builds on Windows
smeenai accepted this revision. smeenai added a comment. This revision is now accepted and ready to land. LGTM with the same comments as https://reviews.llvm.org/D48356 (add quotes, and is the translation for LLVM_BINARY_DIR necessary?) Repository: rCXXA libc++abi https://reviews.llvm.org/D48355 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48353: [libunwind] [CMake] Convert paths to the right form in standalone builds on Windows
smeenai accepted this revision. smeenai added a comment. This revision is now accepted and ready to land. LGTM with the same comments as https://reviews.llvm.org/D48356 (add quotes, and is the translation for LLVM_BINARY_DIR necessary?) Repository: rUNW libunwind https://reviews.llvm.org/D48353 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r335159 - Fixed test in prior build where FileCheck tried to match against
Author: leonardchan Date: Wed Jun 20 12:34:05 2018 New Revision: 335159 URL: http://llvm.org/viewvc/llvm-project?rev=335159&view=rev Log: Fixed test in prior build where FileCheck tried to match against `common` when declaring a global variable when we primarily care about the value assigned in the test. Modified: cfe/trunk/test/Frontend/fixed_point_declarations.c Modified: cfe/trunk/test/Frontend/fixed_point_declarations.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/fixed_point_declarations.c?rev=335159&r1=335158&r2=335159&view=diff == --- cfe/trunk/test/Frontend/fixed_point_declarations.c (original) +++ cfe/trunk/test/Frontend/fixed_point_declarations.c Wed Jun 20 12:34:05 2018 @@ -1,4 +1,4 @@ -// RUN: %clang -ffixed-point -S -emit-llvm %s -o - | FileCheck %s +// RUN: %clang -ffixed-point -S -emit-llvm %s -o - --target=x86_64-linux | FileCheck %s // RUN: %clang -ffixed-point -S -emit-llvm %s -o - --target=x86_64-scei-ps4-ubuntu-fast | FileCheck %s // Primary fixed point types ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48356: [libcxx] [CMake] Convert paths to the right form in standalone builds on Windows
mstorsjo added inline comments. Comment at: cmake/Modules/HandleCompilerRT.cmake:17 string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) + file(TO_CMAKE_PATH ${LIBRARY_FILE} LIBRARY_FILE) string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}") smeenai wrote: > Nit: cmake recommends always putting quotes around the path argument to > ensure it's treated as a single argument, i.e. > > file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) > > That needs to happen in all other uses as well. Ok, will do. Comment at: cmake/Modules/HandleOutOfTreeLLVM.cmake:52 else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") smeenai wrote: > Is there ever a chance LLVM_BINARY_DIR will have backslashes, or are you just > being extra careful (or going for consistency)? I'm mostly just going for consistency and copy+paste; this path identically matches a part from compiler-rt/cmake/Modules/CompilerRTUtils.cmake - and that part actually seems to have been added intentionally to fix some case: https://reviews.llvm.org/rL203789 Repository: rCXX libc++ https://reviews.llvm.org/D48356 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48356: [libcxx] [CMake] Convert paths to the right form in standalone builds on Windows
smeenai added inline comments. Comment at: cmake/Modules/HandleOutOfTreeLLVM.cmake:52 else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") mstorsjo wrote: > smeenai wrote: > > Is there ever a chance LLVM_BINARY_DIR will have backslashes, or are you > > just being extra careful (or going for consistency)? > I'm mostly just going for consistency and copy+paste; this path identically > matches a part from compiler-rt/cmake/Modules/CompilerRTUtils.cmake - and > that part actually seems to have been added intentionally to fix some case: > https://reviews.llvm.org/rL203789 Fair enough; sounds good to me. Repository: rCXX libc++ https://reviews.llvm.org/D48356 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43424: [clang-doc] Implement a (simple) Markdown generator
juliehockett updated this revision to Diff 152135. juliehockett added a comment. Updating to reflect changes to the framework (and make it work). https://reviews.llvm.org/D43424 Files: clang-tools-extra/clang-doc/CMakeLists.txt clang-tools-extra/clang-doc/Generators.cpp clang-tools-extra/clang-doc/Generators.h clang-tools-extra/clang-doc/MDGenerator.cpp clang-tools-extra/clang-doc/Representation.cpp clang-tools-extra/clang-doc/Representation.h clang-tools-extra/clang-doc/YAMLGenerator.cpp clang-tools-extra/clang-doc/tool/ClangDocMain.cpp clang-tools-extra/test/clang-doc/md-comments.cpp clang-tools-extra/test/clang-doc/md-namespace.cpp clang-tools-extra/test/clang-doc/md-record.cpp Index: clang-tools-extra/test/clang-doc/md-record.cpp === --- /dev/null +++ clang-tools-extra/test/clang-doc/md-record.cpp @@ -0,0 +1,101 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo "" > %t/compile_flags.txt +// RUN: cp "%s" "%t/test.cpp" +// RUN: clang-doc -doxygen -format=md -p %t %t/test.cpp -output=%t/docs +// RUN: cat %t/docs/A.md | FileCheck %s --check-prefix=CHECK-A +// RUN: cat %t/docs/Bc.md | FileCheck %s --check-prefix=CHECK-BC +// RUN: cat %t/docs/B.md | FileCheck %s --check-prefix=CHECK-B +// RUN: cat %t/docs/C.md | FileCheck %s --check-prefix=CHECK-C +// RUN: cat %t/docs/D.md | FileCheck %s --check-prefix=CHECK-D +// RUN: cat %t/docs/E.md | FileCheck %s --check-prefix=CHECK-E +// RUN: cat %t/docs/E/ProtectedMethod.md | FileCheck %s --check-prefix=CHECK-EPM +// RUN: cat %t/docs/E/E.md | FileCheck %s --check-prefix=CHECK-ECON +// RUN: cat %t/docs/E/'~E.md' | FileCheck %s --check-prefix=CHECK-EDES +// RUN: cat %t/docs/F.md | FileCheck %s --check-prefix=CHECK-F +// RUN: cat %t/docs/X.md | FileCheck %s --check-prefix=CHECK-X +// RUN: cat %t/docs/X/Y.md | FileCheck %s --check-prefix=CHECK-Y +// RUN: cat %t/docs/H.md | FileCheck %s --check-prefix=CHECK-H +// RUN: cat %t/docs/H/I.md | FileCheck %s --check-prefix=CHECK-I + +union A { int X; int Y; }; + +// CHECK-A: # union A +// CHECK-A-NEXT: *Defined at line 21 of {{.*}}* +// CHECK-A: ## Members +// CHECK-A-NEXT: int X +// CHECK-A-NEXT: int Y + +enum B { X, Y }; + +// CHECK-B: | enum B | +// CHECK-B-NEXT: -- +// CHECK-B-NEXT: | X | +// CHECK-B-NEXT: | Y | + +enum class Bc { A, B }; + +// CHECK-BC: | enum class Bc | +// CHECK-BC-NEXT: -- +// CHECK-BC-NEXT: | A | +// CHECK-BC-NEXT: | B | + +struct C { int i; }; + +// CHECK-C: # struct C +// CHECK-C-NEXT: *Defined at line 43 of {{.*}}* +// CHECK-C: ## Members +// CHECK-C-NEXT: int i + +class D {}; + +// CHECK-D: # class D +// CHECK-D-NEXT: *Defined at line 50 of {{.*}}* + +class E { +public: + E() {} + ~E() {} + +protected: + void ProtectedMethod(); +}; + +// CHECK-E: # class E +// CHECK-E-NEXT: *Defined at line 55 of {{.*}}* + +// CHECK-ECON: ## void E() +// CHECK-ECON-NEXT: *Defined at line 57 of {{.*}}* + +// CHECK-EDES: ## void ~E() +// CHECK-EDES-NEXT: *Defined at line 58 of {{.*}}* + +void E::ProtectedMethod() {} + +// CHECK-EPM: ## void ProtectedMethod() +// CHECK-EPM-NEXT: *Defined at line 73 of {{.*}}* + +class F : virtual private D, public E {}; + +// CHECK-F: # class F +// CHECK-F-NEXT: *Defined at line 78 of {{.*}}* + +class X { + class Y {}; +}; + +// CHECK-X: # class X +// CHECK-X-NEXT: *Defined at line 83 of {{.*}}* + +// CHECK-Y: # class Y +// CHECK-Y-NEXT: *Defined at line 84 of {{.*}}* + +void H() { + class I {}; +} + +// CHECK-H: ## void H() +// CHECK-H-NEXT: *Defined at line 93 of {{.*}}* + +// CHECK-I: # class I +// CHECK-I-NEXT: *Defined at line 94 of {{.*}}* Index: clang-tools-extra/test/clang-doc/md-namespace.cpp === --- /dev/null +++ clang-tools-extra/test/clang-doc/md-namespace.cpp @@ -0,0 +1,43 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo "" > %t/compile_flags.txt +// RUN: cp "%s" "%t/test.cpp" +// RUN: clang-doc -doxygen -format=md -p %t %t/test.cpp -output=%t/docs +// RUN: cat %t/docs/A.md | FileCheck %s --check-prefix=CHECK-A +// RUN: cat %t/docs/A/B.md | FileCheck %s --check-prefix=CHECK-B +// RUN: cat %t/docs/A/f.md | FileCheck %s --check-prefix=CHECK-F +// RUN: cat %t/docs/A/B/E.md | FileCheck %s --check-prefix=CHECK-E +// RUN: cat %t/docs/A/B/func.md | FileCheck %s --check-prefix=CHECK-FUNC + +namespace A { + +// CHECK-A: # namespace A + +void f(); + +} // namespace A + +namespace A { + +void f(){}; + +// CHECK-F: ## void f() +// CHECK-F-NEXT: *Defined at line 22 of {{.*}}* + +namespace B { + +// CHECK-B: # namespace B + +enum E { X }; + +// CHECK-E: | enum E | +// CHECK-E-NEXT: -- +// CHECK-E-NEXT: | X | + +E func(int i) { return X; } + +// CHECK-FUNC: enum A::B::E func(int i) +// CHECK-FUNC-NEXT: *Defined at line 37 of {{.*}}* + +} // namespace B +} // namespace A Index: clang-tools-extra/test/clang-doc/md-comments.cpp === --- /dev/null +++ c
[PATCH] D48390: ASan docs: no_sanitize("address") works on globals.
eugenis created this revision. eugenis added a reviewer: alekseyshl. Mention that no_sanitize attribute can be used with globals. https://reviews.llvm.org/D48390 Files: clang/docs/AddressSanitizer.rst Index: clang/docs/AddressSanitizer.rst === --- clang/docs/AddressSanitizer.rst +++ clang/docs/AddressSanitizer.rst @@ -197,13 +197,17 @@ Disabling Instrumentation with ``__attribute__((no_sanitize("address")))`` -- -Some code should not be instrumented by AddressSanitizer. One may use the -function attribute ``__attribute__((no_sanitize("address")))`` (which has -deprecated synonyms `no_sanitize_address` and `no_address_safety_analysis`) to -disable instrumentation of a particular function. This attribute may not be -supported by other compilers, so we suggest to use it together with +Some code should not be instrumented by AddressSanitizer. One may use +the attribute ``__attribute__((no_sanitize("address")))`` (which has +deprecated synonyms `no_sanitize_address` and +`no_address_safety_analysis`) to disable instrumentation of a +particular function. This attribute may not be supported by other +compilers, so we suggest to use it together with ``__has_feature(address_sanitizer)``. +The same attribute used on a global variable prevents AddressSanitizer +from adding redzones around it and detecting out of bounds accesses. + Suppressing Errors in Recompiled Code (Blacklist) - Index: clang/docs/AddressSanitizer.rst === --- clang/docs/AddressSanitizer.rst +++ clang/docs/AddressSanitizer.rst @@ -197,13 +197,17 @@ Disabling Instrumentation with ``__attribute__((no_sanitize("address")))`` -- -Some code should not be instrumented by AddressSanitizer. One may use the -function attribute ``__attribute__((no_sanitize("address")))`` (which has -deprecated synonyms `no_sanitize_address` and `no_address_safety_analysis`) to -disable instrumentation of a particular function. This attribute may not be -supported by other compilers, so we suggest to use it together with +Some code should not be instrumented by AddressSanitizer. One may use +the attribute ``__attribute__((no_sanitize("address")))`` (which has +deprecated synonyms `no_sanitize_address` and +`no_address_safety_analysis`) to disable instrumentation of a +particular function. This attribute may not be supported by other +compilers, so we suggest to use it together with ``__has_feature(address_sanitizer)``. +The same attribute used on a global variable prevents AddressSanitizer +from adding redzones around it and detecting out of bounds accesses. + Suppressing Errors in Recompiled Code (Blacklist) - ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
RE: r335159 - Fixed test in prior build where FileCheck tried to match against
(Using the right commits list this time...) See inline (same as previous). > -Original Message- > From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of > Leonard Chan via cfe-commits > Sent: Wednesday, June 20, 2018 3:34 PM > To: cfe-commits@lists.llvm.org > Subject: r335159 - Fixed test in prior build where FileCheck tried to > match against > > Author: leonardchan > Date: Wed Jun 20 12:34:05 2018 > New Revision: 335159 > > URL: http://llvm.org/viewvc/llvm-project?rev=335159&view=rev > Log: > Fixed test in prior build where FileCheck tried to match against > `common` when declaring a global variable when we primarily care about > the value assigned in the test. > > Modified: > cfe/trunk/test/Frontend/fixed_point_declarations.c > > Modified: cfe/trunk/test/Frontend/fixed_point_declarations.c > URL: http://llvm.org/viewvc/llvm- > project/cfe/trunk/test/Frontend/fixed_point_declarations.c?rev=335159&r1=3 > 35158&r2=335159&view=diff > == > > --- cfe/trunk/test/Frontend/fixed_point_declarations.c (original) > +++ cfe/trunk/test/Frontend/fixed_point_declarations.c Wed Jun 20 12:34:05 > 2018 > @@ -1,4 +1,4 @@ > -// RUN: %clang -ffixed-point -S -emit-llvm %s -o - | FileCheck %s > +// RUN: %clang -ffixed-point -S -emit-llvm %s -o - --target=x86_64-linux > | FileCheck %s > // RUN: %clang -ffixed-point -S -emit-llvm %s -o - --target=x86_64-scei- > ps4-ubuntu-fast | FileCheck %s By the way, "x86_64-scei-ps4-ubuntu-fast" is not a real triple. The PS4 triple is "x86_64-scei-ps4" (although there is an ubuntu-fast bot, which might be where the confusion arises). Is there any particular reason to want to use the PS4 triple in addition to Linux? I haven't really been watching the fixed-point stuff. Thanks, --paulr PS4 code owner > > // Primary fixed point types > > > ___ > 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] D48390: ASan docs: no_sanitize("address") works on globals.
aaron.ballman added a comment. Do you also want to update AttrDocs.td with some similar information? https://reviews.llvm.org/D48390 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r335159 - Fixed test in prior build where FileCheck tried to match against
For that particular test I wanted to check the store value on each declaration but tests failed on 4 different machines where for global variables. On these machines `dso_local` was not included in the IR output and x86_64-scei-ps4-ubuntu-fast was one of them. My quick fix to address this was using a regex to capture the `dso_local` and adding x86_64-scei-ps4-ubuntu-fast as a target to make sure the test passed for it. Today I ran into a similar issue with my tests where instead s390x added `common dso_local` which I couldn't easily catch with my current regex. The quick hack for this was just testing only on linux, but forgot to remove the x86_64-scei-ps4-ubuntu-fast run. I will remove this in a future patch since just forcing the first run to target linux fixes my initial problem. - Leo On Wed, Jun 20, 2018 at 12:55 PM wrote: > > (Using the right commits list this time...) > > See inline (same as previous). > > > -Original Message- > > From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of > > Leonard Chan via cfe-commits > > Sent: Wednesday, June 20, 2018 3:34 PM > > To: cfe-commits@lists.llvm.org > > Subject: r335159 - Fixed test in prior build where FileCheck tried to > > match against > > > > Author: leonardchan > > Date: Wed Jun 20 12:34:05 2018 > > New Revision: 335159 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=335159&view=rev > > Log: > > Fixed test in prior build where FileCheck tried to match against > > `common` when declaring a global variable when we primarily care about > > the value assigned in the test. > > > > Modified: > > cfe/trunk/test/Frontend/fixed_point_declarations.c > > > > Modified: cfe/trunk/test/Frontend/fixed_point_declarations.c > > URL: http://llvm.org/viewvc/llvm- > > project/cfe/trunk/test/Frontend/fixed_point_declarations.c?rev=335159&r1=3 > > 35158&r2=335159&view=diff > > == > > > > --- cfe/trunk/test/Frontend/fixed_point_declarations.c (original) > > +++ cfe/trunk/test/Frontend/fixed_point_declarations.c Wed Jun 20 12:34:05 > > 2018 > > @@ -1,4 +1,4 @@ > > -// RUN: %clang -ffixed-point -S -emit-llvm %s -o - | FileCheck %s > > +// RUN: %clang -ffixed-point -S -emit-llvm %s -o - --target=x86_64-linux > > | FileCheck %s > > // RUN: %clang -ffixed-point -S -emit-llvm %s -o - --target=x86_64-scei- > > ps4-ubuntu-fast | FileCheck %s > > By the way, "x86_64-scei-ps4-ubuntu-fast" is not a real triple. The PS4 > triple is "x86_64-scei-ps4" (although there is an ubuntu-fast bot, which > might be where the confusion arises). > > Is there any particular reason to want to use the PS4 triple in addition > to Linux? I haven't really been watching the fixed-point stuff. > Thanks, > --paulr > PS4 code owner > > > > > // Primary fixed point types > > > > > > ___ > > 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] D48390: ASan docs: no_sanitize("address") works on globals.
eugenis updated this revision to Diff 152140. eugenis added a comment. update AttrDocs.td https://reviews.llvm.org/D48390 Files: clang/docs/AddressSanitizer.rst clang/include/clang/Basic/AttrDocs.td Index: clang/include/clang/Basic/AttrDocs.td === --- clang/include/clang/Basic/AttrDocs.td +++ clang/include/clang/Basic/AttrDocs.td @@ -1804,13 +1804,14 @@ def NoSanitizeDocs : Documentation { let Category = DocCatFunction; let Content = [{ -Use the ``no_sanitize`` attribute on a function declaration to specify -that a particular instrumentation or set of instrumentations should not be -applied to that function. The attribute takes a list of string literals, -which have the same meaning as values accepted by the ``-fno-sanitize=`` -flag. For example, ``__attribute__((no_sanitize("address", "thread")))`` -specifies that AddressSanitizer and ThreadSanitizer should not be applied -to the function. +Use the ``no_sanitize`` attribute on a function or a global variable +declaration to specify that a particular instrumentation or set of +instrumentations should not be applied. The attribute takes a list of +string literals, which have the same meaning as values accepted by the +``-fno-sanitize=`` flag. For example, +``__attribute__((no_sanitize("address", "thread")))`` specifies that +AddressSanitizer and ThreadSanitizer should not be applied to the +function or variable. See :ref:`Controlling Code Generation ` for a full list of supported sanitizer flags. @@ -1825,9 +1826,9 @@ let Content = [{ .. _langext-address_sanitizer: -Use ``__attribute__((no_sanitize_address))`` on a function declaration to -specify that address safety instrumentation (e.g. AddressSanitizer) should -not be applied to that function. +Use ``__attribute__((no_sanitize_address))`` on a function or a global +variable declaration to specify that address safety instrumentation +(e.g. AddressSanitizer) should not be applied. }]; } Index: clang/docs/AddressSanitizer.rst === --- clang/docs/AddressSanitizer.rst +++ clang/docs/AddressSanitizer.rst @@ -197,13 +197,17 @@ Disabling Instrumentation with ``__attribute__((no_sanitize("address")))`` -- -Some code should not be instrumented by AddressSanitizer. One may use the -function attribute ``__attribute__((no_sanitize("address")))`` (which has -deprecated synonyms `no_sanitize_address` and `no_address_safety_analysis`) to -disable instrumentation of a particular function. This attribute may not be -supported by other compilers, so we suggest to use it together with +Some code should not be instrumented by AddressSanitizer. One may use +the attribute ``__attribute__((no_sanitize("address")))`` (which has +deprecated synonyms `no_sanitize_address` and +`no_address_safety_analysis`) to disable instrumentation of a +particular function. This attribute may not be supported by other +compilers, so we suggest to use it together with ``__has_feature(address_sanitizer)``. +The same attribute used on a global variable prevents AddressSanitizer +from adding redzones around it and detecting out of bounds accesses. + Suppressing Errors in Recompiled Code (Blacklist) - Index: clang/include/clang/Basic/AttrDocs.td === --- clang/include/clang/Basic/AttrDocs.td +++ clang/include/clang/Basic/AttrDocs.td @@ -1804,13 +1804,14 @@ def NoSanitizeDocs : Documentation { let Category = DocCatFunction; let Content = [{ -Use the ``no_sanitize`` attribute on a function declaration to specify -that a particular instrumentation or set of instrumentations should not be -applied to that function. The attribute takes a list of string literals, -which have the same meaning as values accepted by the ``-fno-sanitize=`` -flag. For example, ``__attribute__((no_sanitize("address", "thread")))`` -specifies that AddressSanitizer and ThreadSanitizer should not be applied -to the function. +Use the ``no_sanitize`` attribute on a function or a global variable +declaration to specify that a particular instrumentation or set of +instrumentations should not be applied. The attribute takes a list of +string literals, which have the same meaning as values accepted by the +``-fno-sanitize=`` flag. For example, +``__attribute__((no_sanitize("address", "thread")))`` specifies that +AddressSanitizer and ThreadSanitizer should not be applied to the +function or variable. See :ref:`Controlling Code Generation ` for a full list of supported sanitizer flags. @@ -1825,9 +1826,9 @@ let Content = [{ .. _langext-address_sanitizer: -Use ``__attribute__((no_sanitize_address))`` on a function declaration to -specify that address safety instrumentation (e.g. AddressSanitizer) should -not be applied to
[PATCH] D48390: ASan docs: no_sanitize("address") works on globals.
eugenis added a comment. In https://reviews.llvm.org/D48390#1138193, @aaron.ballman wrote: > Do you also want to update AttrDocs.td with some similar information? Done. https://reviews.llvm.org/D48390 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46485: Add python tool to dump and construct header maps
bruno updated this revision to Diff 152142. bruno added a comment. Update after Richard's review, fix python3 compatibility and check for zero sized string table https://reviews.llvm.org/D46485 Files: CMakeLists.txt test/CMakeLists.txt test/Modules/crash-vfs-headermaps.m test/Preprocessor/Inputs/headermap-rel/foo.hmap test/Preprocessor/Inputs/headermap-rel/foo.hmap.json test/Preprocessor/Inputs/headermap-rel2/project-headers.hmap test/Preprocessor/Inputs/headermap-rel2/project-headers.hmap.json test/Preprocessor/Inputs/nonportable-hmaps/foo.hmap test/Preprocessor/Inputs/nonportable-hmaps/foo.hmap.json test/Preprocessor/headermap-rel.c test/Preprocessor/headermap-rel2.c test/Preprocessor/nonportable-include-with-hmap.c utils/hmaptool/CMakeLists.txt utils/hmaptool/hmaptool Index: utils/hmaptool/hmaptool === --- /dev/null +++ utils/hmaptool/hmaptool @@ -0,0 +1,294 @@ +#!/usr/bin/env python +from __future__ import print_function + +import json +import optparse +import os +import struct +import sys + +### + +k_header_magic_LE = 'pamh' +k_header_magic_BE = 'hmap' + +def hmap_hash(str): +"""hash(str) -> int + +Apply the "well-known" headermap hash function. +""" + +return sum((ord(c.lower()) * 13 +for c in str), 0) + +class HeaderMap(object): +@staticmethod +def frompath(path): +with open(path, 'rb') as f: +magic = f.read(4) +if magic == k_header_magic_LE: +endian_code = '<' +elif magic == k_header_magic_BE: +endian_code = '>' +else: +raise SystemExit("error: %s: not a headermap" % ( +path,)) + +# Read the header information. +header_fmt = endian_code + 'HH' +header_size = struct.calcsize(header_fmt) +data = f.read(header_size) +if len(data) != header_size: +raise SystemExit("error: %s: truncated headermap header" % ( +path,)) + +(version, reserved, strtable_offset, num_entries, + num_buckets, max_value_len) = struct.unpack(header_fmt, data) + +if version != 1: +raise SystemExit("error: %s: unknown headermap version: %r" % ( +path, version)) +if reserved != 0: +raise SystemExit("error: %s: invalid reserved value in header" % ( +path,)) + +# The number of buckets must be a power of two. +if num_buckets == 0 or (num_buckets & num_buckets - 1) != 0: +raise SystemExit("error: %s: invalid number of buckets" % ( +path,)) + +# Read all of the buckets. +bucket_fmt = endian_code + 'III' +bucket_size = struct.calcsize(bucket_fmt) +buckets_data = f.read(num_buckets * bucket_size) +if len(buckets_data) != num_buckets * bucket_size: +raise SystemExit("error: %s: truncated headermap buckets" % ( +path,)) +buckets = [struct.unpack(bucket_fmt, + buckets_data[i*bucket_size:(i+1)*bucket_size]) + for i in range(num_buckets)] + +# Read the string table; the format doesn't explicitly communicate the +# size of the string table (which is dumb), so assume it is the rest of +# the file. +f.seek(0, 2) +strtable_size = f.tell() - strtable_offset +f.seek(strtable_offset) + +if strtable_size == 0: +raise SystemExit("error: %s: unable to read zero-sized string table"%( +path,)) +strtable = f.read(strtable_size) + +if len(strtable) != strtable_size: +raise SystemExit("error: %s: unable to read complete string table"%( +path,)) +if strtable[-1] != '\0': +raise SystemExit("error: %s: invalid string table in headermap" % ( +path,)) + +return HeaderMap(num_entries, buckets, strtable) + +def __init__(self, num_entries, buckets, strtable): +self.num_entries = num_entries +self.buckets = buckets +self.strtable = strtable + +def get_string(self, idx): +if idx >= len(self.strtable): +raise SystemExit("error: %s: invalid string index" % ( +path,)) +end_idx = self.strtable.index('\0', idx) +return self.strtable[idx:end_idx] + +@property +def mappings(self): +for key_idx,prefix_idx,suffix_idx in self.buckets: +if key_idx == 0: +continue +yield (self.get_string(key_idx), + self.get_string(prefix_idx) + self.get_string(suffix_idx))
[PATCH] D48346: [X86] Rewrite the add/mul/or/and reduction intrinsics to make better use of other intrinsics and remove undef shuffle indices.
craig.topper updated this revision to Diff 152146. craig.topper added a comment. Change test to -O0 https://reviews.llvm.org/D48346 Files: lib/Headers/avx512fintrin.h test/CodeGen/avx512-reduceIntrin.c Index: test/CodeGen/avx512-reduceIntrin.c === --- test/CodeGen/avx512-reduceIntrin.c +++ test/CodeGen/avx512-reduceIntrin.c @@ -1,410 +1,404 @@ -// RUN: %clang_cc1 -ffreestanding %s -O2 -triple=x86_64-apple-darwin -target-cpu skylake-avx512 -emit-llvm -o - -Wall -Werror | FileCheck %s +// RUN: %clang_cc1 -ffreestanding %s -O0 -triple=x86_64-apple-darwin -target-cpu skylake-avx512 -emit-llvm -o - -Wall -Werror | FileCheck %s #include long long test_mm512_reduce_add_epi64(__m512i __W){ - // CHECK: %shuffle.i = shufflevector <8 x i64> %__W, <8 x i64> undef, <4 x i32> - // CHECK: %shuffle1.i = shufflevector <8 x i64> %__W, <8 x i64> undef, <4 x i32> - // CHECK: %add.i = add <4 x i64> %shuffle.i, %shuffle1.i - // CHECK: %shuffle2.i = shufflevector <4 x i64> %add.i, <4 x i64> undef, <2 x i32> - // CHECK: %shuffle3.i = shufflevector <4 x i64> %add.i, <4 x i64> undef, <2 x i32> - // CHECK: %add4.i = add <2 x i64> %shuffle2.i, %shuffle3.i - // CHECK: %shuffle6.i = shufflevector <2 x i64> %add4.i, <2 x i64> undef, <2 x i32> - // CHECK: %add7.i = add <2 x i64> %shuffle6.i, %add4.i - // CHECK: %vecext.i = extractelement <2 x i64> %add7.i, i32 0 - // CHECK: ret i64 %vecext.i +// CHECK-LABEL: @test_mm512_reduce_add_epi64( +// CHECK:shufflevector <8 x i64> %{{.*}}, <8 x i64> undef, <4 x i32> +// CHECK:shufflevector <8 x i64> %{{.*}}, <8 x i64> undef, <4 x i32> +// CHECK:add <4 x i64> %{{.*}}, %{{.*}} +// CHECK:shufflevector <4 x i64> %{{.*}}, <4 x i64> undef, <2 x i32> +// CHECK:shufflevector <4 x i64> %{{.*}}, <4 x i64> undef, <2 x i32> +// CHECK:add <2 x i64> %{{.*}}, %{{.*}} +// CHECK:shufflevector <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i32> +// CHECK:add <2 x i64> %{{.*}}, %{{.*}} +// CHECK:extractelement <2 x i64> %{{.*}}, i32 0 return _mm512_reduce_add_epi64(__W); } long long test_mm512_reduce_mul_epi64(__m512i __W){ - // CHECK: %shuffle.i = shufflevector <8 x i64> %__W, <8 x i64> undef, <4 x i32> - // CHECK: %shuffle1.i = shufflevector <8 x i64> %__W, <8 x i64> undef, <4 x i32> - // CHECK: %mul.i = mul <4 x i64> %shuffle.i, %shuffle1.i - // CHECK: %shuffle2.i = shufflevector <4 x i64> %mul.i, <4 x i64> undef, <2 x i32> - // CHECK: %shuffle3.i = shufflevector <4 x i64> %mul.i, <4 x i64> undef, <2 x i32> - // CHECK: %mul4.i = mul <2 x i64> %shuffle2.i, %shuffle3.i - // CHECK: %shuffle6.i = shufflevector <2 x i64> %mul4.i, <2 x i64> undef, <2 x i32> - // CHECK: %mul7.i = mul <2 x i64> %shuffle6.i, %mul4.i - // CHECK: %vecext.i = extractelement <2 x i64> %mul7.i, i32 0 - // CHECK: ret i64 %vecext.i +// CHECK-LABEL: @test_mm512_reduce_mul_epi64( +// CHECK:shufflevector <8 x i64> %{{.*}}, <8 x i64> undef, <4 x i32> +// CHECK:shufflevector <8 x i64> %{{.*}}, <8 x i64> undef, <4 x i32> +// CHECK:mul <4 x i64> %{{.*}}, %{{.*}} +// CHECK:shufflevector <4 x i64> %{{.*}}, <4 x i64> undef, <2 x i32> +// CHECK:shufflevector <4 x i64> %{{.*}}, <4 x i64> undef, <2 x i32> +// CHECK:mul <2 x i64> %{{.*}}, %{{.*}} +// CHECK:shufflevector <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i32> +// CHECK:mul <2 x i64> %{{.*}}, %{{.*}} +// CHECK:extractelement <2 x i64> %{{.*}}, i32 0 return _mm512_reduce_mul_epi64(__W); } long long test_mm512_reduce_or_epi64(__m512i __W){ - // CHECK: %shuffle.i = shufflevector <8 x i64> %__W, <8 x i64> undef, <4 x i32> - // CHECK: %shuffle1.i = shufflevector <8 x i64> %__W, <8 x i64> undef, <4 x i32> - // CHECK: %or.i = or <4 x i64> %shuffle.i, %shuffle1.i - // CHECK: %shuffle2.i = shufflevector <4 x i64> %or.i, <4 x i64> undef, <2 x i32> - // CHECK: %shuffle3.i = shufflevector <4 x i64> %or.i, <4 x i64> undef, <2 x i32> - // CHECK: %or4.i = or <2 x i64> %shuffle2.i, %shuffle3.i - // CHECK: %shuffle6.i = shufflevector <2 x i64> %or4.i, <2 x i64> undef, <2 x i32> - // CHECK: %or7.i = or <2 x i64> %shuffle6.i, %or4.i - // CHECK: %vecext.i = extractelement <2 x i64> %or7.i, i32 0 - // CHECK: ret i64 %vecext.i +// CHECK-LABEL: @test_mm512_reduce_or_epi64( +// CHECK:shufflevector <8 x i64> %{{.*}}, <8 x i64> undef, <4 x i32> +// CHECK:shufflevector <8 x i64> %{{.*}}, <8 x i64> undef, <4 x i32> +// CHECK:or <4 x i64> %{{.*}}, %{{.*}} +// CHECK:shufflevector <4 x i64> %{{.*}}, <4 x i64> undef, <2 x i32> +// CHECK:shufflevector <4 x i64> %{{.*}}, <4 x i64> undef, <2 x i32> +// CHECK:or <2 x i64> %{{.*}}, %{{.*}} +// CHECK:shufflevector <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i32> +// CHECK:or <2 x i64> %{{.*}}, %{{.*}} +// CHECK:extractelement <2 x i64> %{{.*}}, i32 0 return _mm512_reduce_or_epi64(__W); } long long test_mm512_reduce_and_epi64(__
[PATCH] D48287: [HIP] Support -fcuda-flush-denormals-to-zero for amdgcn
tra added a comment. Using OpenCL's flag for the purpose adds a *third* way we handle denormals flushing in clang. Now it would be HIP (which is CUDA-like) using OpenCL's flag for denormals instead of CUDA's one. You could change AMDGPUTargetInfo::adjustTargetOptions() to use CGOpts.getLangOpts().CUDADeviceFlushDenormalsToZero instead. That would at least make HIP and CUDA do the same thing. I think it would work better if we could coalesce CUDADeviceFlushDenormalsToZero and CodeGenOpts.FlushDenorm and, maybe move the flag to LangOpts , so we could use LangOpts.CUDAIsDevice. https://reviews.llvm.org/D48287 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47845: [CUDA] Removed unused __nvvm_* builtins with non-generic pointers.
This revision was automatically updated to reflect the committed changes. Closed by commit rC335168: [CUDA] Removed unused __nvvm_* builtins with non-generic pointers. (authored by tra, committed by ). Changed prior to commit: https://reviews.llvm.org/D47845?vs=150194&id=152149#toc Repository: rC Clang https://reviews.llvm.org/D47845 Files: include/clang/Basic/BuiltinsNVPTX.def Index: include/clang/Basic/BuiltinsNVPTX.def === --- include/clang/Basic/BuiltinsNVPTX.def +++ include/clang/Basic/BuiltinsNVPTX.def @@ -475,191 +475,117 @@ // - they are used in address space analysis and optimization // So it does not hurt to expose them as builtins. // -BUILTIN(__nvvm_atom_add_g_i, "iiD*1i", "n") -BUILTIN(__nvvm_atom_add_s_i, "iiD*3i", "n") BUILTIN(__nvvm_atom_add_gen_i, "iiD*i", "n") TARGET_BUILTIN(__nvvm_atom_cta_add_gen_i, "iiD*i", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_add_gen_i, "iiD*i", "n", SM_60) -BUILTIN(__nvvm_atom_add_g_l, "LiLiD*1Li", "n") -BUILTIN(__nvvm_atom_add_s_l, "LiLiD*3Li", "n") BUILTIN(__nvvm_atom_add_gen_l, "LiLiD*Li", "n") TARGET_BUILTIN(__nvvm_atom_cta_add_gen_l, "LiLiD*Li", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_add_gen_l, "LiLiD*Li", "n", SM_60) -BUILTIN(__nvvm_atom_add_g_ll, "LLiLLiD*1LLi", "n") -BUILTIN(__nvvm_atom_add_s_ll, "LLiLLiD*3LLi", "n") BUILTIN(__nvvm_atom_add_gen_ll, "LLiLLiD*LLi", "n") TARGET_BUILTIN(__nvvm_atom_cta_add_gen_ll, "LLiLLiD*LLi", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_add_gen_ll, "LLiLLiD*LLi", "n", SM_60) -BUILTIN(__nvvm_atom_add_g_f, "ffD*1f", "n") -BUILTIN(__nvvm_atom_add_s_f, "ffD*3f", "n") BUILTIN(__nvvm_atom_add_gen_f, "ffD*f", "n") TARGET_BUILTIN(__nvvm_atom_cta_add_gen_f, "ffD*f", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_add_gen_f, "ffD*f", "n", SM_60) -BUILTIN(__nvvm_atom_add_g_d, "ddD*1d", "n") -BUILTIN(__nvvm_atom_add_s_d, "ddD*3d", "n") TARGET_BUILTIN(__nvvm_atom_add_gen_d, "ddD*d", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_cta_add_gen_d, "ddD*d", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_add_gen_d, "ddD*d", "n", SM_60) -BUILTIN(__nvvm_atom_sub_g_i, "iiD*1i", "n") -BUILTIN(__nvvm_atom_sub_s_i, "iiD*3i", "n") BUILTIN(__nvvm_atom_sub_gen_i, "iiD*i", "n") -BUILTIN(__nvvm_atom_sub_g_l, "LiLiD*1Li", "n") -BUILTIN(__nvvm_atom_sub_s_l, "LiLiD*3Li", "n") BUILTIN(__nvvm_atom_sub_gen_l, "LiLiD*Li", "n") -BUILTIN(__nvvm_atom_sub_g_ll, "LLiLLiD*1LLi", "n") -BUILTIN(__nvvm_atom_sub_s_ll, "LLiLLiD*3LLi", "n") BUILTIN(__nvvm_atom_sub_gen_ll, "LLiLLiD*LLi", "n") -BUILTIN(__nvvm_atom_xchg_g_i, "iiD*1i", "n") -BUILTIN(__nvvm_atom_xchg_s_i, "iiD*3i", "n") BUILTIN(__nvvm_atom_xchg_gen_i, "iiD*i", "n") TARGET_BUILTIN(__nvvm_atom_cta_xchg_gen_i, "iiD*i", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_xchg_gen_i, "iiD*i", "n", SM_60) -BUILTIN(__nvvm_atom_xchg_g_l, "LiLiD*1Li", "n") -BUILTIN(__nvvm_atom_xchg_s_l, "LiLiD*3Li", "n") BUILTIN(__nvvm_atom_xchg_gen_l, "LiLiD*Li", "n") TARGET_BUILTIN(__nvvm_atom_cta_xchg_gen_l, "LiLiD*Li", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_xchg_gen_l, "LiLiD*Li", "n", SM_60) -BUILTIN(__nvvm_atom_xchg_g_ll, "LLiLLiD*1LLi", "n") -BUILTIN(__nvvm_atom_xchg_s_ll, "LLiLLiD*3LLi", "n") BUILTIN(__nvvm_atom_xchg_gen_ll, "LLiLLiD*LLi", "n") TARGET_BUILTIN(__nvvm_atom_cta_xchg_gen_ll, "LLiLLiD*LLi", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_xchg_gen_ll, "LLiLLiD*LLi", "n", SM_60) -BUILTIN(__nvvm_atom_max_g_i, "iiD*1i", "n") -BUILTIN(__nvvm_atom_max_s_i, "iiD*3i", "n") BUILTIN(__nvvm_atom_max_gen_i, "iiD*i", "n") TARGET_BUILTIN(__nvvm_atom_cta_max_gen_i, "iiD*i", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_max_gen_i, "iiD*i", "n", SM_60) -BUILTIN(__nvvm_atom_max_g_ui, "UiUiD*1Ui", "n") -BUILTIN(__nvvm_atom_max_s_ui, "UiUiD*3Ui", "n") BUILTIN(__nvvm_atom_max_gen_ui, "UiUiD*Ui", "n") TARGET_BUILTIN(__nvvm_atom_cta_max_gen_ui, "UiUiD*Ui", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_max_gen_ui, "UiUiD*Ui", "n", SM_60) -BUILTIN(__nvvm_atom_max_g_l, "LiLiD*1Li", "n") -BUILTIN(__nvvm_atom_max_s_l, "LiLiD*3Li", "n") BUILTIN(__nvvm_atom_max_gen_l, "LiLiD*Li", "n") TARGET_BUILTIN(__nvvm_atom_cta_max_gen_l, "LiLiD*Li", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_max_gen_l, "LiLiD*Li", "n", SM_60) -BUILTIN(__nvvm_atom_max_g_ul, "ULiULiD*1ULi", "n") -BUILTIN(__nvvm_atom_max_s_ul, "ULiULiD*3ULi", "n") BUILTIN(__nvvm_atom_max_gen_ul, "ULiULiD*ULi", "n") TARGET_BUILTIN(__nvvm_atom_cta_max_gen_ul, "ULiULiD*ULi", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_max_gen_ul, "ULiULiD*ULi", "n", SM_60) -BUILTIN(__nvvm_atom_max_g_ll, "LLiLLiD*1LLi", "n") -BUILTIN(__nvvm_atom_max_s_ll, "LLiLLiD*3LLi", "n") BUILTIN(__nvvm_atom_max_gen_ll, "LLiLLiD*LLi", "n") TARGET_BUILTIN(__nvvm_atom_cta_max_gen_ll, "LLiLLiD*LLi", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_max_gen_ll, "LLiLLiD*LLi", "n", SM_60) -BUILTIN(__nvvm_atom_max_g_ull, "ULLiULLiD*1ULLi", "n") -BUILTIN(__nvvm_atom_max_s_ull, "ULLiULLiD*3ULLi", "n") BUILTIN(__nvvm_atom_max_gen_ull, "ULLiULLiD
r335168 - [CUDA] Removed unused __nvvm_* builtins with non-generic pointers.
Author: tra Date: Wed Jun 20 13:34:04 2018 New Revision: 335168 URL: http://llvm.org/viewvc/llvm-project?rev=335168&view=rev Log: [CUDA] Removed unused __nvvm_* builtins with non-generic pointers. They were hot even hooked into CGBuiltin's machinery. Even if they were, CUDA does not support AS-specific pointers, so there would be no legal way no way to call these builtins. This came up in D47154. Differential Revision: https://reviews.llvm.org/D47845 Modified: cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def Modified: cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def?rev=335168&r1=335167&r2=335168&view=diff == --- cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def (original) +++ cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def Wed Jun 20 13:34:04 2018 @@ -475,191 +475,117 @@ BUILTIN(__builtin_ptx_get_image_channel_ // - they are used in address space analysis and optimization // So it does not hurt to expose them as builtins. // -BUILTIN(__nvvm_atom_add_g_i, "iiD*1i", "n") -BUILTIN(__nvvm_atom_add_s_i, "iiD*3i", "n") BUILTIN(__nvvm_atom_add_gen_i, "iiD*i", "n") TARGET_BUILTIN(__nvvm_atom_cta_add_gen_i, "iiD*i", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_add_gen_i, "iiD*i", "n", SM_60) -BUILTIN(__nvvm_atom_add_g_l, "LiLiD*1Li", "n") -BUILTIN(__nvvm_atom_add_s_l, "LiLiD*3Li", "n") BUILTIN(__nvvm_atom_add_gen_l, "LiLiD*Li", "n") TARGET_BUILTIN(__nvvm_atom_cta_add_gen_l, "LiLiD*Li", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_add_gen_l, "LiLiD*Li", "n", SM_60) -BUILTIN(__nvvm_atom_add_g_ll, "LLiLLiD*1LLi", "n") -BUILTIN(__nvvm_atom_add_s_ll, "LLiLLiD*3LLi", "n") BUILTIN(__nvvm_atom_add_gen_ll, "LLiLLiD*LLi", "n") TARGET_BUILTIN(__nvvm_atom_cta_add_gen_ll, "LLiLLiD*LLi", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_add_gen_ll, "LLiLLiD*LLi", "n", SM_60) -BUILTIN(__nvvm_atom_add_g_f, "ffD*1f", "n") -BUILTIN(__nvvm_atom_add_s_f, "ffD*3f", "n") BUILTIN(__nvvm_atom_add_gen_f, "ffD*f", "n") TARGET_BUILTIN(__nvvm_atom_cta_add_gen_f, "ffD*f", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_add_gen_f, "ffD*f", "n", SM_60) -BUILTIN(__nvvm_atom_add_g_d, "ddD*1d", "n") -BUILTIN(__nvvm_atom_add_s_d, "ddD*3d", "n") TARGET_BUILTIN(__nvvm_atom_add_gen_d, "ddD*d", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_cta_add_gen_d, "ddD*d", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_add_gen_d, "ddD*d", "n", SM_60) -BUILTIN(__nvvm_atom_sub_g_i, "iiD*1i", "n") -BUILTIN(__nvvm_atom_sub_s_i, "iiD*3i", "n") BUILTIN(__nvvm_atom_sub_gen_i, "iiD*i", "n") -BUILTIN(__nvvm_atom_sub_g_l, "LiLiD*1Li", "n") -BUILTIN(__nvvm_atom_sub_s_l, "LiLiD*3Li", "n") BUILTIN(__nvvm_atom_sub_gen_l, "LiLiD*Li", "n") -BUILTIN(__nvvm_atom_sub_g_ll, "LLiLLiD*1LLi", "n") -BUILTIN(__nvvm_atom_sub_s_ll, "LLiLLiD*3LLi", "n") BUILTIN(__nvvm_atom_sub_gen_ll, "LLiLLiD*LLi", "n") -BUILTIN(__nvvm_atom_xchg_g_i, "iiD*1i", "n") -BUILTIN(__nvvm_atom_xchg_s_i, "iiD*3i", "n") BUILTIN(__nvvm_atom_xchg_gen_i, "iiD*i", "n") TARGET_BUILTIN(__nvvm_atom_cta_xchg_gen_i, "iiD*i", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_xchg_gen_i, "iiD*i", "n", SM_60) -BUILTIN(__nvvm_atom_xchg_g_l, "LiLiD*1Li", "n") -BUILTIN(__nvvm_atom_xchg_s_l, "LiLiD*3Li", "n") BUILTIN(__nvvm_atom_xchg_gen_l, "LiLiD*Li", "n") TARGET_BUILTIN(__nvvm_atom_cta_xchg_gen_l, "LiLiD*Li", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_xchg_gen_l, "LiLiD*Li", "n", SM_60) -BUILTIN(__nvvm_atom_xchg_g_ll, "LLiLLiD*1LLi", "n") -BUILTIN(__nvvm_atom_xchg_s_ll, "LLiLLiD*3LLi", "n") BUILTIN(__nvvm_atom_xchg_gen_ll, "LLiLLiD*LLi", "n") TARGET_BUILTIN(__nvvm_atom_cta_xchg_gen_ll, "LLiLLiD*LLi", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_xchg_gen_ll, "LLiLLiD*LLi", "n", SM_60) -BUILTIN(__nvvm_atom_max_g_i, "iiD*1i", "n") -BUILTIN(__nvvm_atom_max_s_i, "iiD*3i", "n") BUILTIN(__nvvm_atom_max_gen_i, "iiD*i", "n") TARGET_BUILTIN(__nvvm_atom_cta_max_gen_i, "iiD*i", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_max_gen_i, "iiD*i", "n", SM_60) -BUILTIN(__nvvm_atom_max_g_ui, "UiUiD*1Ui", "n") -BUILTIN(__nvvm_atom_max_s_ui, "UiUiD*3Ui", "n") BUILTIN(__nvvm_atom_max_gen_ui, "UiUiD*Ui", "n") TARGET_BUILTIN(__nvvm_atom_cta_max_gen_ui, "UiUiD*Ui", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_max_gen_ui, "UiUiD*Ui", "n", SM_60) -BUILTIN(__nvvm_atom_max_g_l, "LiLiD*1Li", "n") -BUILTIN(__nvvm_atom_max_s_l, "LiLiD*3Li", "n") BUILTIN(__nvvm_atom_max_gen_l, "LiLiD*Li", "n") TARGET_BUILTIN(__nvvm_atom_cta_max_gen_l, "LiLiD*Li", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_max_gen_l, "LiLiD*Li", "n", SM_60) -BUILTIN(__nvvm_atom_max_g_ul, "ULiULiD*1ULi", "n") -BUILTIN(__nvvm_atom_max_s_ul, "ULiULiD*3ULi", "n") BUILTIN(__nvvm_atom_max_gen_ul, "ULiULiD*ULi", "n") TARGET_BUILTIN(__nvvm_atom_cta_max_gen_ul, "ULiULiD*ULi", "n", SM_60) TARGET_BUILTIN(__nvvm_atom_sys_max_gen_ul, "ULiULiD*ULi", "n", SM_60) -BUILTIN(__nvvm_atom_max_g_ll, "LLiLLiD*1LLi", "n") -BUILTIN(__nvvm_atom_
[PATCH] D43424: [clang-doc] Implement a (simple) Markdown generator
Eugene.Zelenko added inline comments. Comment at: clang-tools-extra/clang-doc/MDGenerator.cpp:33 + case AccessSpecifier::AS_none: +return ""; + } return {}; https://reviews.llvm.org/D43424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r335169 - [CMake] Convert paths to the right form in standalone builds on Windows
Author: mstorsjo Date: Wed Jun 20 13:53:19 2018 New Revision: 335169 URL: http://llvm.org/viewvc/llvm-project?rev=335169&view=rev Log: [CMake] Convert paths to the right form in standalone builds on Windows The paths output from llvm-config --cmakedir and from clang --print-libgcc-file-name can contain backslashes, while CMake can't handle the paths in this form. This matches what compiler-rt already does (since SVN r203789 and r293195). Differential Revision: https://reviews.llvm.org/D48353 Modified: libunwind/trunk/CMakeLists.txt libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake Modified: libunwind/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=335169&r1=335168&r2=335169&view=diff == --- libunwind/trunk/CMakeLists.txt (original) +++ libunwind/trunk/CMakeLists.txt Wed Jun 20 13:53:19 2018 @@ -59,10 +59,11 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR OUTPUT_VARIABLE CONFIG_OUTPUT ERROR_QUIET) if(NOT HAD_ERROR) - string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG) + file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG}" LLVM_CMAKE_PATH) else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + file(TO_CMAKE_PATH "${LLVM_BINARY_DIR}" LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") endif() else() message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. " Modified: libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake?rev=335169&r1=335168&r2=335169&view=diff == --- libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake (original) +++ libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake Wed Jun 20 13:53:19 2018 @@ -14,6 +14,7 @@ function(find_compiler_rt_library name d OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) + file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}") if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}") message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}") @@ -37,6 +38,7 @@ function(find_compiler_rt_dir dest) OUTPUT_VARIABLE LIBRARY_DIR ) string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR) +file(TO_CMAKE_PATH "${LIBRARY_DIR}" LIBRARY_DIR) set(LIBRARY_DIR "${LIBRARY_DIR}/darwin") else() set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBUNWIND_COMPILE_FLAGS} @@ -47,6 +49,7 @@ function(find_compiler_rt_dir dest) OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) +file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY) endif() if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}") ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48353: [libunwind] [CMake] Convert paths to the right form in standalone builds on Windows
This revision was automatically updated to reflect the committed changes. Closed by commit rL335169: [CMake] Convert paths to the right form in standalone builds on Windows (authored by mstorsjo, committed by ). Herald added subscribers: llvm-commits, christof. Changed prior to commit: https://reviews.llvm.org/D48353?vs=152044&id=152154#toc Repository: rL LLVM https://reviews.llvm.org/D48353 Files: libunwind/trunk/CMakeLists.txt libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake Index: libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake === --- libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake +++ libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake @@ -14,6 +14,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) + file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}") if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}") message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}") @@ -37,6 +38,7 @@ OUTPUT_VARIABLE LIBRARY_DIR ) string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR) +file(TO_CMAKE_PATH "${LIBRARY_DIR}" LIBRARY_DIR) set(LIBRARY_DIR "${LIBRARY_DIR}/darwin") else() set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBUNWIND_COMPILE_FLAGS} @@ -47,6 +49,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) +file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY) endif() if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}") Index: libunwind/trunk/CMakeLists.txt === --- libunwind/trunk/CMakeLists.txt +++ libunwind/trunk/CMakeLists.txt @@ -59,10 +59,11 @@ OUTPUT_VARIABLE CONFIG_OUTPUT ERROR_QUIET) if(NOT HAD_ERROR) - string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG) + file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG}" LLVM_CMAKE_PATH) else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + file(TO_CMAKE_PATH "${LLVM_BINARY_DIR}" LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") endif() else() message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. " Index: libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake === --- libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake +++ libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake @@ -14,6 +14,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) + file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}") if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}") message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}") @@ -37,6 +38,7 @@ OUTPUT_VARIABLE LIBRARY_DIR ) string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR) +file(TO_CMAKE_PATH "${LIBRARY_DIR}" LIBRARY_DIR) set(LIBRARY_DIR "${LIBRARY_DIR}/darwin") else() set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBUNWIND_COMPILE_FLAGS} @@ -47,6 +49,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) +file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY) endif() if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}") Index: libunwind/trunk/CMakeLists.txt === --- libunwind/trunk/CMakeLists.txt +++ libunwind/trunk/CMakeLists.txt @@ -59,10 +59,11 @@ OUTPUT_VARIABLE CONFIG_OUTPUT ERROR_QUIET) if(NOT HAD_ERROR) - string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG) + file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG}" LLVM_CMAKE_PATH) else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + file(TO_CMAKE_PATH "${LLVM_BINARY_DIR}" LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") endif() else() message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. " ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r335171 - [CMake] Convert paths to the right form in standalone builds on Windows
Author: mstorsjo Date: Wed Jun 20 13:59:18 2018 New Revision: 335171 URL: http://llvm.org/viewvc/llvm-project?rev=335171&view=rev Log: [CMake] Convert paths to the right form in standalone builds on Windows The paths output from llvm-config --cmakedir and from clang --print-libgcc-file-name can contain backslashes, while CMake can't handle the paths in this form. This matches what compiler-rt already does (since SVN r203789 and r293195). Differential Revision: https://reviews.llvm.org/D48355 Modified: libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Modified: libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake?rev=335171&r1=335170&r2=335171&view=diff == --- libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake (original) +++ libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake Wed Jun 20 13:59:18 2018 @@ -14,6 +14,7 @@ function(find_compiler_rt_library name d OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) + file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}") if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}") message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}") @@ -37,6 +38,7 @@ function(find_compiler_rt_dir dest) OUTPUT_VARIABLE LIBRARY_DIR ) string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR) +file(TO_CMAKE_PATH "${LIBRARY_DIR}" LIBRARY_DIR) set(LIBRARY_DIR "${LIBRARY_DIR}/darwin") else() set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXXABI_COMPILE_FLAGS} @@ -47,6 +49,7 @@ function(find_compiler_rt_dir dest) OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) +file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY) endif() if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}") Modified: libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake?rev=335171&r1=335170&r2=335171&view=diff == --- libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake (original) +++ libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Wed Jun 20 13:59:18 2018 @@ -46,10 +46,11 @@ macro(find_llvm_parts) OUTPUT_VARIABLE CONFIG_OUTPUT ERROR_QUIET) if(NOT HAD_ERROR) - string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG) + file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG}" LLVM_CMAKE_PATH) else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + file(TO_CMAKE_PATH "${LLVM_BINARY_DIR}" LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") endif() else() set(LLVM_FOUND OFF) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48355: [libcxxabi] [CMake] Convert paths to the right form in standalone builds on Windows
This revision was automatically updated to reflect the committed changes. Closed by commit rL335171: [CMake] Convert paths to the right form in standalone builds on Windows (authored by mstorsjo, committed by ). Herald added subscribers: llvm-commits, christof. Changed prior to commit: https://reviews.llvm.org/D48355?vs=152046&id=152158#toc Repository: rL LLVM https://reviews.llvm.org/D48355 Files: libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Index: libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake === --- libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake +++ libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake @@ -14,6 +14,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) + file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}") if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}") message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}") @@ -37,6 +38,7 @@ OUTPUT_VARIABLE LIBRARY_DIR ) string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR) +file(TO_CMAKE_PATH "${LIBRARY_DIR}" LIBRARY_DIR) set(LIBRARY_DIR "${LIBRARY_DIR}/darwin") else() set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXXABI_COMPILE_FLAGS} @@ -47,6 +49,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) +file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY) endif() if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}") Index: libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake === --- libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake +++ libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake @@ -46,10 +46,11 @@ OUTPUT_VARIABLE CONFIG_OUTPUT ERROR_QUIET) if(NOT HAD_ERROR) - string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG) + file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG}" LLVM_CMAKE_PATH) else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + file(TO_CMAKE_PATH "${LLVM_BINARY_DIR}" LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") endif() else() set(LLVM_FOUND OFF) Index: libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake === --- libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake +++ libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake @@ -14,6 +14,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) + file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}") if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}") message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}") @@ -37,6 +38,7 @@ OUTPUT_VARIABLE LIBRARY_DIR ) string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR) +file(TO_CMAKE_PATH "${LIBRARY_DIR}" LIBRARY_DIR) set(LIBRARY_DIR "${LIBRARY_DIR}/darwin") else() set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXXABI_COMPILE_FLAGS} @@ -47,6 +49,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) +file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY) endif() if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}") Index: libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake === --- libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake +++ libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake @@ -46,10 +46,11 @@ OUTPUT_VARIABLE CONFIG_OUTPUT ERROR_QUIET) if(NOT HAD_ERROR) - string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG) + file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG}" LLVM_CMAKE_PATH) else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + file(TO_CMAKE_PATH "${LLVM_BINARY_DIR}" LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") endif() else() set(LLVM_FOUND OFF) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r335172 - [CMake] Convert paths to the right form in standalone builds on Windows
Author: mstorsjo Date: Wed Jun 20 14:03:34 2018 New Revision: 335172 URL: http://llvm.org/viewvc/llvm-project?rev=335172&view=rev Log: [CMake] Convert paths to the right form in standalone builds on Windows The paths output from llvm-config --cmakedir and from clang --print-libgcc-file-name can contain backslashes, while CMake can't handle the paths in this form. This matches what compiler-rt already does (since SVN r203789 and r293195). Differential Revision: https://reviews.llvm.org/D48356 Modified: libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Modified: libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake?rev=335172&r1=335171&r2=335172&view=diff == --- libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake (original) +++ libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake Wed Jun 20 14:03:34 2018 @@ -14,6 +14,7 @@ function(find_compiler_rt_library name d OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) + file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}") if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}") message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}") @@ -37,6 +38,7 @@ function(find_compiler_rt_dir dest) OUTPUT_VARIABLE LIBRARY_DIR ) string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR) +file(TO_CMAKE_PATH "${LIBRARY_DIR}" LIBRARY_DIR) set(LIBRARY_DIR "${LIBRARY_DIR}/darwin") else() set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXX_COMPILE_FLAGS} @@ -47,6 +49,7 @@ function(find_compiler_rt_dir dest) OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) +file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY) endif() if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}") Modified: libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake?rev=335172&r1=335171&r2=335172&view=diff == --- libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake (original) +++ libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Wed Jun 20 14:03:34 2018 @@ -46,10 +46,11 @@ macro(find_llvm_parts) OUTPUT_VARIABLE CONFIG_OUTPUT ERROR_QUIET) if(NOT HAD_ERROR) - string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG) + file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG}" LLVM_CMAKE_PATH) else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + file(TO_CMAKE_PATH "${LLVM_BINARY_DIR}" LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") endif() else() set(LLVM_FOUND OFF) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48356: [libcxx] [CMake] Convert paths to the right form in standalone builds on Windows
This revision was automatically updated to reflect the committed changes. Closed by commit rL335172: [CMake] Convert paths to the right form in standalone builds on Windows (authored by mstorsjo, committed by ). Herald added subscribers: llvm-commits, christof. Changed prior to commit: https://reviews.llvm.org/D48356?vs=152047&id=152160#toc Repository: rL LLVM https://reviews.llvm.org/D48356 Files: libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Index: libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake === --- libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake +++ libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake @@ -14,6 +14,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) + file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}") if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}") message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}") @@ -37,6 +38,7 @@ OUTPUT_VARIABLE LIBRARY_DIR ) string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR) +file(TO_CMAKE_PATH "${LIBRARY_DIR}" LIBRARY_DIR) set(LIBRARY_DIR "${LIBRARY_DIR}/darwin") else() set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXX_COMPILE_FLAGS} @@ -47,6 +49,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) +file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY) endif() if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}") Index: libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake === --- libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake +++ libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake @@ -46,10 +46,11 @@ OUTPUT_VARIABLE CONFIG_OUTPUT ERROR_QUIET) if(NOT HAD_ERROR) - string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG) + file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG}" LLVM_CMAKE_PATH) else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + file(TO_CMAKE_PATH "${LLVM_BINARY_DIR}" LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") endif() else() set(LLVM_FOUND OFF) Index: libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake === --- libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake +++ libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake @@ -14,6 +14,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) + file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}") if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}") message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}") @@ -37,6 +38,7 @@ OUTPUT_VARIABLE LIBRARY_DIR ) string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR) +file(TO_CMAKE_PATH "${LIBRARY_DIR}" LIBRARY_DIR) set(LIBRARY_DIR "${LIBRARY_DIR}/darwin") else() set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXX_COMPILE_FLAGS} @@ -47,6 +49,7 @@ OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) +file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY) endif() if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}") Index: libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake === --- libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake +++ libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake @@ -46,10 +46,11 @@ OUTPUT_VARIABLE CONFIG_OUTPUT ERROR_QUIET) if(NOT HAD_ERROR) - string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG) + file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG}" LLVM_CMAKE_PATH) else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + file(TO_CMAKE_PATH "${LLVM_BINARY_DIR}" LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") endif() else() set(LLVM_FOUND OFF) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r335175 - [MS] Make sure __GetExceptionInfo works on types with no linkage
Author: rnk Date: Wed Jun 20 14:12:20 2018 New Revision: 335175 URL: http://llvm.org/viewvc/llvm-project?rev=335175&view=rev Log: [MS] Make sure __GetExceptionInfo works on types with no linkage Fixes PR36327 Modified: cfe/trunk/lib/Sema/Sema.cpp cfe/trunk/test/CodeGenCXX/microsoft-abi-throw.cpp Modified: cfe/trunk/lib/Sema/Sema.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=335175&r1=335174&r2=335175&view=diff == --- cfe/trunk/lib/Sema/Sema.cpp (original) +++ cfe/trunk/lib/Sema/Sema.cpp Wed Jun 20 14:12:20 2018 @@ -645,6 +645,8 @@ void Sema::getUndefinedButUsed( !isExternalWithNoLinkageType(FD) && !FD->getMostRecentDecl()->isInlined()) continue; + if (FD->getBuiltinID()) +continue; } else { auto *VD = cast(ND); if (VD->hasDefinition() != VarDecl::DeclarationOnly) Modified: cfe/trunk/test/CodeGenCXX/microsoft-abi-throw.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/microsoft-abi-throw.cpp?rev=335175&r1=335174&r2=335175&view=diff == --- cfe/trunk/test/CodeGenCXX/microsoft-abi-throw.cpp (original) +++ cfe/trunk/test/CodeGenCXX/microsoft-abi-throw.cpp Wed Jun 20 14:12:20 2018 @@ -22,6 +22,7 @@ // CHECK-DAG: @_TI1P6AXXZ = linkonce_odr unnamed_addr constant %eh.ThrowInfo { i32 0, i8* null, i8* null, i8* bitcast (%eh.CatchableTypeArray.1* @_CTA1P6AXXZ to i8*) }, section ".xdata", comdat // CHECK-DAG: @_TIU2PAPFAH = linkonce_odr unnamed_addr constant %eh.ThrowInfo { i32 4, i8* null, i8* null, i8* bitcast (%eh.CatchableTypeArray.2* @_CTA2PAPFAH to i8*) }, section ".xdata", comdat // CHECK-DAG: @_CTA2PAPFAH = linkonce_odr unnamed_addr constant %eh.CatchableTypeArray.2 { i32 2, [2 x %eh.CatchableType*] [%eh.CatchableType* @"_CT??_R0PAPFAH@84", %eh.CatchableType* @"_CT??_R0PAX@84"] }, section ".xdata", comdat +// CHECK-DAG: @"_TI1?AUFoo@?A@@" = internal unnamed_addr constant %eh.ThrowInfo { i32 0, i8* null, i8* null, i8* bitcast (%eh.CatchableTypeArray.1* @"_CTA1?AUFoo@?A@@" to i8*) }, section ".xdata" struct N { ~N(); }; @@ -128,3 +129,12 @@ void *GetExceptionInfo_test1() { // CHECK: ret i8* bitcast (%eh.ThrowInfo* @_TI1P6AXXZ to i8*) return __GetExceptionInfo(&h); } + +// PR36327: Try an exception type with no linkage. +namespace { struct Foo { } foo_exc; } + +void *GetExceptionInfo_test2() { +// CHECK-LABEL: @"?GetExceptionInfo_test2@@YAPAXXZ" +// CHECK: ret i8* bitcast (%eh.ThrowInfo* @"_TI1?AUFoo@?A@@" to i8*) + return __GetExceptionInfo(foo_exc); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46485: Add python tool to dump and construct header maps
This revision was automatically updated to reflect the committed changes. Closed by commit rC335177: Add python tool to dump and construct header maps (authored by bruno, committed by ). Changed prior to commit: https://reviews.llvm.org/D46485?vs=152142&id=152168#toc Repository: rC Clang https://reviews.llvm.org/D46485 Files: CMakeLists.txt test/CMakeLists.txt test/Modules/crash-vfs-headermaps.m test/Preprocessor/Inputs/headermap-rel/foo.hmap test/Preprocessor/Inputs/headermap-rel/foo.hmap.json test/Preprocessor/Inputs/headermap-rel2/project-headers.hmap test/Preprocessor/Inputs/headermap-rel2/project-headers.hmap.json test/Preprocessor/Inputs/nonportable-hmaps/foo.hmap test/Preprocessor/Inputs/nonportable-hmaps/foo.hmap.json test/Preprocessor/headermap-rel.c test/Preprocessor/headermap-rel2.c test/Preprocessor/nonportable-include-with-hmap.c utils/hmaptool/CMakeLists.txt utils/hmaptool/hmaptool Index: utils/hmaptool/hmaptool === --- utils/hmaptool/hmaptool +++ utils/hmaptool/hmaptool @@ -0,0 +1,296 @@ +#!/usr/bin/env python +from __future__ import print_function + +import json +import optparse +import os +import struct +import sys + +### + +k_header_magic_LE = 'pamh' +k_header_magic_BE = 'hmap' + +def hmap_hash(str): +"""hash(str) -> int + +Apply the "well-known" headermap hash function. +""" + +return sum((ord(c.lower()) * 13 +for c in str), 0) + +class HeaderMap(object): +@staticmethod +def frompath(path): +with open(path, 'rb') as f: +magic = f.read(4) +if magic == k_header_magic_LE: +endian_code = '<' +elif magic == k_header_magic_BE: +endian_code = '>' +else: +raise SystemExit("error: %s: not a headermap" % ( +path,)) + +# Read the header information. +header_fmt = endian_code + 'HH' +header_size = struct.calcsize(header_fmt) +data = f.read(header_size) +if len(data) != header_size: +raise SystemExit("error: %s: truncated headermap header" % ( +path,)) + +(version, reserved, strtable_offset, num_entries, + num_buckets, max_value_len) = struct.unpack(header_fmt, data) + +if version != 1: +raise SystemExit("error: %s: unknown headermap version: %r" % ( +path, version)) +if reserved != 0: +raise SystemExit("error: %s: invalid reserved value in header" % ( +path,)) + +# The number of buckets must be a power of two. +if num_buckets == 0 or (num_buckets & num_buckets - 1) != 0: +raise SystemExit("error: %s: invalid number of buckets" % ( +path,)) + +# Read all of the buckets. +bucket_fmt = endian_code + 'III' +bucket_size = struct.calcsize(bucket_fmt) +buckets_data = f.read(num_buckets * bucket_size) +if len(buckets_data) != num_buckets * bucket_size: +raise SystemExit("error: %s: truncated headermap buckets" % ( +path,)) +buckets = [struct.unpack(bucket_fmt, + buckets_data[i*bucket_size:(i+1)*bucket_size]) + for i in range(num_buckets)] + +# Read the string table; the format doesn't explicitly communicate the +# size of the string table (which is dumb), so assume it is the rest of +# the file. +f.seek(0, 2) +strtable_size = f.tell() - strtable_offset +f.seek(strtable_offset) + +if strtable_size == 0: +raise SystemExit("error: %s: unable to read zero-sized string table"%( +path,)) +strtable = f.read(strtable_size) + +if len(strtable) != strtable_size: +raise SystemExit("error: %s: unable to read complete string table"%( +path,)) +if strtable[-1] != '\0': +raise SystemExit("error: %s: invalid string table in headermap" % ( +path,)) + +return HeaderMap(num_entries, buckets, strtable) + +def __init__(self, num_entries, buckets, strtable): +self.num_entries = num_entries +self.buckets = buckets +self.strtable = strtable + +def get_string(self, idx): +if idx >= len(self.strtable): +raise SystemExit("error: %s: invalid string index" % ( +path,)) +end_idx = self.strtable.index('\0', idx) +return self.strtable[idx:end_idx] + +@property +def mappings(self): +for key_idx,prefix_idx,suffix_idx in self.buckets: +if key_idx == 0: +
r335177 - Add python tool to dump and construct header maps
Author: bruno Date: Wed Jun 20 14:16:37 2018 New Revision: 335177 URL: http://llvm.org/viewvc/llvm-project?rev=335177&view=rev Log: Add python tool to dump and construct header maps Header maps are binary files used by Xcode, which are used to map header names or paths to other locations. Clang has support for those since its inception, but there's not a lot of header map testing around. Since it's a binary format, testing becomes pretty much brittle and its hard to even know what's inside if you don't have the appropriate tools. Add a python based tool that allows creating and dumping header maps based on a json description of those. While here, rewrite tests to use the tool and remove the binary files from the tree. This tool was initially written by Daniel Dunbar. Differential Revision: https://reviews.llvm.org/D46485 rdar://problem/39994722 Added: cfe/trunk/test/Preprocessor/Inputs/headermap-rel/foo.hmap.json cfe/trunk/test/Preprocessor/Inputs/headermap-rel2/project-headers.hmap.json cfe/trunk/test/Preprocessor/Inputs/nonportable-hmaps/foo.hmap.json cfe/trunk/utils/hmaptool/ cfe/trunk/utils/hmaptool/CMakeLists.txt cfe/trunk/utils/hmaptool/hmaptool (with props) Removed: cfe/trunk/test/Preprocessor/Inputs/headermap-rel/foo.hmap cfe/trunk/test/Preprocessor/Inputs/headermap-rel2/project-headers.hmap cfe/trunk/test/Preprocessor/Inputs/nonportable-hmaps/foo.hmap Modified: cfe/trunk/CMakeLists.txt cfe/trunk/test/CMakeLists.txt cfe/trunk/test/Modules/crash-vfs-headermaps.m cfe/trunk/test/Preprocessor/headermap-rel.c cfe/trunk/test/Preprocessor/headermap-rel2.c cfe/trunk/test/Preprocessor/nonportable-include-with-hmap.c Modified: cfe/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=335177&r1=335176&r2=335177&view=diff == --- cfe/trunk/CMakeLists.txt (original) +++ cfe/trunk/CMakeLists.txt Wed Jun 20 14:16:37 2018 @@ -753,6 +753,7 @@ endif() if (LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION) add_subdirectory(utils/ClangVisualizers) endif() +add_subdirectory(utils/hmaptool) configure_file( ${CLANG_SOURCE_DIR}/include/clang/Config/config.h.cmake Modified: cfe/trunk/test/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CMakeLists.txt?rev=335177&r1=335176&r2=335177&view=diff == --- cfe/trunk/test/CMakeLists.txt (original) +++ cfe/trunk/test/CMakeLists.txt Wed Jun 20 14:16:37 2018 @@ -54,6 +54,7 @@ list(APPEND CLANG_TEST_DEPS clang-rename clang-refactor clang-diff + hmaptool ) if(CLANG_ENABLE_STATIC_ANALYZER) Modified: cfe/trunk/test/Modules/crash-vfs-headermaps.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/crash-vfs-headermaps.m?rev=335177&r1=335176&r2=335177&view=diff == --- cfe/trunk/test/Modules/crash-vfs-headermaps.m (original) +++ cfe/trunk/test/Modules/crash-vfs-headermaps.m Wed Jun 20 14:16:37 2018 @@ -1,15 +1,9 @@ // REQUIRES: crash-recovery, shell, system-darwin -// This uses a headermap with this entry: -// Foo.h -> Foo/Foo.h - -// Copy out the headermap from test/Preprocessor/Inputs/headermap-rel and avoid -// adding another binary format to the repository. - // RUN: rm -rf %t -// RUN: mkdir -p %t/m -// RUN: cp -a %S/../Preprocessor/Inputs/headermap-rel %t/i +// RUN: mkdir -p %t/m %t/i/Foo.framework/Headers // RUN: echo '// Foo.h' > %t/i/Foo.framework/Headers/Foo.h +// RUN: hmaptool write %S/../Preprocessor/Inputs/headermap-rel/foo.hmap.json %t/i/foo.hmap // RUN: not env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \ // RUN: %clang -fsyntax-only -fmodules -fmodules-cache-path=%t/m %s \ Removed: cfe/trunk/test/Preprocessor/Inputs/headermap-rel/foo.hmap URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/Inputs/headermap-rel/foo.hmap?rev=335176&view=auto == Binary files cfe/trunk/test/Preprocessor/Inputs/headermap-rel/foo.hmap (original) and cfe/trunk/test/Preprocessor/Inputs/headermap-rel/foo.hmap (removed) differ Added: cfe/trunk/test/Preprocessor/Inputs/headermap-rel/foo.hmap.json URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/Inputs/headermap-rel/foo.hmap.json?rev=335177&view=auto == --- cfe/trunk/test/Preprocessor/Inputs/headermap-rel/foo.hmap.json (added) +++ cfe/trunk/test/Preprocessor/Inputs/headermap-rel/foo.hmap.json Wed Jun 20 14:16:37 2018 @@ -0,0 +1,6 @@ +{ + "mappings" : +{ + "Foo.h" : "Foo/Foo.h" +} +} Removed: cfe/trunk/test/Preprocessor/Inputs/headermap-rel2/project-headers.hmap URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/Inputs/he
[PATCH] D46652: [clang-cl, PCH] Implement support for MS-style PCH through headers
rnk added a comment. @hans, think you'll have time to look at this with your recent dllexport PCH experimentation? https://reviews.llvm.org/D46652 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48373: [Driver] Make scudo compatible with -fsanitize-minimal-runtime
cryptoad updated this revision to Diff 152171. cryptoad added a comment. Adding tests. Repository: rC Clang https://reviews.llvm.org/D48373 Files: lib/Driver/SanitizerArgs.cpp lib/Driver/ToolChains/CommonArgs.cpp test/Driver/fsanitize.c test/Driver/sanitizer-ld.c Index: test/Driver/sanitizer-ld.c === --- test/Driver/sanitizer-ld.c +++ test/Driver/sanitizer-ld.c @@ -689,6 +689,15 @@ // CHECK-SCUDO-LINUX: "-lpthread" // CHECK-SCUDO-LINUX: "-ldl" +// RUN: %clang -fsanitize=scudo -fsanitize-minimal-runtime %s -### -o %t.o 2>&1 \ +// RUN: -target i386-unknown-linux -fuse-ld=ld \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-SCUDO-MINIMAL-LINUX %s +// CHECK-SCUDO-MINIMAL-LINUX: "{{.*}}ld{{(.exe)?}}" +// CHECK-SCUDO-MINIMAL-LINUX: "-pie" +// CHECK-SCUDO-MINIMAL-LINUX: "--whole-archive" "{{.*}}libclang_rt.scudo_minimal-i386.a" "--no-whole-archive" +// CHECK-SCUDO-MINIMAL-LINUX: "-lpthread" + // RUN: %clang -no-canonical-prefixes %s -### -o %t.so -shared 2>&1 \ // RUN: -target i386-unknown-linux -fuse-ld=ld -fsanitize=scudo -shared-libsan \ // RUN: -resource-dir=%S/Inputs/resource_dir \ Index: test/Driver/fsanitize.c === --- test/Driver/fsanitize.c +++ test/Driver/fsanitize.c @@ -674,6 +674,14 @@ // RUN: %clang -target x86_64-linux-gnu -fsanitize=scudo,undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SCUDO-UBSAN // CHECK-SCUDO-UBSAN: "-fsanitize={{.*}}scudo" +// RUN: %clang -target x86_64-linux-gnu -fsanitize=scudo -fsanitize-minimal-runtime %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SCUDO-MINIMAL +// CHECK-SCUDO-MINIMAL: "-fsanitize=scudo" +// CHECK-SCUDO-MINIMAL: "-fsanitize-minimal-runtime" + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined,scudo -fsanitize-minimal-runtime %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SCUDO-UBSAN-MINIMAL +// CHECK-SCUDO-UBSAN-MINIMAL: "-fsanitize={{.*}}scudo" +// CHECK-SCUDO-UBSAN-MINIMAL: "-fsanitize-minimal-runtime" + // RUN: %clang -target powerpc-unknown-linux -fsanitize=scudo %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SCUDO // CHECK-NO-SCUDO: unsupported option Index: lib/Driver/ToolChains/CommonArgs.cpp === --- lib/Driver/ToolChains/CommonArgs.cpp +++ lib/Driver/ToolChains/CommonArgs.cpp @@ -593,14 +593,17 @@ HelperStaticRuntimes.push_back("asan-preinit"); } if (SanArgs.needsUbsanRt()) { - if (SanArgs.requiresMinimalRuntime()) { + if (SanArgs.requiresMinimalRuntime()) SharedRuntimes.push_back("ubsan_minimal"); - } else { + else SharedRuntimes.push_back("ubsan_standalone"); - } } -if (SanArgs.needsScudoRt()) - SharedRuntimes.push_back("scudo"); +if (SanArgs.needsScudoRt()) { + if (SanArgs.requiresMinimalRuntime()) +SharedRuntimes.push_back("scudo_minimal"); + else +SharedRuntimes.push_back("scudo"); +} if (SanArgs.needsHwasanRt()) SharedRuntimes.push_back("hwasan"); } @@ -666,9 +669,15 @@ if (SanArgs.needsEsanRt()) StaticRuntimes.push_back("esan"); if (SanArgs.needsScudoRt()) { -StaticRuntimes.push_back("scudo"); -if (SanArgs.linkCXXRuntimes()) - StaticRuntimes.push_back("scudo_cxx"); +if (SanArgs.requiresMinimalRuntime()) { + StaticRuntimes.push_back("scudo_minimal"); + if (SanArgs.linkCXXRuntimes()) +StaticRuntimes.push_back("scudo_cxx_minimal"); +} else { + StaticRuntimes.push_back("scudo"); + if (SanArgs.linkCXXRuntimes()) +StaticRuntimes.push_back("scudo_cxx"); +} } } Index: lib/Driver/SanitizerArgs.cpp === --- lib/Driver/SanitizerArgs.cpp +++ lib/Driver/SanitizerArgs.cpp @@ -45,7 +45,7 @@ Nullability | LocalBounds | CFI, TrappingDefault = CFI, CFIClasses = CFIVCall | CFINVCall | CFIDerivedCast | CFIUnrelatedCast, - CompatibleWithMinimalRuntime = TrappingSupported, + CompatibleWithMinimalRuntime = TrappingSupported | Scudo, }; enum CoverageFeature { @@ -179,7 +179,8 @@ bool SanitizerArgs::needsUbsanRt() const { // All of these include ubsan. if (needsAsanRt() || needsMsanRt() || needsHwasanRt() || needsTsanRt() || - needsDfsanRt() || needsLsanRt() || needsCfiDiagRt() || needsScudoRt()) + needsDfsanRt() || needsLsanRt() || needsCfiDiagRt() || + (needsScudoRt() && !requiresMinimalRuntime())) return false; return (Sanitizers.Mask & NeedsUbsanRt & ~TrapSanitizers.Mask) || ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48395: Added PublicOnly flag
anniecherk created this revision. anniecherk added reviewers: juliehockett, jakehehrlich, mcgrathr, phosek. Herald added a subscriber: cfe-commits. Added a flag which, when enabled, documents only those methods and fields which have a Public attribute. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D48395 Files: clang-tools-extra/clang-doc/ClangDoc.cpp clang-tools-extra/clang-doc/ClangDoc.h clang-tools-extra/clang-doc/Mapper.cpp clang-tools-extra/clang-doc/Mapper.h clang-tools-extra/clang-doc/Serialize.cpp clang-tools-extra/clang-doc/Serialize.h clang-tools-extra/clang-doc/tool/ClangDocMain.cpp clang-tools-extra/test/clang-doc/yaml-record-public-only.cpp Index: clang-tools-extra/test/clang-doc/yaml-record-public-only.cpp === --- /dev/null +++ clang-tools-extra/test/clang-doc/yaml-record-public-only.cpp @@ -0,0 +1,103 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo "" > %t/compile_flags.txt +// RUN: cp "%s" "%t/test.cpp" +// RUN: clang-doc --public-only --doxygen -p %t %t/test.cpp -output=%t/docs +// RUN: cat %t/docs/Struct.yaml | FileCheck %s --check-prefix=CHECK-A +// RUN: cat %t/docs/Struct/publicMethod.yaml | FileCheck %s --check-prefix=CHECK-B +// RUN: cat %t/docs/Class.yaml | FileCheck %s --check-prefix=CHECK-C +// RUN: cat %t/docs/Class/publicMethod.yaml | FileCheck %s --check-prefix=CHECK-D + +struct Struct { + public: +void publicMethod(); +int publicField; + protected: +void protectedMethod(); +int protectedField; + private: +void privateMethod(); +int privateField; +}; + + +// CHECK-A: --- +// CHECK-A-NEXT: USR: '0E0522198A2C7D141073719DA0815FCD6DC95610' +// CHECK-A-NEXT: Name:'Struct' +// CHECK-A-NEXT: DefLocation: +// CHECK-A-NEXT: LineNumber: 11 +// CHECK-A-NEXT: Filename:'test' +// CHECK-A-NEXT: Members: +// CHECK-A-NEXT: - Type: +// CHECK-A-NEXT: Name:'int' +// CHECK-A-NEXT: Name:'publicField' +// CHECK-A-NEXT: ... + + +// CHECK-B: --- +// CHECK-B-NEXT: USR: 'DC71C1FF683E2DE57395B0029458ADC4BDDE46CA' +// CHECK-B-NEXT: Name:'publicMethod' +// CHECK-B-NEXT: Namespace: +// CHECK-B-NEXT: - Type:Record +// CHECK-B-NEXT: Name:'Struct' +// CHECK-B-NEXT: USR: '0E0522198A2C7D141073719DA0815FCD6DC95610' +// CHECK-B-NEXT: Location: +// CHECK-B-NEXT: - LineNumber: 13 +// CHECK-B-NEXT: Filename:'test' +// CHECK-B-NEXT: IsMethod:true +// CHECK-B-NEXT: Parent: +// CHECK-B-NEXT: Type:Record +// CHECK-B-NEXT: Name:'Struct' +// CHECK-B-NEXT: USR: '0E0522198A2C7D141073719DA0815FCD6DC95610' +// CHECK-B-NEXT: ReturnType: +// CHECK-B-NEXT: Type: +// CHECK-B-NEXT: Name:'void' +// CHECK-B-NEXT: ... + + +class Class { + public: + void publicMethod(); + int publicField; + protected: + void protectedMethod(); + int protectedField; + private: + void privateMethod(); + int privateField; +}; + + +// CHECK-C: --- +// CHECK-C-NEXT: USR: '7CDD73DCD6CD72F7E5CE25502810A182C66C4B45' +// CHECK-C-NEXT: Name:'Class' +// CHECK-C-NEXT: DefLocation: +// CHECK-C-NEXT: LineNumber: 58 +// CHECK-C-NEXT: Filename:'test' +// CHECK-C-NEXT: TagType: Class +// CHECK-C-NEXT: Members: +// CHECK-C-NEXT: - Type: +// CHECK-C-NEXT: Name:'int' +// CHECK-C-NEXT: Name:'publicField' +// CHECK-C-NEXT: ... + + +// CHECK-D: --- +// CHECK-D-NEXT: USR: '05682AF6307337176313391E00A231C2C55A4972' +// CHECK-D-NEXT: Name:'publicMethod' +// CHECK-D-NEXT: Namespace: +// CHECK-D-NEXT: - Type:Record +// CHECK-D-NEXT: Name:'Class' +// CHECK-D-NEXT: USR: '7CDD73DCD6CD72F7E5CE25502810A182C66C4B45' +// CHECK-D-NEXT: Location: +// CHECK-D-NEXT: - LineNumber: 60 +// CHECK-D-NEXT: Filename:'test' +// CHECK-D-NEXT: IsMethod:true +// CHECK-D-NEXT: Parent: +// CHECK-D-NEXT: Type:Record +// CHECK-D-NEXT: Name:'Class' +// CHECK-D-NEXT: USR: '7CDD73DCD6CD72F7E5CE25502810A182C66C4B45' +// CHECK-D-NEXT: ReturnType: +// CHECK-D-NEXT: Type: +// CHECK-D-NEXT: Name:'void' +// CHECK-D-NEXT: ... Index: clang-tools-extra/clang-doc/tool/ClangDocMain.cpp === --- clang-tools-extra/clang-doc/tool/ClangDocMain.cpp +++ clang-tools-extra/clang-doc/tool/ClangDocMain.cpp @@ -64,6 +64,11 @@ llvm::cl::desc("Dump intermediate results to bitcode file."), llvm::cl::init(false), llvm::cl::cat(ClangDocCategory)); +static llvm::cl::opt PublicOnly( +"public-only", +llvm::cl::desc("Only document public methods & public fields."), +llvm::cl::init(false), llvm::cl::cat(ClangDocCategory)); + enum OutputFormatTy
[PATCH] D48373: [Driver] Make scudo compatible with -fsanitize-minimal-runtime
eugenis accepted this revision. eugenis added a comment. This revision is now accepted and ready to land. Looks great, thanks! Repository: rC Clang https://reviews.llvm.org/D48373 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r335182 - Related to PR37768: improve diagnostics for class name shadowing.
Author: rsmith Date: Wed Jun 20 14:58:20 2018 New Revision: 335182 URL: http://llvm.org/viewvc/llvm-project?rev=335182&view=rev Log: Related to PR37768: improve diagnostics for class name shadowing. Diagnose the name of the class being shadowed by using declarations, and improve the diagnostics for the case where the name of the class is shadowed by a non-static data member in a class with constructors. In the latter case, we now always give the "member with the same name as its class" diagnostic regardless of the relative order of the member and the constructor, rather than giving an inscrutible diagnostic if the constructor appears second. Modified: cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/Parse/ParseDecl.cpp cfe/trunk/lib/Parse/ParseExprCXX.cpp cfe/trunk/lib/Sema/SemaDeclCXX.cpp cfe/trunk/lib/Sema/SemaExprCXX.cpp cfe/trunk/test/CXX/class/class.mem/p13.cpp cfe/trunk/test/CXX/class/class.mem/p14.cpp cfe/trunk/test/CXX/drs/dr0xx.cpp Modified: cfe/trunk/include/clang/Sema/Sema.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=335182&r1=335181&r2=335182&view=diff == --- cfe/trunk/include/clang/Sema/Sema.h (original) +++ cfe/trunk/include/clang/Sema/Sema.h Wed Jun 20 14:58:20 2018 @@ -4984,6 +4984,8 @@ public: SourceLocation NameLoc, IdentifierInfo &Name); + ParsedType getConstructorName(IdentifierInfo &II, SourceLocation NameLoc, +Scope *S, CXXScopeSpec &SS); ParsedType getDestructorName(SourceLocation TildeLoc, IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, @@ -5704,6 +5706,7 @@ public: //======// // C++ Classes // + CXXRecordDecl *getCurrentClass(Scope *S, const CXXScopeSpec *SS); bool isCurrentClassName(const IdentifierInfo &II, Scope *S, const CXXScopeSpec *SS = nullptr); bool isCurrentClassNameTypo(IdentifierInfo *&II, const CXXScopeSpec *SS); Modified: cfe/trunk/lib/Parse/ParseDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=335182&r1=335181&r2=335182&view=diff == --- cfe/trunk/lib/Parse/ParseDecl.cpp (original) +++ cfe/trunk/lib/Parse/ParseDecl.cpp Wed Jun 20 14:58:20 2018 @@ -3250,6 +3250,13 @@ void Parser::ParseDeclarationSpecifiers( continue; } + // If we're in a context where the identifier could be a class name, + // check whether this is a constructor declaration. + if (getLangOpts().CPlusPlus && DSContext == DeclSpecContext::DSC_class && + Actions.isCurrentClassName(*Tok.getIdentifierInfo(), getCurScope()) && + isConstructorDeclarator(/*Unqualified*/true)) +goto DoneWithDeclSpec; + ParsedType TypeRep = Actions.getTypeName( *Tok.getIdentifierInfo(), Tok.getLocation(), getCurScope(), nullptr, false, false, nullptr, false, false, @@ -3269,13 +3276,6 @@ void Parser::ParseDeclarationSpecifiers( goto DoneWithDeclSpec; } - // If we're in a context where the identifier could be a class name, - // check whether this is a constructor declaration. - if (getLangOpts().CPlusPlus && DSContext == DeclSpecContext::DSC_class && - Actions.isCurrentClassName(*Tok.getIdentifierInfo(), getCurScope()) && - isConstructorDeclarator(/*Unqualified*/true)) -goto DoneWithDeclSpec; - // Likewise, if this is a context where the identifier could be a template // name, check whether this is a deduction guide declaration. if (getLangOpts().CPlusPlus17 && Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=335182&r1=335181&r2=335182&view=diff == --- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original) +++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Wed Jun 20 14:58:20 2018 @@ -2505,10 +2505,9 @@ bool Parser::ParseUnqualifiedId(CXXScope if (AllowConstructorName && Actions.isCurrentClassName(*Id, getCurScope(), &SS)) { // We have parsed a constructor name. - ParsedType Ty = Actions.getTypeName(*Id, IdLoc, getCurScope(), &SS, false, - false, nullptr, - /*IsCtorOrDtorName=*/true, - /*NonTrivialTypeSourceInfo=*/true); + ParsedType Ty = Actions.getConstructorName(*Id, IdLoc, getCurScope(), SS); + if (!Ty) +return true; Result.setConstructorName(Ty, IdLoc, IdLoc);
r335184 - Warning for framework headers using double quote includes
Author: bruno Date: Wed Jun 20 15:11:59 2018 New Revision: 335184 URL: http://llvm.org/viewvc/llvm-project?rev=335184&view=rev Log: Warning for framework headers using double quote includes Introduce -Wquoted-include-in-framework-header, which should fire a warning whenever a quote include appears in a framework header and suggest a fix-it. For instance, for header A.h added in the tests, this is how the warning looks like: ./A.framework/Headers/A.h:2:10: warning: double-quoted include "A0.h" in framework header, expected angle-bracketed instead [-Wquoted-include-in-framework-header] #include "A0.h" ^~ ./A.framework/Headers/A.h:3:10: warning: double-quoted include "B.h" in framework header, expected angle-bracketed instead [-Wquoted-include-in-framework-header] #include "B.h" ^ This helps users to prevent frameworks from using local headers when in fact they should be targetting system level ones. The warning is off by default. Differential Revision: https://reviews.llvm.org/D47157 rdar://problem/37077034 Added: cfe/trunk/test/Modules/Inputs/double-quotes/ cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/ cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Headers/ cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Headers/A.h cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Headers/A0.h cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Modules/ cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Modules/module.modulemap cfe/trunk/test/Modules/Inputs/double-quotes/B.h cfe/trunk/test/Modules/Inputs/double-quotes/X.framework/ cfe/trunk/test/Modules/Inputs/double-quotes/X.framework/Headers/ cfe/trunk/test/Modules/Inputs/double-quotes/X.framework/Headers/X.h cfe/trunk/test/Modules/Inputs/double-quotes/X.framework/Modules/ cfe/trunk/test/Modules/Inputs/double-quotes/X.framework/Modules/module.modulemap cfe/trunk/test/Modules/Inputs/double-quotes/a.hmap.json cfe/trunk/test/Modules/Inputs/double-quotes/flat-header-path/ cfe/trunk/test/Modules/Inputs/double-quotes/flat-header-path/Z.h cfe/trunk/test/Modules/Inputs/double-quotes/flat-header-path/Z.modulemap cfe/trunk/test/Modules/Inputs/double-quotes/x.hmap.json cfe/trunk/test/Modules/Inputs/double-quotes/z.yaml cfe/trunk/test/Modules/double-quotes.m Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td cfe/trunk/lib/Lex/HeaderSearch.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=335184&r1=335183&r2=335184&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Wed Jun 20 15:11:59 2018 @@ -31,6 +31,7 @@ def AutoDisableVptrSanitizer : DiagGroup def Availability : DiagGroup<"availability">; def Section : DiagGroup<"section">; def AutoImport : DiagGroup<"auto-import">; +def FrameworkHdrQuotedInclude : DiagGroup<"quoted-include-in-framework-header">; def CXX14BinaryLiteral : DiagGroup<"c++14-binary-literal">; def CXXPre14CompatBinaryLiteral : DiagGroup<"c++98-c++11-compat-binary-literal">; def GNUBinaryLiteral : DiagGroup<"gnu-binary-literal">; Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=335184&r1=335183&r2=335184&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Wed Jun 20 15:11:59 2018 @@ -714,6 +714,11 @@ def warn_mmap_redundant_export_as : Warn def err_mmap_submodule_export_as : Error< "only top-level modules can be re-exported as public">; +def warn_quoted_include_in_framework_header : Warning< + "double-quoted include \"%0\" in framework header, " + "expected angle-bracketed instead" + >, InGroup, DefaultIgnore; + def warn_auto_module_import : Warning< "treating #%select{include|import|include_next|__include_macros}0 as an " "import of module '%1'">, InGroup, DefaultIgnore; Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=335184&r1=335183&r2=335184&view=diff == --- cfe/trunk/lib/Lex/HeaderSearch.cpp (original) +++ cfe/trunk/lib/Lex/HeaderSearch.cpp Wed Jun 20 15:11:59 2018 @@ -621,6 +621,59 @@ static const char *copyString(StringRef return CopyStr; } +static bool isFrameworkStylePath(StringRef Path, + SmallVectorImpl &FrameworkName) { + using namespace llvm::sys; + path::const
[PATCH] D47157: Warning for framework headers using double quote includes
This revision was automatically updated to reflect the committed changes. Closed by commit rL335184: Warning for framework headers using double quote includes (authored by bruno, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D47157?vs=149359&id=152177#toc Repository: rL LLVM https://reviews.llvm.org/D47157 Files: cfe/trunk/include/clang/Basic/DiagnosticGroups.td cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td cfe/trunk/lib/Lex/HeaderSearch.cpp cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Headers/A.h cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Headers/A0.h cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Modules/module.modulemap cfe/trunk/test/Modules/Inputs/double-quotes/B.h cfe/trunk/test/Modules/Inputs/double-quotes/X.framework/Headers/X.h cfe/trunk/test/Modules/Inputs/double-quotes/X.framework/Modules/module.modulemap cfe/trunk/test/Modules/Inputs/double-quotes/a.hmap.json cfe/trunk/test/Modules/Inputs/double-quotes/flat-header-path/Z.h cfe/trunk/test/Modules/Inputs/double-quotes/flat-header-path/Z.modulemap cfe/trunk/test/Modules/Inputs/double-quotes/x.hmap.json cfe/trunk/test/Modules/Inputs/double-quotes/z.yaml cfe/trunk/test/Modules/double-quotes.m Index: cfe/trunk/test/Modules/Inputs/double-quotes/a.hmap.json === --- cfe/trunk/test/Modules/Inputs/double-quotes/a.hmap.json +++ cfe/trunk/test/Modules/Inputs/double-quotes/a.hmap.json @@ -0,0 +1,6 @@ +{ + "mappings" : +{ + "A.h" : "A/A.h" +} +} Index: cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Headers/A0.h === --- cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Headers/A0.h +++ cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Headers/A0.h @@ -0,0 +1 @@ +// double-quotes/A.framework/Headers/A0.h Index: cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Headers/A.h === --- cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Headers/A.h +++ cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Headers/A.h @@ -0,0 +1,6 @@ +#include "A0.h" +#include "B.h" + +#include "X.h" + +int foo(); Index: cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Modules/module.modulemap === --- cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Modules/module.modulemap +++ cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Modules/module.modulemap @@ -0,0 +1,5 @@ +// double-quotes/A.framework/Modules/module.modulemap +framework module A { + header "A.h" + header "A0.h" +} Index: cfe/trunk/test/Modules/Inputs/double-quotes/z.yaml === --- cfe/trunk/test/Modules/Inputs/double-quotes/z.yaml +++ cfe/trunk/test/Modules/Inputs/double-quotes/z.yaml @@ -0,0 +1,28 @@ +{ + 'version': 0, + 'case-sensitive': 'false', + 'roots': [ +{ + 'type': 'directory', + 'name': "TEST_DIR/Z.framework/Headers", + 'contents': [ +{ + 'type': 'file', + 'name': "Z.h", + 'external-contents': "TEST_DIR/flat-header-path/Z.h" +} + ] +}, +{ + 'type': 'directory', + 'name': "TEST_DIR/Z.framework/Modules", + 'contents': [ +{ + 'type': 'file', + 'name': "module.modulemap", + 'external-contents': "TEST_DIR/flat-header-path/Z.modulemap" +} + ] +} + ] +} Index: cfe/trunk/test/Modules/Inputs/double-quotes/B.h === --- cfe/trunk/test/Modules/Inputs/double-quotes/B.h +++ cfe/trunk/test/Modules/Inputs/double-quotes/B.h @@ -0,0 +1 @@ +// double-quotes/B.h Index: cfe/trunk/test/Modules/Inputs/double-quotes/flat-header-path/Z.h === --- cfe/trunk/test/Modules/Inputs/double-quotes/flat-header-path/Z.h +++ cfe/trunk/test/Modules/Inputs/double-quotes/flat-header-path/Z.h @@ -0,0 +1 @@ +#import "B.h" // Included from Z.h & A.h Index: cfe/trunk/test/Modules/Inputs/double-quotes/flat-header-path/Z.modulemap === --- cfe/trunk/test/Modules/Inputs/double-quotes/flat-header-path/Z.modulemap +++ cfe/trunk/test/Modules/Inputs/double-quotes/flat-header-path/Z.modulemap @@ -0,0 +1,4 @@ +// double-quotes/flat-header-path/Z.modulemap +framework module Z { + header "Z.h" +} Index: cfe/trunk/test/Modules/Inputs/double-quotes/x.hmap.json === --- cfe/trunk/test/Modules/Inputs/double-quotes/x.hmap.json +++ cfe/trunk/test/Modules/Inputs/double-quotes/x.hmap.json @@ -0,0 +1,7 @@ + +{ + "mappings" : +{ + "X.h" : "X/X.h" +} +} I
[PATCH] D48395: Added PublicOnly flag
juliehockett added a comment. Can you re-upload the patch with context? (i.e. use -U99 or similar) Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D48395 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47956: [MS] Consder constexpr globals to be inline, as in C++17
rnk added inline comments. Comment at: clang/lib/Sema/SemaDecl.cpp:6597 + (getLangOpts().CPlusPlus17 || + Context.getTargetInfo().getCXXABI().isMicrosoft())) NewVD->setImplicitlyInline(); thakis wrote: > Is this related to /Zc:externConstexpr / PR36413? If so, maybe we should do > the standards-conforming thing by default and ask people to pass > /Zc:externConstexpr- if they need ABI compat? > > Want to add a FIXME about doing this in the AST in the source too? The way I see it, doing the C++17 thing by default is in some ways more standards-conforming. We're opting people into the new rules earlier on this platform because we have to be ABI compatible with the other compiler. Also, I think this is unrelated to /Zc:externConstexpr: "By default, Visual Studio always gives a constexpr variable internal linkage, even if you specify the extern keyword." That's not what we're doing here. We're marking these things inline, which means they will be merged across TUs, as they would if the user explicitly added __declspec(selectany). https://reviews.llvm.org/D47956 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46485: Add python tool to dump and construct header maps
stella.stamenova added a comment. This breaks the clang tests on Windows when building using Visual Studio as none of the updated tests can find hmaptool. Visual Studio as a generator supports multiple configurations, so its bin folder varies depending on the build configuration. The generalized version of the bin directory is: ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin. This is actually the proper bin directory to use for any generator because ${CMAKE_CFG_INTDIR} is simply '.' when the generator (such as ninja) doesn't support multiple configurations. I can look into a fix and submit a change for review tomorrow if you can't, but in the future please make sure to use the full path to the bin directory (${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) to avoid missing a generator. Repository: rC Clang https://reviews.llvm.org/D46485 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D46485: Add python tool to dump and construct header maps
Hi Stella, On Wed, Jun 20, 2018 at 3:44 PM Stella Stamenova via Phabricator wrote: > > stella.stamenova added a comment. > > This breaks the clang tests on Windows when building using Visual Studio as > none of the updated tests can find hmaptool. Yes. I contacted Galina about that but maybe it was the wrong person to contact. > Visual Studio as a generator supports multiple configurations, so its bin > folder varies depending on the build configuration. The generalized version > of the bin directory is: ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin. This is > actually the proper bin directory to use for any generator because > ${CMAKE_CFG_INTDIR} is simply '.' when the generator (such as ninja) doesn't > support multiple configurations. Good to know. > I can look into a fix and submit a change for review tomorrow if you can't, > but in the future please make sure to use the full path to the bin directory > (${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) to avoid missing a generator. I'll try to fix it now. Thanks for the heads up! > > > Repository: > rC Clang > > https://reviews.llvm.org/D46485 > > > -- Bruno Cardoso Lopes http://www.brunocardoso.cc ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47956: [MS] Consder constexpr globals to be inline, as in C++17
rsmith added a comment. Can we now remove the corresponding MSVC-specific hacks elsewhere (eg, `ASTContext::isMSStaticDataMemberInlineDefinition`), or do we still need those for `const`-but-not-`constexpr` static data members? https://reviews.llvm.org/D47956 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r335189 - Use cast instead of dyn_cast_or_null.
Author: ahatanak Date: Wed Jun 20 15:56:59 2018 New Revision: 335189 URL: http://llvm.org/viewvc/llvm-project?rev=335189&view=rev Log: Use cast instead of dyn_cast_or_null. This addresses John's post-commit review feedback. https://reviews.llvm.org/rC335021#inline-2038 Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=335189&r1=335188&r2=335189&view=diff == --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original) +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Jun 20 15:56:59 2018 @@ -7832,7 +7832,7 @@ void Sema::ActOnFinishCXXMemberSpecifica reinterpret_cast(FieldCollector->getCurFields()), FieldCollector->getCurNumFields()), LBrac, RBrac, AttrList); - CheckCompletedCXXClass(dyn_cast_or_null(TagDecl)); + CheckCompletedCXXClass(cast(TagDecl)); } /// AddImplicitlyDeclaredMembersToClass - Adds any implicitly-declared ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r335190 - Fix hmaptool cmake file to work on Windows
Author: bruno Date: Wed Jun 20 16:08:43 2018 New Revision: 335190 URL: http://llvm.org/viewvc/llvm-project?rev=335190&view=rev Log: Fix hmaptool cmake file to work on Windows Unbreak a few windows buildbots: http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11315 http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10411/steps/test-check-all/logs/stdio Modified: cfe/trunk/utils/hmaptool/CMakeLists.txt Modified: cfe/trunk/utils/hmaptool/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/hmaptool/CMakeLists.txt?rev=335190&r1=335189&r2=335190&view=diff == --- cfe/trunk/utils/hmaptool/CMakeLists.txt (original) +++ cfe/trunk/utils/hmaptool/CMakeLists.txt Wed Jun 20 16:08:43 2018 @@ -1,14 +1,14 @@ set(CLANG_HMAPTOOL hmaptool) -add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/bin/${CLANG_HMAPTOOL} +add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL} COMMAND ${CMAKE_COMMAND} -E make_directory - ${CMAKE_BINARY_DIR}/bin + ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${CLANG_HMAPTOOL} - ${CMAKE_BINARY_DIR}/bin/ + ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${CLANG_HMAPTOOL}) -list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${CLANG_HMAPTOOL}) +list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL}) install(PROGRAMS ${CLANG_HMAPTOOL} DESTINATION bin) add_custom_target(hmaptool ALL DEPENDS ${Depends}) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D46485: Add python tool to dump and construct header maps
Attempted a fix in r335190, watching the bots. On Wed, Jun 20, 2018 at 3:53 PM Bruno Cardoso Lopes wrote: > > Hi Stella, > > On Wed, Jun 20, 2018 at 3:44 PM Stella Stamenova via Phabricator > wrote: > > > > stella.stamenova added a comment. > > > > This breaks the clang tests on Windows when building using Visual Studio as > > none of the updated tests can find hmaptool. > > Yes. I contacted Galina about that but maybe it was the wrong person > to contact. > > > Visual Studio as a generator supports multiple configurations, so its bin > > folder varies depending on the build configuration. The generalized version > > of the bin directory is: ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin. This > > is actually the proper bin directory to use for any generator because > > ${CMAKE_CFG_INTDIR} is simply '.' when the generator (such as ninja) > > doesn't support multiple configurations. > > Good to know. > > > I can look into a fix and submit a change for review tomorrow if you can't, > > but in the future please make sure to use the full path to the bin > > directory (${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) to avoid missing a > > generator. > > I'll try to fix it now. Thanks for the heads up! > > > > > > > Repository: > > rC Clang > > > > https://reviews.llvm.org/D46485 > > > > > > > > > -- > Bruno Cardoso Lopes > http://www.brunocardoso.cc -- Bruno Cardoso Lopes http://www.brunocardoso.cc ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47956: [MS] Consder constexpr globals to be inline, as in C++17
rnk added a comment. In https://reviews.llvm.org/D47956#1138521, @rsmith wrote: > Can we now remove the corresponding MSVC-specific hacks elsewhere (eg, > `ASTContext::isMSStaticDataMemberInlineDefinition`), or do we still need > those for `const`-but-not-`constexpr` static data members? We should be able to do that, but unfortunately it drastically changes the diagnostics we emit, as you can see from the tortured ifdefs in my test case updates. I gave up before attempting it. https://reviews.llvm.org/D47956 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47301: Warning for framework include violation from Headers to PrivateHeaders
bruno updated this revision to Diff 152198. bruno added a comment. Address Volodymyr's comments https://reviews.llvm.org/D47301 Files: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticLexKinds.td lib/Lex/HeaderSearch.cpp test/Modules/Inputs/framework-public-includes-private/A.framework/Headers/A.h test/Modules/Inputs/framework-public-includes-private/A.framework/Modules/module.modulemap test/Modules/Inputs/framework-public-includes-private/A.framework/Modules/module.private.modulemap test/Modules/Inputs/framework-public-includes-private/A.framework/PrivateHeaders/APriv.h test/Modules/Inputs/framework-public-includes-private/A.framework/PrivateHeaders/APriv2.h test/Modules/Inputs/framework-public-includes-private/a.hmap.json test/Modules/Inputs/framework-public-includes-private/flat-header-path/Z.h test/Modules/Inputs/framework-public-includes-private/flat-header-path/Z.modulemap test/Modules/Inputs/framework-public-includes-private/flat-header-path/Z.private.modulemap test/Modules/Inputs/framework-public-includes-private/flat-header-path/ZPriv.h test/Modules/Inputs/framework-public-includes-private/z.hmap.json test/Modules/Inputs/framework-public-includes-private/z.yaml test/Modules/framework-public-includes-private.m Index: test/Modules/framework-public-includes-private.m === --- /dev/null +++ test/Modules/framework-public-includes-private.m @@ -0,0 +1,37 @@ +// REQUIRES: shell + +// RUN: rm -rf %t +// RUN: mkdir %t + +// RUN: hmaptool write %S/Inputs/framework-public-includes-private/a.hmap.json %t/a.hmap +// RUN: hmaptool write %S/Inputs/framework-public-includes-private/z.hmap.json %t/z.hmap + +// RUN: sed -e "s:TEST_DIR:%S/Inputs/framework-public-includes-private:g" \ +// RUN: %S/Inputs/framework-public-includes-private/z.yaml > %t/z.yaml + +// The output with and without modules should be the same, without modules first. +// RUN: %clang_cc1 \ +// RUN: -iquote %t/z.hmap -iquote %t/a.hmap -ivfsoverlay %t/z.yaml \ +// RUN: -F%S/Inputs/framework-public-includes-private \ +// RUN: -fsyntax-only %s -verify + +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache \ +// RUN: -iquote %t/z.hmap -iquote %t/a.hmap -ivfsoverlay %t/z.yaml \ +// RUN: -F%S/Inputs/framework-public-includes-private \ +// RUN: -fsyntax-only %s \ +// RUN: 2>%t/stderr + +// The same warnings show up when modules is on but -verify doesn't get it +// because they only show up under the module A building context. +// RUN: FileCheck --input-file=%t/stderr %s +// CHECK: public framework header includes private framework header 'A/APriv.h' +// CHECK: public framework header includes private framework header 'A/APriv2.h' +// CHECK: public framework header includes private framework header 'Z/ZPriv.h' + +#import "A.h" + +int bar() { return foo(); } + +// expected-warning@Inputs/framework-public-includes-private/A.framework/Headers/A.h:2{{public framework header includes private framework header 'A/APriv.h'}} +// expected-warning@Inputs/framework-public-includes-private/A.framework/Headers/A.h:3{{public framework header includes private framework header 'A/APriv2.h'}} +// expected-warning@Inputs/framework-public-includes-private/flat-header-path/Z.h:1{{public framework header includes private framework header 'Z/ZPriv.h'}} Index: test/Modules/Inputs/framework-public-includes-private/z.yaml === --- /dev/null +++ test/Modules/Inputs/framework-public-includes-private/z.yaml @@ -0,0 +1,45 @@ +{ + 'version': 0, + 'case-sensitive': 'false', + 'use-external-names' : 'false', + 'roots': [ +{ + 'type': 'directory', + 'name': "TEST_DIR/Z.framework/Headers", + 'contents': [ +{ + 'type': 'file', + 'name': "Z.h", + 'external-contents': "TEST_DIR/flat-header-path/Z.h" +} + ] +}, +{ + 'type': 'directory', + 'name': "TEST_DIR/Z.framework/PrivateHeaders", + 'contents': [ +{ + 'type': 'file', + 'name': "ZPriv.h", + 'external-contents': "TEST_DIR/flat-header-path/ZPriv.h" +} + ] +}, +{ + 'type': 'directory', + 'name': "TEST_DIR/Z.framework/Modules", + 'contents': [ +{ + 'type': 'file', + 'name': "module.modulemap", + 'external-contents': "TEST_DIR/flat-header-path/Z.modulemap" +}, +{ + 'type': 'file', + 'name': "module.private.modulemap", + 'external-contents': "TEST_DIR/flat-header-path/Z.private.modulemap" +} + ] +} + ] +} Index: test/Modules/Inputs/framework-public-includes-private/z.hmap.json === --- /dev/null +++ test/Modules/Inputs/framework-public-includes-private/z.hmap.json @@ -0,0 +1,7 @@ + +{ + "mapping
r335191 - When a dependent alignas is applied to a non-dependent typedef,
Author: rsmith Date: Wed Jun 20 16:36:55 2018 New Revision: 335191 URL: http://llvm.org/viewvc/llvm-project?rev=335191&view=rev Log: When a dependent alignas is applied to a non-dependent typedef, prioritize the error for the bad subject over the error for the dependent / non-dependent mismatch. Added: cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.align/p1.cpp Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=335191&r1=335190&r2=335191&view=diff == --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original) +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Wed Jun 20 16:36:55 2018 @@ -3440,16 +3440,6 @@ static void handleAlignedAttr(Sema &S, D if (!AL.isPackExpansion() && S.DiagnoseUnexpandedParameterPack(E)) return; - if (E->isValueDependent()) { -if (const auto *TND = dyn_cast(D)) { - if (!TND->getUnderlyingType()->isDependentType()) { -S.Diag(AL.getLoc(), diag::err_alignment_dependent_typedef_name) -<< E->getSourceRange(); -return; - } -} - } - S.AddAlignedAttr(AL.getRange(), D, E, AL.getAttributeSpellingListIndex(), AL.isPackExpansion()); } @@ -3496,7 +3486,18 @@ void Sema::AddAlignedAttr(SourceRange At } } - if (E->isTypeDependent() || E->isValueDependent()) { + if (E->isValueDependent()) { +// We can't support a dependent alignment on a non-dependent type, +// because we have no way to model that a type is "alignment-dependent" +// but not dependent in any other way. +if (const auto *TND = dyn_cast(D)) { + if (!TND->getUnderlyingType()->isDependentType()) { +Diag(AttrLoc, diag::err_alignment_dependent_typedef_name) +<< E->getSourceRange(); +return; + } +} + // Save dependent expressions in the AST to be instantiated. AlignedAttr *AA = ::new (Context) AlignedAttr(TmpAttr); AA->setPackExpansion(IsPackExpansion); Added: cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.align/p1.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.align/p1.cpp?rev=335191&view=auto == --- cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.align/p1.cpp (added) +++ cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.align/p1.cpp Wed Jun 20 16:36:55 2018 @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -std=c++11 -verify %s + +typedef int A alignas(4); // expected-error {{'alignas' attribute only applies to variables, data members and tag types}} +template void f() { + typedef int B alignas(N); // expected-error {{'alignas' attribute only applies to variables, data members and tag types}} +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r335193 - ASan docs: no_sanitize("address") works on globals.
Author: eugenis Date: Wed Jun 20 17:16:32 2018 New Revision: 335193 URL: http://llvm.org/viewvc/llvm-project?rev=335193&view=rev Log: ASan docs: no_sanitize("address") works on globals. Summary: Mention that no_sanitize attribute can be used with globals. Reviewers: alekseyshl Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48390 Modified: cfe/trunk/docs/AddressSanitizer.rst cfe/trunk/include/clang/Basic/AttrDocs.td Modified: cfe/trunk/docs/AddressSanitizer.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/AddressSanitizer.rst?rev=335193&r1=335192&r2=335193&view=diff == --- cfe/trunk/docs/AddressSanitizer.rst (original) +++ cfe/trunk/docs/AddressSanitizer.rst Wed Jun 20 17:16:32 2018 @@ -197,13 +197,17 @@ this purpose. Disabling Instrumentation with ``__attribute__((no_sanitize("address")))`` -- -Some code should not be instrumented by AddressSanitizer. One may use the -function attribute ``__attribute__((no_sanitize("address")))`` (which has -deprecated synonyms `no_sanitize_address` and `no_address_safety_analysis`) to -disable instrumentation of a particular function. This attribute may not be -supported by other compilers, so we suggest to use it together with +Some code should not be instrumented by AddressSanitizer. One may use +the attribute ``__attribute__((no_sanitize("address")))`` (which has +deprecated synonyms `no_sanitize_address` and +`no_address_safety_analysis`) to disable instrumentation of a +particular function. This attribute may not be supported by other +compilers, so we suggest to use it together with ``__has_feature(address_sanitizer)``. +The same attribute used on a global variable prevents AddressSanitizer +from adding redzones around it and detecting out of bounds accesses. + Suppressing Errors in Recompiled Code (Blacklist) - Modified: cfe/trunk/include/clang/Basic/AttrDocs.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=335193&r1=335192&r2=335193&view=diff == --- cfe/trunk/include/clang/Basic/AttrDocs.td (original) +++ cfe/trunk/include/clang/Basic/AttrDocs.td Wed Jun 20 17:16:32 2018 @@ -1804,13 +1804,14 @@ This attribute accepts a single paramete def NoSanitizeDocs : Documentation { let Category = DocCatFunction; let Content = [{ -Use the ``no_sanitize`` attribute on a function declaration to specify -that a particular instrumentation or set of instrumentations should not be -applied to that function. The attribute takes a list of string literals, -which have the same meaning as values accepted by the ``-fno-sanitize=`` -flag. For example, ``__attribute__((no_sanitize("address", "thread")))`` -specifies that AddressSanitizer and ThreadSanitizer should not be applied -to the function. +Use the ``no_sanitize`` attribute on a function or a global variable +declaration to specify that a particular instrumentation or set of +instrumentations should not be applied. The attribute takes a list of +string literals, which have the same meaning as values accepted by the +``-fno-sanitize=`` flag. For example, +``__attribute__((no_sanitize("address", "thread")))`` specifies that +AddressSanitizer and ThreadSanitizer should not be applied to the +function or variable. See :ref:`Controlling Code Generation ` for a full list of supported sanitizer flags. @@ -1825,9 +1826,9 @@ def NoSanitizeAddressDocs : Documentatio let Content = [{ .. _langext-address_sanitizer: -Use ``__attribute__((no_sanitize_address))`` on a function declaration to -specify that address safety instrumentation (e.g. AddressSanitizer) should -not be applied to that function. +Use ``__attribute__((no_sanitize_address))`` on a function or a global +variable declaration to specify that address safety instrumentation +(e.g. AddressSanitizer) should not be applied. }]; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48390: ASan docs: no_sanitize("address") works on globals.
This revision was automatically updated to reflect the committed changes. Closed by commit rC335193: ASan docs: no_sanitize("address") works on globals. (authored by eugenis, committed by ). Changed prior to commit: https://reviews.llvm.org/D48390?vs=152140&id=152204#toc Repository: rC Clang https://reviews.llvm.org/D48390 Files: docs/AddressSanitizer.rst include/clang/Basic/AttrDocs.td Index: docs/AddressSanitizer.rst === --- docs/AddressSanitizer.rst +++ docs/AddressSanitizer.rst @@ -197,13 +197,17 @@ Disabling Instrumentation with ``__attribute__((no_sanitize("address")))`` -- -Some code should not be instrumented by AddressSanitizer. One may use the -function attribute ``__attribute__((no_sanitize("address")))`` (which has -deprecated synonyms `no_sanitize_address` and `no_address_safety_analysis`) to -disable instrumentation of a particular function. This attribute may not be -supported by other compilers, so we suggest to use it together with +Some code should not be instrumented by AddressSanitizer. One may use +the attribute ``__attribute__((no_sanitize("address")))`` (which has +deprecated synonyms `no_sanitize_address` and +`no_address_safety_analysis`) to disable instrumentation of a +particular function. This attribute may not be supported by other +compilers, so we suggest to use it together with ``__has_feature(address_sanitizer)``. +The same attribute used on a global variable prevents AddressSanitizer +from adding redzones around it and detecting out of bounds accesses. + Suppressing Errors in Recompiled Code (Blacklist) - Index: include/clang/Basic/AttrDocs.td === --- include/clang/Basic/AttrDocs.td +++ include/clang/Basic/AttrDocs.td @@ -1804,13 +1804,14 @@ def NoSanitizeDocs : Documentation { let Category = DocCatFunction; let Content = [{ -Use the ``no_sanitize`` attribute on a function declaration to specify -that a particular instrumentation or set of instrumentations should not be -applied to that function. The attribute takes a list of string literals, -which have the same meaning as values accepted by the ``-fno-sanitize=`` -flag. For example, ``__attribute__((no_sanitize("address", "thread")))`` -specifies that AddressSanitizer and ThreadSanitizer should not be applied -to the function. +Use the ``no_sanitize`` attribute on a function or a global variable +declaration to specify that a particular instrumentation or set of +instrumentations should not be applied. The attribute takes a list of +string literals, which have the same meaning as values accepted by the +``-fno-sanitize=`` flag. For example, +``__attribute__((no_sanitize("address", "thread")))`` specifies that +AddressSanitizer and ThreadSanitizer should not be applied to the +function or variable. See :ref:`Controlling Code Generation ` for a full list of supported sanitizer flags. @@ -1825,9 +1826,9 @@ let Content = [{ .. _langext-address_sanitizer: -Use ``__attribute__((no_sanitize_address))`` on a function declaration to -specify that address safety instrumentation (e.g. AddressSanitizer) should -not be applied to that function. +Use ``__attribute__((no_sanitize_address))`` on a function or a global +variable declaration to specify that address safety instrumentation +(e.g. AddressSanitizer) should not be applied. }]; } Index: docs/AddressSanitizer.rst === --- docs/AddressSanitizer.rst +++ docs/AddressSanitizer.rst @@ -197,13 +197,17 @@ Disabling Instrumentation with ``__attribute__((no_sanitize("address")))`` -- -Some code should not be instrumented by AddressSanitizer. One may use the -function attribute ``__attribute__((no_sanitize("address")))`` (which has -deprecated synonyms `no_sanitize_address` and `no_address_safety_analysis`) to -disable instrumentation of a particular function. This attribute may not be -supported by other compilers, so we suggest to use it together with +Some code should not be instrumented by AddressSanitizer. One may use +the attribute ``__attribute__((no_sanitize("address")))`` (which has +deprecated synonyms `no_sanitize_address` and +`no_address_safety_analysis`) to disable instrumentation of a +particular function. This attribute may not be supported by other +compilers, so we suggest to use it together with ``__has_feature(address_sanitizer)``. +The same attribute used on a global variable prevents AddressSanitizer +from adding redzones around it and detecting out of bounds accesses. + Suppressing Errors in Recompiled Code (Blacklist) - Index: include/clang/Basic/AttrDocs.td ===
Re: [PATCH] D46485: Add python tool to dump and construct header maps
On Wed, Jun 20, 2018 at 5:42 PM Stella Stamenova wrote: > > Thanks Bruno, > > I ran a build as well and I can see that hmaptool is now in the correct bin > directory. The tests still failed though because on Windows, at least, you > need to explicitly call python to run a script e.g. "python hmaptool". > > There are a few tests in LLVM that do that, for example: > > ; RUN: %python -c "print(' ' * 65536)" > %t.cache/llvmcache-foo > > I am not sure whether you can simply call python on hmaptool or if you would > have to include the fullpath to it though. Oh, I see. I'll revert the commits while I find a solution for this. Any chance you can give it a try before I re-commit if I send you an updated patch? Thanks, -- Bruno Cardoso Lopes http://www.brunocardoso.cc ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r335194 - Revert "Fix hmaptool cmake file to work on Windows"
Author: bruno Date: Wed Jun 20 18:23:42 2018 New Revision: 335194 URL: http://llvm.org/viewvc/llvm-project?rev=335194&view=rev Log: Revert "Fix hmaptool cmake file to work on Windows" This reverts commit 63711c3cd337a0d22617579a904af07481139611, due to breaking bots: http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11315 http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10411/steps/test-check-all/logs/stdio Modified: cfe/trunk/utils/hmaptool/CMakeLists.txt Modified: cfe/trunk/utils/hmaptool/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/hmaptool/CMakeLists.txt?rev=335194&r1=335193&r2=335194&view=diff == --- cfe/trunk/utils/hmaptool/CMakeLists.txt (original) +++ cfe/trunk/utils/hmaptool/CMakeLists.txt Wed Jun 20 18:23:42 2018 @@ -1,14 +1,14 @@ set(CLANG_HMAPTOOL hmaptool) -add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL} +add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/bin/${CLANG_HMAPTOOL} COMMAND ${CMAKE_COMMAND} -E make_directory - ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin + ${CMAKE_BINARY_DIR}/bin COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${CLANG_HMAPTOOL} - ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/ + ${CMAKE_BINARY_DIR}/bin/ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${CLANG_HMAPTOOL}) -list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL}) +list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${CLANG_HMAPTOOL}) install(PROGRAMS ${CLANG_HMAPTOOL} DESTINATION bin) add_custom_target(hmaptool ALL DEPENDS ${Depends}) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r335195 - Revert "Warning for framework headers using double quote includes"
Author: bruno Date: Wed Jun 20 18:23:51 2018 New Revision: 335195 URL: http://llvm.org/viewvc/llvm-project?rev=335195&view=rev Log: Revert "Warning for framework headers using double quote includes" This reverts commit 9b5ff2db7e31c4bb11a7d468260b068b41c7c285. Broke bots: http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11315 http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10411/steps/test-check-all/logs/stdio Removed: cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Headers/A.h cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Headers/A0.h cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Modules/module.modulemap cfe/trunk/test/Modules/Inputs/double-quotes/B.h cfe/trunk/test/Modules/Inputs/double-quotes/X.framework/Headers/X.h cfe/trunk/test/Modules/Inputs/double-quotes/X.framework/Modules/module.modulemap cfe/trunk/test/Modules/Inputs/double-quotes/a.hmap.json cfe/trunk/test/Modules/Inputs/double-quotes/flat-header-path/Z.h cfe/trunk/test/Modules/Inputs/double-quotes/flat-header-path/Z.modulemap cfe/trunk/test/Modules/Inputs/double-quotes/x.hmap.json cfe/trunk/test/Modules/Inputs/double-quotes/z.yaml cfe/trunk/test/Modules/double-quotes.m Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td cfe/trunk/lib/Lex/HeaderSearch.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=335195&r1=335194&r2=335195&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Wed Jun 20 18:23:51 2018 @@ -31,7 +31,6 @@ def AutoDisableVptrSanitizer : DiagGroup def Availability : DiagGroup<"availability">; def Section : DiagGroup<"section">; def AutoImport : DiagGroup<"auto-import">; -def FrameworkHdrQuotedInclude : DiagGroup<"quoted-include-in-framework-header">; def CXX14BinaryLiteral : DiagGroup<"c++14-binary-literal">; def CXXPre14CompatBinaryLiteral : DiagGroup<"c++98-c++11-compat-binary-literal">; def GNUBinaryLiteral : DiagGroup<"gnu-binary-literal">; Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=335195&r1=335194&r2=335195&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Wed Jun 20 18:23:51 2018 @@ -714,11 +714,6 @@ def warn_mmap_redundant_export_as : Warn def err_mmap_submodule_export_as : Error< "only top-level modules can be re-exported as public">; -def warn_quoted_include_in_framework_header : Warning< - "double-quoted include \"%0\" in framework header, " - "expected angle-bracketed instead" - >, InGroup, DefaultIgnore; - def warn_auto_module_import : Warning< "treating #%select{include|import|include_next|__include_macros}0 as an " "import of module '%1'">, InGroup, DefaultIgnore; Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=335195&r1=335194&r2=335195&view=diff == --- cfe/trunk/lib/Lex/HeaderSearch.cpp (original) +++ cfe/trunk/lib/Lex/HeaderSearch.cpp Wed Jun 20 18:23:51 2018 @@ -621,59 +621,6 @@ static const char *copyString(StringRef return CopyStr; } -static bool isFrameworkStylePath(StringRef Path, - SmallVectorImpl &FrameworkName) { - using namespace llvm::sys; - path::const_iterator I = path::begin(Path); - path::const_iterator E = path::end(Path); - - // Detect different types of framework style paths: - // - // ...Foo.framework/{Headers,PrivateHeaders} - // ...Foo.framework/Versions/{A,Current}/{Headers,PrivateHeaders} - // ...Foo.framework/Frameworks/Nested.framework/{Headers,PrivateHeaders} - // ... - // - // and some other variations among these lines. - int FoundComp = 0; - while (I != E) { -if (I->endswith(".framework")) { - FrameworkName.append(I->begin(), I->end()); - ++FoundComp; -} -if (*I == "Headers" || *I == "PrivateHeaders") - ++FoundComp; -++I; - } - - return FoundComp >= 2; -} - -static void -diagnoseFrameworkInclude(DiagnosticsEngine &Diags, SourceLocation IncludeLoc, - StringRef Includer, StringRef IncludeFilename, - const FileEntry *IncludeFE, bool isAngled = false, - bool FoundByHeaderMap = false) { - SmallString<128> FromFramework, ToFramework; - if (!isFrameworkStylePath(Includer, FromFramework)) -return; - bool IsIncludeeInFr
r335196 - Revert "Add python tool to dump and construct header maps"
Author: bruno Date: Wed Jun 20 18:23:58 2018 New Revision: 335196 URL: http://llvm.org/viewvc/llvm-project?rev=335196&view=rev Log: Revert "Add python tool to dump and construct header maps" This reverts commit fcfa2dd517ec1a6045a81e8247e346d630a22618. Broke bots: http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11315 http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10411/steps/test-check-all/logs/stdio Added: cfe/trunk/test/Preprocessor/Inputs/headermap-rel/foo.hmap cfe/trunk/test/Preprocessor/Inputs/headermap-rel2/project-headers.hmap cfe/trunk/test/Preprocessor/Inputs/nonportable-hmaps/foo.hmap Removed: cfe/trunk/test/Preprocessor/Inputs/headermap-rel/foo.hmap.json cfe/trunk/test/Preprocessor/Inputs/headermap-rel2/project-headers.hmap.json cfe/trunk/test/Preprocessor/Inputs/nonportable-hmaps/foo.hmap.json cfe/trunk/utils/hmaptool/CMakeLists.txt cfe/trunk/utils/hmaptool/hmaptool Modified: cfe/trunk/CMakeLists.txt cfe/trunk/test/CMakeLists.txt cfe/trunk/test/Modules/crash-vfs-headermaps.m cfe/trunk/test/Preprocessor/headermap-rel.c cfe/trunk/test/Preprocessor/headermap-rel2.c cfe/trunk/test/Preprocessor/nonportable-include-with-hmap.c Modified: cfe/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=335196&r1=335195&r2=335196&view=diff == --- cfe/trunk/CMakeLists.txt (original) +++ cfe/trunk/CMakeLists.txt Wed Jun 20 18:23:58 2018 @@ -753,7 +753,6 @@ endif() if (LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION) add_subdirectory(utils/ClangVisualizers) endif() -add_subdirectory(utils/hmaptool) configure_file( ${CLANG_SOURCE_DIR}/include/clang/Config/config.h.cmake Modified: cfe/trunk/test/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CMakeLists.txt?rev=335196&r1=335195&r2=335196&view=diff == --- cfe/trunk/test/CMakeLists.txt (original) +++ cfe/trunk/test/CMakeLists.txt Wed Jun 20 18:23:58 2018 @@ -54,7 +54,6 @@ list(APPEND CLANG_TEST_DEPS clang-rename clang-refactor clang-diff - hmaptool ) if(CLANG_ENABLE_STATIC_ANALYZER) Modified: cfe/trunk/test/Modules/crash-vfs-headermaps.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/crash-vfs-headermaps.m?rev=335196&r1=335195&r2=335196&view=diff == --- cfe/trunk/test/Modules/crash-vfs-headermaps.m (original) +++ cfe/trunk/test/Modules/crash-vfs-headermaps.m Wed Jun 20 18:23:58 2018 @@ -1,9 +1,15 @@ // REQUIRES: crash-recovery, shell, system-darwin +// This uses a headermap with this entry: +// Foo.h -> Foo/Foo.h + +// Copy out the headermap from test/Preprocessor/Inputs/headermap-rel and avoid +// adding another binary format to the repository. + // RUN: rm -rf %t -// RUN: mkdir -p %t/m %t/i/Foo.framework/Headers +// RUN: mkdir -p %t/m +// RUN: cp -a %S/../Preprocessor/Inputs/headermap-rel %t/i // RUN: echo '// Foo.h' > %t/i/Foo.framework/Headers/Foo.h -// RUN: hmaptool write %S/../Preprocessor/Inputs/headermap-rel/foo.hmap.json %t/i/foo.hmap // RUN: not env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \ // RUN: %clang -fsyntax-only -fmodules -fmodules-cache-path=%t/m %s \ Added: cfe/trunk/test/Preprocessor/Inputs/headermap-rel/foo.hmap URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/Inputs/headermap-rel/foo.hmap?rev=335196&view=auto == Binary files cfe/trunk/test/Preprocessor/Inputs/headermap-rel/foo.hmap (added) and cfe/trunk/test/Preprocessor/Inputs/headermap-rel/foo.hmap Wed Jun 20 18:23:58 2018 differ Removed: cfe/trunk/test/Preprocessor/Inputs/headermap-rel/foo.hmap.json URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/Inputs/headermap-rel/foo.hmap.json?rev=335195&view=auto == --- cfe/trunk/test/Preprocessor/Inputs/headermap-rel/foo.hmap.json (original) +++ cfe/trunk/test/Preprocessor/Inputs/headermap-rel/foo.hmap.json (removed) @@ -1,6 +0,0 @@ -{ - "mappings" : -{ - "Foo.h" : "Foo/Foo.h" -} -} Added: cfe/trunk/test/Preprocessor/Inputs/headermap-rel2/project-headers.hmap URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/Inputs/headermap-rel2/project-headers.hmap?rev=335196&view=auto == Binary files cfe/trunk/test/Preprocessor/Inputs/headermap-rel2/project-headers.hmap (added) and cfe/trunk/test/Preprocessor/Inputs/headermap-rel2/project-headers.hmap Wed Jun 20 18:23:58 2018 differ Removed: cfe/trunk/test/Preprocessor/Inputs/headermap-rel2/project-headers.hmap.json URL: http://llvm.org/viewvc/llvm-
RE: [PATCH] D46485: Add python tool to dump and construct header maps
Thanks Bruno, I ran a build as well and I can see that hmaptool is now in the correct bin directory. The tests still failed though because on Windows, at least, you need to explicitly call python to run a script e.g. "python hmaptool". There are a few tests in LLVM that do that, for example: ; RUN: %python -c "print(' ' * 65536)" > %t.cache/llvmcache-foo I am not sure whether you can simply call python on hmaptool or if you would have to include the fullpath to it though. Thanks, -Stella -Original Message- From: Bruno Cardoso Lopes Sent: Wednesday, June 20, 2018 4:14 PM To: Stella Stamenova Cc: Richard Smith ; Duncan Exon Smith ; jkor...@apple.com; mgo...@gentoo.org; cfe-commits Subject: Re: [PATCH] D46485: Add python tool to dump and construct header maps Attempted a fix in r335190, watching the bots. On Wed, Jun 20, 2018 at 3:53 PM Bruno Cardoso Lopes wrote: > > Hi Stella, > > On Wed, Jun 20, 2018 at 3:44 PM Stella Stamenova via Phabricator > wrote: > > > > stella.stamenova added a comment. > > > > This breaks the clang tests on Windows when building using Visual Studio as > > none of the updated tests can find hmaptool. > > Yes. I contacted Galina about that but maybe it was the wrong person > to contact. > > > Visual Studio as a generator supports multiple configurations, so its bin > > folder varies depending on the build configuration. The generalized version > > of the bin directory is: ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin. This > > is actually the proper bin directory to use for any generator because > > ${CMAKE_CFG_INTDIR} is simply '.' when the generator (such as ninja) > > doesn't support multiple configurations. > > Good to know. > > > I can look into a fix and submit a change for review tomorrow if you can't, > > but in the future please make sure to use the full path to the bin > > directory (${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) to avoid missing a > > generator. > > I'll try to fix it now. Thanks for the heads up! > > > > > > > Repository: > > rC Clang > > > > https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Frev > > iews.llvm.org%2FD46485&data=02%7C01%7CSTILIS%40microsoft.com%7C83fc2 > > 84426aa4e51e2d908d5d70387cc%7C72f988bf86f141af91ab2d7cd011db47%7C1%7 > > C1%7C636651332530245571&sdata=yGlv3J3wsuEvQGDd3b7Kq8FU3dMqORS4eH8a%2 > > BL3ikzk%3D&reserved=0 > > > > > > > > > -- > Bruno Cardoso Lopes > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.br > unocardoso.cc&data=02%7C01%7CSTILIS%40microsoft.com%7C83fc284426aa4e51 > e2d908d5d70387cc%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C63665133 > 2530245571&sdata=KwMaPuOYjHXndEiYOBVZY29vefhR3poMegBV4HCPaxk%3D&reserv > ed=0 -- Bruno Cardoso Lopes https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.brunocardoso.cc&data=02%7C01%7CSTILIS%40microsoft.com%7C83fc284426aa4e51e2d908d5d70387cc%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C636651332530245571&sdata=KwMaPuOYjHXndEiYOBVZY29vefhR3poMegBV4HCPaxk%3D&reserved=0 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D46485: Add python tool to dump and construct header maps
Yes, I can try it out. Feel free to add me to the review as well. From: Bruno Cardoso Lopes Sent: Wednesday, June 20, 2018 6:25 PM To: Stella Stamenova Cc: Richard Smith; Duncan Exon Smith; jkor...@apple.com; Michał Górny; cfe-commits Subject: Re: [PATCH] D46485: Add python tool to dump and construct header maps On Wed, Jun 20, 2018 at 5:42 PM Stella Stamenova wrote: > > Thanks Bruno, > > I ran a build as well and I can see that hmaptool is now in the correct bin > directory. The tests still failed though because on Windows, at least, you > need to explicitly call python to run a script e.g. "python hmaptool". > > There are a few tests in LLVM that do that, for example: > > ; RUN: %python -c "print(' ' * 65536)" > %t.cache/llvmcache-foo > > I am not sure whether you can simply call python on hmaptool or if you would > have to include the fullpath to it though. Oh, I see. I'll revert the commits while I find a solution for this. Any chance you can give it a try before I re-commit if I send you an updated patch? Thanks, -- Bruno Cardoso Lopes https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.brunocardoso.cc&data=02%7C01%7Cstilis%40microsoft.com%7C9a3d5b51b26c4ff1a8db08d5d715df88%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636651411307060645&sdata=2EamqaQFSd35ZIqp%2Ft9TxAUZYoeDg8NkD47VaERkoG8%3D&reserved=0 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48412: [RISCV] Support for __attribute__((interrupt))
apazos created this revision. apazos added a reviewer: asb. Herald added subscribers: rogfer01, mgrang, edward-jones, zzheng, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar. Clang supports the GNU style ``__attribute__((interrupt))`` attribute on RISCV targets. Permissible values for this parameter are user, supervisor, and machine. If there is no parameter, then it defaults to machine. Reference: https://gcc.gnu.org/onlinedocs/gcc/RISC-V-Function-Attributes.html https://reviews.llvm.org/D48412 Files: include/clang/Basic/Attr.td include/clang/Basic/AttrDocs.td include/clang/Basic/DiagnosticSemaKinds.td lib/CodeGen/TargetInfo.cpp lib/Sema/SemaDeclAttr.cpp test/Sema/riscv-interrupt-attr.c Index: test/Sema/riscv-interrupt-attr.c === --- /dev/null +++ test/Sema/riscv-interrupt-attr.c @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 %s -triple riscv32-unknown-elf -verify -fsyntax-only +// RUN: %clang_cc1 %s -triple riscv64-unknown-elf -verify -fsyntax-only + +struct a { int b; }; + +struct a test __attribute__((interrupt)); // expected-warning {{'interrupt' attribute only applies to functions}} + +__attribute__((interrupt("USER"))) void foo1() {} // expected-warning {{'interrupt' attribute argument not supported: USER}} + +__attribute__((interrupt("user", 1))) void foo2() {} // expected-error {{'interrupt' attribute takes no more than 1 argument}} + +__attribute__((interrupt)) int foo3() {return 0;} // expected-warning {{RISC-V 'interrupt' attribute only applies to functions that have a 'void' return type}} + +__attribute__((interrupt())) int foo4(void) { } // expected-warning {{RISC-V 'interrupt' attribute only applies to functions that have a 'void' return type}} + +__attribute__((interrupt())) void foo5(int a) { } // expected-warning {{RISC-V 'interrupt' attribute only applies to functions that have no parameters}} + +__attribute__((interrupt("user"))) void foo6() {} +__attribute__((interrupt("supervisor"))) void foo7() {} +__attribute__((interrupt("machine"))) void foo8() {} +__attribute__((interrupt(""))) void foo9() {} +__attribute__((interrupt())) void foo10() {} +__attribute__((interrupt)) void foo11() {} + Index: lib/Sema/SemaDeclAttr.cpp === --- lib/Sema/SemaDeclAttr.cpp +++ lib/Sema/SemaDeclAttr.cpp @@ -5266,6 +5266,60 @@ handleSimpleAttribute(S, D, AL); } +static void handleRISCVInterruptAttr(Sema &S, Decl *D, + const AttributeList &AL) { + // Check the attribute arguments. + if (AL.getNumArgs() > 1) { +S.Diag(AL.getLoc(), diag::err_attribute_too_many_arguments) + << AL.getName() << 1; +return; + } + + StringRef Str; + SourceLocation ArgLoc; + + if (AL.getNumArgs() == 0) +Str = ""; + else if (!S.checkStringLiteralArgumentAttr(AL, 0, Str, &ArgLoc)) +return; + + // Semantic checks for a function with the 'interrupt' attribute: + // - Must be a function. + // - Must have no parameters. + // - Must have the 'void' return type. + // - The attribute itself must either have no argument or one of the + // valid interrupt types, see [RISCVInterruptDocs]. + + if (!isFunctionOrMethod(D)) { +S.Diag(D->getLocation(), diag::warn_attribute_wrong_decl_type) +<< "'interrupt'" << ExpectedFunction; +return; + } + + if (hasFunctionProto(D) && getFunctionOrMethodNumParams(D) != 0) { +S.Diag(D->getLocation(), diag::warn_riscv_interrupt_attribute) +<< 0; +return; + } + + if (!getFunctionOrMethodResultType(D)->isVoidType()) { +S.Diag(D->getLocation(), diag::warn_riscv_interrupt_attribute) +<< 1; +return; + } + + RISCVInterruptAttr::InterruptType Kind; + if (!RISCVInterruptAttr::ConvertStrToInterruptType(Str, Kind)) { +S.Diag(AL.getLoc(), diag::warn_attribute_type_not_supported) + << AL.getName() << Str << ArgLoc; +return; + } + + D->addAttr(::new (S.Context) RISCVInterruptAttr( +AL.getLoc(), S.Context, Kind, AL.getAttributeSpellingListIndex())); + +} + static void handleInterruptAttr(Sema &S, Decl *D, const AttributeList &AL) { // Dispatch the interrupt attribute based on the current target. switch (S.Context.getTargetInfo().getTriple().getArch()) { @@ -5283,6 +5337,10 @@ case llvm::Triple::avr: handleAVRInterruptAttr(S, D, AL); break; + case llvm::Triple::riscv32: + case llvm::Triple::riscv64: +handleRISCVInterruptAttr(S, D, AL); +break; default: handleARMInterruptAttr(S, D, AL); break; Index: lib/CodeGen/TargetInfo.cpp === --- lib/CodeGen/TargetInfo.cpp +++ lib/CodeGen/TargetInfo.cpp @@ -8957,6 +8957,27 @@ public: RISCVTargetCodeGenInfo(CodeGen::CodeGenTypes &CGT, unsigned XLen) : TargetCodeGenInfo(new RISCVABIInfo(CGT, XLen)) {} + + void setTargetAttributes(const Decl *D, llvm::GlobalValue *GV, +
Re: [PATCH] D46485: Add python tool to dump and construct header maps
I can give it a try as well. Thanks Galina On Wed, Jun 20, 2018 at 6:30 PM, Stella Stamenova via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Yes, I can try it out. Feel free to add me to the review as well. > > -- > *From:* Bruno Cardoso Lopes > *Sent:* Wednesday, June 20, 2018 6:25 PM > *To:* Stella Stamenova > *Cc:* Richard Smith; Duncan Exon Smith; jkor...@apple.com; Michał Górny; > cfe-commits > *Subject:* Re: [PATCH] D46485: Add python tool to dump and construct > header maps > > On Wed, Jun 20, 2018 at 5:42 PM Stella Stamenova > wrote: > > > > Thanks Bruno, > > > > I ran a build as well and I can see that hmaptool is now in the correct > bin directory. The tests still failed though because on Windows, at least, > you need to explicitly call python to run a script e.g. "python hmaptool". > > > > There are a few tests in LLVM that do that, for example: > > > > ; RUN: %python -c "print(' ' * 65536)" > %t.cache/llvmcache-foo > > > > I am not sure whether you can simply call python on hmaptool or if you > would have to include the fullpath to it though. > > Oh, I see. I'll revert the commits while I find a solution for this. > Any chance you can give it a try before I re-commit if I send you an > updated patch? > > Thanks, > > -- > Bruno Cardoso Lopes > https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fwww.brunocardoso.cc&data=02%7C01%7Cstilis%40microsoft.com% > 7C9a3d5b51b26c4ff1a8db08d5d715df88%7C72f988bf86f141af91ab2d7cd011 > db47%7C1%7C0%7C636651411307060645&sdata=2EamqaQFSd35ZIqp% > 2Ft9TxAUZYoeDg8NkD47VaERkoG8%3D&reserved=0 > > ___ > 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