r337736 - [CodeGen] Record if a C++ record is a trivial type
Author: asmith Date: Mon Jul 23 13:49:07 2018 New Revision: 337736 URL: http://llvm.org/viewvc/llvm-project?rev=337736&view=rev Log: [CodeGen] Record if a C++ record is a trivial type Summary: This has a dependence on D45122 Reviewers: rnk, zturner, llvm-commits, aleksandr.urakov Reviewed By: rnk Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D45124 Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=337736&r1=337735&r2=337736&view=diff == --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Jul 23 13:49:07 2018 @@ -2908,6 +2908,10 @@ llvm::DICompositeType *CGDebugInfo::Crea Flags |= llvm::DINode::FlagTypePassByReference; else Flags |= llvm::DINode::FlagTypePassByValue; + +// Record if a C++ record is trivial type. +if (CXXRD->isTrivial()) + Flags |= llvm::DINode::FlagTrivial; } llvm::DICompositeType *RealDecl = DBuilder.createReplaceableCompositeType( ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r324824 - Fix test clang-diff-json.cpp
Author: asmith Date: Sat Feb 10 13:28:55 2018 New Revision: 324824 URL: http://llvm.org/viewvc/llvm-project?rev=324824&view=rev Log: Fix test clang-diff-json.cpp Summary: This test would fail if the python path had spaces. Add a quote around the path to fix this problem and update some test values changed by the addition of quotes around the path. Tested on Windows and Linux with Python 3.x Reviewers: zturner, llvm-commits Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D43164 Modified: cfe/trunk/test/Tooling/clang-diff-json.cpp Modified: cfe/trunk/test/Tooling/clang-diff-json.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Tooling/clang-diff-json.cpp?rev=324824&r1=324823&r2=324824&view=diff == --- cfe/trunk/test/Tooling/clang-diff-json.cpp (original) +++ cfe/trunk/test/Tooling/clang-diff-json.cpp Sat Feb 10 13:28:55 2018 @@ -1,10 +1,10 @@ // RUN: clang-diff -ast-dump-json %s -- \ -// RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \ +// RUN: | '%python' -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \ // RUN: | FileCheck %s -// CHECK: "begin": 299, +// CHECK: "begin": 301, // CHECK: "type": "FieldDecl", -// CHECK: "end": 319, +// CHECK: "end": 321, // CHECK: "type": "CXXRecordDecl", class A { int x; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r327775 - [Driver] Fix the descriptions for -Tdata and -Ttext options
Author: asmith Date: Sat Mar 17 08:24:35 2018 New Revision: 327775 URL: http://llvm.org/viewvc/llvm-project?rev=327775&view=rev Log: [Driver] Fix the descriptions for -Tdata and -Ttext options Reviewers: llvm-commits Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D44581 Modified: cfe/trunk/include/clang/Driver/Options.td Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=327775&r1=327774&r2=327775&view=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Sat Mar 17 08:24:35 2018 @@ -418,9 +418,9 @@ def S : Flag<["-"], "S">, Flags<[DriverO def Tbss : JoinedOrSeparate<["-"], "Tbss">, Group, MetaVarName<"">, HelpText<"Set starting address of BSS to ">; def Tdata : JoinedOrSeparate<["-"], "Tdata">, Group, - MetaVarName<"">, HelpText<"Set starting address of BSS to ">; + MetaVarName<"">, HelpText<"Set starting address of DATA to ">; def Ttext : JoinedOrSeparate<["-"], "Ttext">, Group, - MetaVarName<"">, HelpText<"Set starting address of BSS to ">; + MetaVarName<"">, HelpText<"Set starting address of TEXT to ">; def T : JoinedOrSeparate<["-"], "T">, Group, MetaVarName<"
r354843 - [CGDebugInfo] Set NonTrivial DIFlag to a c++ record if it's not trivial
Author: asmith Date: Mon Feb 25 19:49:05 2019 New Revision: 354843 URL: http://llvm.org/viewvc/llvm-project?rev=354843&view=rev Log: [CGDebugInfo] Set NonTrivial DIFlag to a c++ record if it's not trivial This goes with https://reviews.llvm.org/D44406 Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=354843&r1=354842&r2=354843&view=diff == --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Feb 25 19:49:05 2019 @@ -3031,6 +3031,8 @@ llvm::DICompositeType *CGDebugInfo::Crea // Record if a C++ record is trivial type. if (CXXRD->isTrivial()) Flags |= llvm::DINode::FlagTrivial; +else + Flags |= llvm::DINode::FlagNonTrivial; } llvm::DICompositeType *RealDecl = DBuilder.createReplaceableCompositeType( ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r354843 - [CGDebugInfo] Set NonTrivial DIFlag to a c++ record if it's not trivial
Hi David, I can take a look at adding another test. Please read the code review which answers your question. A new flag is required. Thanks. From: David Blaikie Sent: Tuesday, March 5, 2019 12:51:27 AM To: Aaron Smith; Reid Kleckner; Adrian Prantl; Jonas Devlieghere Cc: cfe-commits@lists.llvm.org Subject: Re: r354843 - [CGDebugInfo] Set NonTrivial DIFlag to a c++ record if it's not trivial Hi Aaron, I don't see any mention of this in D44406 - so it might have been good to have a separate review for this (or included this in the review of D44406, which I think is possible with the monorepo). Specifically - this change is missing test coverage (there should be a clang test that goes from C++ source code to LLVM IR & demonstrates the flag being emitted into the IR, etc). Also - what's the reason the non-triviality can't be implied by the absence of the trivial flag? (or the other way around) - the flags seem redundant with one another. On Mon, Feb 25, 2019 at 8:02 PM Aaron Smith via cfe-commits mailto:cfe-commits@lists.llvm.org>> wrote: Author: asmith Date: Mon Feb 25 19:49:05 2019 New Revision: 354843 URL: http://llvm.org/viewvc/llvm-project?rev=354843&view=rev<https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fllvm.org%2Fviewvc%2Fllvm-project%3Frev%3D354843%26view%3Drev&data=02%7C01%7Caaron.smith%40microsoft.com%7C9ee22645e4544a8a54a808d6a0b94a7a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C636873115022346268&sdata=jkLruyBw16u7MYD8G0vjNH5BAmhJbUxWM0mGPctzhxE%3D&reserved=0> Log: [CGDebugInfo] Set NonTrivial DIFlag to a c++ record if it's not trivial This goes with https://reviews.llvm.org/D44406<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Freviews.llvm.org%2FD44406&data=02%7C01%7Caaron.smith%40microsoft.com%7C9ee22645e4544a8a54a808d6a0b94a7a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C636873115022346268&sdata=YBPvy0l%2BVVCzPWSXB0VYUPRS2AVHOA6pGH0sKIfM6D4%3D&reserved=0> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=354843&r1=354842&r2=354843&view=diff<https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fllvm.org%2Fviewvc%2Fllvm-project%2Fcfe%2Ftrunk%2Flib%2FCodeGen%2FCGDebugInfo.cpp%3Frev%3D354843%26r1%3D354842%26r2%3D354843%26view%3Ddiff&data=02%7C01%7Caaron.smith%40microsoft.com%7C9ee22645e4544a8a54a808d6a0b94a7a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C636873115022356269&sdata=jkg1JEzzsmEyAfaBggFOy84iEVR%2Foqn0y%2Fj1ohXQcVk%3D&reserved=0> == --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Feb 25 19:49:05 2019 @@ -3031,6 +3031,8 @@ llvm::DICompositeType *CGDebugInfo::Crea // Record if a C++ record is trivial type. if (CXXRD->isTrivial()) Flags |= llvm::DINode::FlagTrivial; +else + Flags |= llvm::DINode::FlagNonTrivial; } llvm::DICompositeType *RealDecl = DBuilder.createReplaceableCompositeType( ___ cfe-commits mailing list cfe-commits@lists.llvm.org<mailto:cfe-commits@lists.llvm.org> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.llvm.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fcfe-commits&data=02%7C01%7Caaron.smith%40microsoft.com%7C9ee22645e4544a8a54a808d6a0b94a7a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C636873115022366259&sdata=yJtEfwH0KXKsMScvooRpNZGXiLshTqIRIwOBSoVxUio%3D&reserved=0> ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r355890 - [DebugInfo] Add test cases for FlagNonTrivial
Author: asmith Date: Mon Mar 11 19:00:39 2019 New Revision: 355890 URL: http://llvm.org/viewvc/llvm-project?rev=355890&view=rev Log: [DebugInfo] Add test cases for FlagNonTrivial Summary: This is a test case to go with D44406 which added FlagNonTrivial to mark that a C++ record is non-trivial to support CodeView debug emission. While it looks like FlagTypePassByValue can imply triviality and FlagTypePassByReference can imply non-triviality that is not true. Some non-trivial cases use a combination of FlagNonTrivial and FlagTypePassByValue instead of FlagTypePassByReference. See the test cases and D44406 for discussion. Reviewers: dblaikie, rnk, zturner Reviewed By: dblaikie Subscribers: jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59010 Added: cfe/trunk/test/CodeGenCXX/debug-info-composite-triviality.cpp Added: cfe/trunk/test/CodeGenCXX/debug-info-composite-triviality.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-composite-triviality.cpp?rev=355890&view=auto == --- cfe/trunk/test/CodeGenCXX/debug-info-composite-triviality.cpp (added) +++ cfe/trunk/test/CodeGenCXX/debug-info-composite-triviality.cpp Mon Mar 11 19:00:39 2019 @@ -0,0 +1,90 @@ +// RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -triple %itanium_abi_triple %s -o - | FileCheck %s + +// Cases to show some non-trivial types with flags combined with DIFlagNonTrivial and DIFlagTypePassByValue. + +// CHECK-DAG: !DICompositeType({{.*}}, name: "Explicit",{{.*}}flags: DIFlagTypePassByValue | DIFlagNonTrivial +struct Explicit { + explicit Explicit(); + int a; +} Explicit; + +// CHECK-DAG: !DICompositeType({{.*}}, name: "Struct",{{.*}}flags: DIFlagTypePassByValue | DIFlagNonTrivial +struct Struct { + Struct() {} +} Struct; + +// CHECK-DAG: !DICompositeType({{.*}}, name: "Annotated",{{.*}}flags: DIFlagTypePassByValue | DIFlagNonTrivial +struct __attribute__((trivial_abi)) Annotated { + Annotated() {}; +} Annotated; + + +// Check a non-composite type +// CHECK-DAG: !DIGlobalVariable(name: "GlobalVar", {{.*}}type: {{.*}}, isLocal: false, isDefinition: true) +int GlobalVar = 0; + +// Cases to test composite type's triviality + +// CHECK-DAG: !DICompositeType({{.*}}, name: "Union",{{.*}}flags: {{.*}}DIFlagTrivial +union Union { + int a; +} Union; + +// CHECK-DAG: !DICompositeType({{.*}}, name: "Trivial",{{.*}}flags: {{.*}}DIFlagTrivial +struct Trivial { + int i; +} Trivial; + +// CHECK-DAG: !DICompositeType({{.*}}, name: "TrivialA",{{.*}}flags: {{.*}}DIFlagTrivial +struct TrivialA { + TrivialA() = default; +} TrivialA; + +// CHECK-DAG: !DICompositeType({{.*}}, name: "TrivialB",{{.*}}flags: {{.*}}DIFlagTrivial +struct TrivialB { + int m; + TrivialB(int x) { m = x; } + TrivialB() = default; +} TrivialB; + +// CHECK-DAG: !DICompositeType({{.*}}, name: "TrivialC",{{.*}}flags: {{.*}}DIFlagTrivial +struct TrivialC { + struct Trivial x; +} TrivialC; + +// CHECK-DAG: !DICompositeType({{.*}}, name: "TrivialD",{{.*}}flags: {{.*}}DIFlagTrivial +struct NT { + NT() {}; +}; +struct TrivialD { + static struct NT x; // Member is non-trivial but is static. +} TrivialD; + + +// CHECK-DAG: !DICompositeType({{.*}}, name: "NonTrivial",{{.*}}flags: {{.*}}DIFlagNonTrivial +struct NonTrivial { + NonTrivial() {} +} NonTrivial; + +// CHECK-DAG: !DICompositeType({{.*}}, name: "NonTrivialA",{{.*}}flags: {{.*}}DIFlagNonTrivial +struct NonTrivialA { + ~NonTrivialA(); +} NonTrivialA; + +// CHECK-DAG: !DICompositeType({{.*}}, name: "NonTrivialB",{{.*}}flags: {{.*}}DIFlagNonTrivial +struct NonTrivialB { + struct NonTrivial x; +} NonTrivialB; + +// CHECK-DAG: !DICompositeType({{.*}}, name: "NonTrivialC",{{.*}}flags: {{.*}}DIFlagNonTrivial +struct NonTrivialC { + virtual void f() {} +} NonTrivialC; + +// CHECK-DAG: !DICompositeType({{.*}}, name: "NonTrivialD",{{.*}}flags: {{.*}}DIFlagNonTrivial +struct NonTrivialD : NonTrivial { +} NonTrivialD; + +// CHECK-DAG: !DICompositeType({{.*}}, name: "NonTrivialE",{{.*}}flags: {{.*}}DIFlagNonTrivial +struct NonTrivialE : Trivial, NonTrivial { +} NonTrivialE; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r354843 - [CGDebugInfo] Set NonTrivial DIFlag to a c++ record if it's not trivial
Hi Paul, There are additional tests here that may answer your questions, https://reviews.llvm.org/rGe8475f78e2634d5d348d7ad746efc1e6526e72f5 Aaron From: "paul.robin...@sony.com" Date: Wednesday, March 13, 2019 at 12:49 PM To: Aaron Smith , "dblai...@gmail.com" , "r...@google.com" , "apra...@apple.com" , "jdevliegh...@apple.com" Cc: "cfe-commits@lists.llvm.org" Subject: RE: r354843 - [CGDebugInfo] Set NonTrivial DIFlag to a c++ record if it's not trivial Hi Aaron, I think I am less clever than David, and it's not clear what the difference is between the two flags. In the review, Zach asked the question but I did not see a straight answer. What do these flags actually mean? What is the third state, with both flags off, implying not Trivial and not NonTrivial? (At the very least it seems that the names could be improved.) Thanks, --paulr From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of Aaron Smith via cfe-commits Sent: Monday, March 04, 2019 6:22 PM To: David Blaikie; Reid Kleckner; Adrian Prantl; Jonas Devlieghere Cc: cfe-commits@lists.llvm.org Subject: Re: r354843 - [CGDebugInfo] Set NonTrivial DIFlag to a c++ record if it's not trivial Hi David, I can take a look at adding another test. Please read the code review which answers your question. A new flag is required. Thanks. From: David Blaikie Sent: Tuesday, March 5, 2019 12:51:27 AM To: Aaron Smith; Reid Kleckner; Adrian Prantl; Jonas Devlieghere Cc: cfe-commits@lists.llvm.org Subject: Re: r354843 - [CGDebugInfo] Set NonTrivial DIFlag to a c++ record if it's not trivial Hi Aaron, I don't see any mention of this in D44406 - so it might have been good to have a separate review for this (or included this in the review of D44406, which I think is possible with the monorepo). Specifically - this change is missing test coverage (there should be a clang test that goes from C++ source code to LLVM IR & demonstrates the flag being emitted into the IR, etc). Also - what's the reason the non-triviality can't be implied by the absence of the trivial flag? (or the other way around) - the flags seem redundant with one another. On Mon, Feb 25, 2019 at 8:02 PM Aaron Smith via cfe-commits mailto:cfe-commits@lists.llvm.org>> wrote: Author: asmith Date: Mon Feb 25 19:49:05 2019 New Revision: 354843 URL: http://llvm.org/viewvc/llvm-project?rev=354843&view=rev<https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fllvm.org%2Fviewvc%2Fllvm-project%3Frev%3D354843%26view%3Drev&data=02%7C01%7Caaron.smith%40microsoft.com%7Ca81fbd6197e04e329a7708d6a7ecf4ce%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636881033496912406&sdata=lSb5rDLYvfn3Fx25%2FISjPJ1z6sUyvNHnlPBIUFM22aQ%3D&reserved=0> Log: [CGDebugInfo] Set NonTrivial DIFlag to a c++ record if it's not trivial This goes with https://reviews.llvm.org/D44406<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Freviews.llvm.org%2FD44406&data=02%7C01%7Caaron.smith%40microsoft.com%7Ca81fbd6197e04e329a7708d6a7ecf4ce%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636881033496912406&sdata=mJz7kzeqyH%2B5mAld8TA%2BELQ4ouBkVyr2opJyICfEM60%3D&reserved=0> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=354843&r1=354842&r2=354843&view=diff<https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fllvm.org%2Fviewvc%2Fllvm-project%2Fcfe%2Ftrunk%2Flib%2FCodeGen%2FCGDebugInfo.cpp%3Frev%3D354843%26r1%3D354842%26r2%3D354843%26view%3Ddiff&data=02%7C01%7Caaron.smith%40microsoft.com%7Ca81fbd6197e04e329a7708d6a7ecf4ce%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636881033496922411&sdata=Y%2BVdpDTdlUcyZzPpcs4TMB3DQT7eAK%2F5ASLmWM%2Fg73A%3D&reserved=0> == --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Feb 25 19:49:05 2019 @@ -3031,6 +3031,8 @@ llvm::DICompositeType *CGDebugInfo::Crea // Record if a C++ record is trivial type. if (CXXRD->isTrivial()) Flags |= llvm::DINode::FlagTrivial; +else + Flags |= llvm::DINode::FlagNonTrivial; } llvm::DICompositeType *RealDecl = DBuilder.createReplaceableCompositeType( ___ cfe-commits mailing list cfe-commits@lists.llvm.org<mailto:cfe-commits@lists.llvm.org> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.llvm.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fcfe-commits&data=02%7C01%7Caaron.smith%40microsoft.com%7Ca81fbd6197e04e329a7708d6a7ecf4ce%7C72f988bf86f141af91ab2d7cd011db47%7C1%7
r358219 - [DebugInfo] Combine Trivial and NonTrivial flags
Author: asmith Date: Thu Apr 11 13:24:54 2019 New Revision: 358219 URL: http://llvm.org/viewvc/llvm-project?rev=358219&view=rev Log: [DebugInfo] Combine Trivial and NonTrivial flags Summary: These flags are used when emitting debug info and needed to initialize subprogram and member function attributes (function options) for Codeview. These function options are used to create an accurate compiler type for UDT symbols (class/struct/union) from PDBs. The Trivial flag was introduced in https://reviews.llvm.org/D45122 It's been pointed out that Trivial and NonTrivial may imply each other and that seems to be the case in the current tests. This change combines them into a single flag -- NonTrivial -- and updates the corresponding unit tests. There is an additional change to llvm to update the flags. Reviewers: rnk, zturner, dblaikie, probinson, Hui Reviewed By: dblaikie Subscribers: aprantl, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59347 Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/test/CodeGenCXX/debug-info-composite-triviality.cpp Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=358219&r1=358218&r2=358219&view=diff == --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Apr 11 13:24:54 2019 @@ -3034,10 +3034,8 @@ llvm::DICompositeType *CGDebugInfo::Crea else Flags |= llvm::DINode::FlagTypePassByValue; -// Record if a C++ record is trivial type. -if (CXXRD->isTrivial()) - Flags |= llvm::DINode::FlagTrivial; -else +// Record if a C++ record is non-trivial type. +if (!CXXRD->isTrivial()) Flags |= llvm::DINode::FlagNonTrivial; } Modified: cfe/trunk/test/CodeGenCXX/debug-info-composite-triviality.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-composite-triviality.cpp?rev=358219&r1=358218&r2=358219&view=diff == --- cfe/trunk/test/CodeGenCXX/debug-info-composite-triviality.cpp (original) +++ cfe/trunk/test/CodeGenCXX/debug-info-composite-triviality.cpp Thu Apr 11 13:24:54 2019 @@ -25,34 +25,40 @@ int GlobalVar = 0; // Cases to test composite type's triviality -// CHECK-DAG: !DICompositeType({{.*}}, name: "Union",{{.*}}flags: {{.*}}DIFlagTrivial +// CHECK-DAG: {{.*}}!DIGlobalVariable(name: "Union", +// CHECK-DAG-NEXT: {{^((?!\bDIFlagNonTrivial\b).)*$}} union Union { int a; } Union; -// CHECK-DAG: !DICompositeType({{.*}}, name: "Trivial",{{.*}}flags: {{.*}}DIFlagTrivial +// CHECK-DAG: {{.*}}!DIGlobalVariable(name: "Trivial", +// CHECK-DAG-NEXT: {{^((?!\bDIFlagNonTrivial\b).)*$}} struct Trivial { int i; } Trivial; -// CHECK-DAG: !DICompositeType({{.*}}, name: "TrivialA",{{.*}}flags: {{.*}}DIFlagTrivial +// CHECK-DAG: {{.*}}!DIGlobalVariable(name: "TrivialA", +// CHECK-DAG-NEXT: {{^((?!\bDIFlagNonTrivial\b).)*$}} struct TrivialA { TrivialA() = default; } TrivialA; -// CHECK-DAG: !DICompositeType({{.*}}, name: "TrivialB",{{.*}}flags: {{.*}}DIFlagTrivial +// CHECK-DAG: {{.*}}!DIGlobalVariable(name: "TrivialB", +// CHECK-DAG-NEXT: {{^((?!\bDIFlagNonTrivial\b).)*$}} struct TrivialB { int m; TrivialB(int x) { m = x; } TrivialB() = default; } TrivialB; -// CHECK-DAG: !DICompositeType({{.*}}, name: "TrivialC",{{.*}}flags: {{.*}}DIFlagTrivial +// CHECK-DAG: {{.*}}!DIGlobalVariable(name: "TrivialC", +// CHECK-DAG-NEXT: {{^((?!\bDIFlagNonTrivial\b).)*$}} struct TrivialC { struct Trivial x; } TrivialC; -// CHECK-DAG: !DICompositeType({{.*}}, name: "TrivialD",{{.*}}flags: {{.*}}DIFlagTrivial +// CHECK-DAG: {{.*}}!DIGlobalVariable(name: "TrivialD", +// CHECK-DAG-NEXT: {{^((?!\bDIFlagNonTrivial\b).)*$}} struct NT { NT() {}; }; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 292058a - [clang-format] Fix Microsoft style for enums
Author: Aaron Smith Date: 2020-04-30T09:11:54-07:00 New Revision: 292058a5d6d708ec7d285a452d4350b33ba080dc URL: https://github.com/llvm/llvm-project/commit/292058a5d6d708ec7d285a452d4350b33ba080dc DIFF: https://github.com/llvm/llvm-project/commit/292058a5d6d708ec7d285a452d4350b33ba080dc.diff LOG: [clang-format] Fix Microsoft style for enums Summary: Before this change enums were formatted incorrectly for the Microsoft style. [C++ Example] enum { one, two } three, four; [Incorrectly Formatted] enum { one, two } three, four; [Correct Format with Patch] enum { one, two } three, four; Reviewers: jbcoe, MyDeveloperDay, rnk Reviewed By: MyDeveloperDay Subscribers: cfe-commits Tags: #clang, #clang-format Differential Revision: https://reviews.llvm.org/D78982 Added: Modified: clang/docs/ClangFormatStyleOptions.rst clang/include/clang/Format/Format.h clang/lib/Format/Format.cpp clang/lib/Format/UnwrappedLineParser.cpp clang/lib/Format/UnwrappedLineParser.h clang/unittests/Format/FormatTest.cpp clang/unittests/Format/FormatTestCSharp.cpp Removed: diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst index 01ab0db490e4..ce26b06bf171 100644 --- a/clang/docs/ClangFormatStyleOptions.rst +++ b/clang/docs/ClangFormatStyleOptions.rst @@ -395,6 +395,21 @@ the configuration (without a prefix: ``Auto``). return; } +**AllowShortEnumsOnASingleLine** (``bool``) + Allow short enums on a single line. + + .. code-block:: c++ + +true: +enum { A, B } myEnum; + +false: +enum +{ + A, + B +} myEnum; + **AllowShortFunctionsOnASingleLine** (``ShortFunctionStyle``) Dependent on the value, ``int f() { return 0; }`` can be put on a single line. diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h index 1143b1815050..011cf599d526 100644 --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -221,6 +221,20 @@ struct FormatStyle { /// \endcode bool AllowAllParametersOfDeclarationOnNextLine; + /// Allow short enums on a single line. + /// \code + /// true: + /// enum { A, B } myEnum; + /// + /// false: + /// enum + /// { + /// A, + /// B + /// } myEnum; + /// \endcode + bool AllowShortEnumsOnASingleLine; + /// Different styles for merging short blocks containing at most one /// statement. enum ShortBlockStyle { @@ -2175,6 +2189,7 @@ struct FormatStyle { R.AllowAllConstructorInitializersOnNextLine && AllowAllParametersOfDeclarationOnNextLine == R.AllowAllParametersOfDeclarationOnNextLine && + AllowShortEnumsOnASingleLine == R.AllowShortEnumsOnASingleLine && AllowShortBlocksOnASingleLine == R.AllowShortBlocksOnASingleLine && AllowShortCaseLabelsOnASingleLine == R.AllowShortCaseLabelsOnASingleLine && diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 872f7009d332..961cb92ebd40 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -399,6 +399,8 @@ template <> struct MappingTraits { Style.AllowAllConstructorInitializersOnNextLine); IO.mapOptional("AllowAllParametersOfDeclarationOnNextLine", Style.AllowAllParametersOfDeclarationOnNextLine); +IO.mapOptional("AllowShortEnumsOnASingleLine", + Style.AllowShortEnumsOnASingleLine); IO.mapOptional("AllowShortBlocksOnASingleLine", Style.AllowShortBlocksOnASingleLine); IO.mapOptional("AllowShortCaseLabelsOnASingleLine", @@ -754,6 +756,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) { LLVMStyle.AllowAllArgumentsOnNextLine = true; LLVMStyle.AllowAllConstructorInitializersOnNextLine = true; LLVMStyle.AllowAllParametersOfDeclarationOnNextLine = true; + LLVMStyle.AllowShortEnumsOnASingleLine = true; LLVMStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_All; LLVMStyle.AllowShortBlocksOnASingleLine = FormatStyle::SBS_Never; LLVMStyle.AllowShortCaseLabelsOnASingleLine = false; @@ -1139,6 +1142,7 @@ FormatStyle getMicrosoftStyle(FormatStyle::LanguageKind Language) { Style.BraceWrapping.BeforeCatch = true; Style.BraceWrapping.BeforeElse = true; Style.PenaltyReturnTypeOnItsOwnLine = 1000; + Style.AllowShortEnumsOnASingleLine = false; Style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_None; Style.AllowShortCaseLabelsOnASingleLine = false; Style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never; diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp i
[clang] 4eabd00 - [Windows SEH] Fix abnormal-exits in _try
Author: Aaron Smith Date: 2020-04-30T09:38:19-07:00 New Revision: 4eabd006125424f879a7129eca824998192d89a9 URL: https://github.com/llvm/llvm-project/commit/4eabd006125424f879a7129eca824998192d89a9 DIFF: https://github.com/llvm/llvm-project/commit/4eabd006125424f879a7129eca824998192d89a9.diff LOG: [Windows SEH] Fix abnormal-exits in _try Summary: Per Windows SEH Spec, except _leave, all other early exits of a _try (goto/return/continue/break) are considered abnormal exits. In those cases, the first parameter passes to its _finally funclet should be TRUE to indicate an abnormal-termination. One way to implement abnormal exits in _try is to invoke Windows runtime _local_unwind() (MSVC approach) that will invoke _dtor funclet where abnormal-termination flag is always TRUE when calling _finally. Obviously this approach is less optimal and is complicated to implement in Clang. Clang today has a NormalCleanupDestSlot mechanism to dispatch multiple exits at the end of _try. Since _leave (or try-end fall-through) is always Indexed with 0 in that NormalCleanupDestSlot, this fix takes the advantage of that mechanism and just passes NormalCleanupDest ID as 1st Arg to _finally. Reviewers: rnk, eli.friedman, JosephTremoulet, asmith, efriedma Reviewed By: efriedma Subscribers: efriedma, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D77936 Added: clang/test/CodeGen/windows-seh-abnormal-exits.c Modified: clang/lib/CodeGen/CGCleanup.cpp clang/lib/CodeGen/CGException.cpp clang/lib/CodeGen/EHScopeStack.h Removed: diff --git a/clang/lib/CodeGen/CGCleanup.cpp b/clang/lib/CodeGen/CGCleanup.cpp index 5e01100db163..70eaa321a007 100644 --- a/clang/lib/CodeGen/CGCleanup.cpp +++ b/clang/lib/CodeGen/CGCleanup.cpp @@ -860,6 +860,9 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) { // TODO: base this on the number of branch-afters and fixups const unsigned SwitchCapacity = 10; +// pass the abnormal exit flag to Fn (SEH cleanup) +cleanupFlags.setHasExitSwitch(); + llvm::LoadInst *Load = createLoadInstBefore(getNormalCleanupDestSlot(), "cleanup.dest", nullptr); diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp index a542c3d85a84..a5dae1b32e69 100644 --- a/clang/lib/CodeGen/CGException.cpp +++ b/clang/lib/CodeGen/CGException.cpp @@ -1639,6 +1639,19 @@ struct PerformSEHFinally final : EHScopeStack::Cleanup { llvm::Value *IsForEH = llvm::ConstantInt::get(CGF.ConvertType(ArgTys[0]), F.isForEHCleanup()); + +// Except _leave and fall-through at the end, all other exits in a _try +// (return/goto/continue/break) are considered as abnormal terminations +// since _leave/fall-through is always Indexed 0, +// just use NormalCleanupDestSlot (>= 1 for goto/return/..), +// as 1st Arg to indicate abnormal termination +if (!F.isForEHCleanup() && F.hasExitSwitch()) { + Address Addr = CGF.getNormalCleanupDestSlot(); + llvm::Value *Load = CGF.Builder.CreateLoad(Addr, "cleanup.dest"); + llvm::Value *Zero = llvm::Constant::getNullValue(CGM.Int32Ty); + IsForEH = CGF.Builder.CreateICmpNE(Load, Zero); +} + Args.add(RValue::get(IsForEH), ArgTys[0]); Args.add(RValue::get(FP), ArgTys[1]); diff --git a/clang/lib/CodeGen/EHScopeStack.h b/clang/lib/CodeGen/EHScopeStack.h index 0ed67aabcd62..0fa0b54be2f0 100644 --- a/clang/lib/CodeGen/EHScopeStack.h +++ b/clang/lib/CodeGen/EHScopeStack.h @@ -158,9 +158,10 @@ class EHScopeStack { /// Generation flags. class Flags { enum { -F_IsForEH = 0x1, +F_IsForEH = 0x1, F_IsNormalCleanupKind = 0x2, -F_IsEHCleanupKind = 0x4 +F_IsEHCleanupKind = 0x4, +F_HasExitSwitch = 0x8, }; unsigned flags; @@ -179,8 +180,10 @@ class EHScopeStack { /// cleanup. bool isEHCleanupKind() const { return flags & F_IsEHCleanupKind; } void setIsEHCleanupKind() { flags |= F_IsEHCleanupKind; } -}; + bool hasExitSwitch() const { return flags & F_HasExitSwitch; } + void setHasExitSwitch() { flags |= F_HasExitSwitch; } +}; /// Emit the cleanup. For normal cleanups, this is run in the /// same EH context as when the cleanup was pushed, i.e. the diff --git a/clang/test/CodeGen/windows-seh-abnormal-exits.c b/clang/test/CodeGen/windows-seh-abnormal-exits.c new file mode 100644 index ..971e4f008a41 --- /dev/null +++ b/clang/test/CodeGen/windows-seh-abnormal-exits.c @@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -triple x86_64-windows -fms-extensions -Wno-implicit-function-declaration -S -emit-llvm %s -o - | FileCheck %s + +// CHECK: %[[src:[0-9-]+]] = call i8* @llvm.localaddress() +// CHECK-NEXT: %cleanup.dest = load
[libunwind] r329340 - [cmake] Remove duplicate command line options from build
Author: asmith Date: Thu Apr 5 13:27:50 2018 New Revision: 329340 URL: http://llvm.org/viewvc/llvm-project?rev=329340&view=rev Log: [cmake] Remove duplicate command line options from build CMAKE_CXX_FLAGS and CMAKE_C_FLAGS are added twice to the command line. This causes the command line options to be doubled which works until it doesn't as not all options can be specified twice. For example, clang-cl foo.c /GS- /GS- -mllvm -small-loop-cost=1 -mllvm -small-loop-cost=1 clang (LLVM option parsing): for the -small-loop-cost option: may only occur zero or one times! Modified: libunwind/trunk/src/CMakeLists.txt Modified: libunwind/trunk/src/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/CMakeLists.txt?rev=329340&r1=329339&r2=329340&view=diff == --- libunwind/trunk/src/CMakeLists.txt (original) +++ libunwind/trunk/src/CMakeLists.txt Thu Apr 5 13:27:50 2018 @@ -91,9 +91,9 @@ string(REPLACE ";" " " LIBUNWIND_C_FLAGS string(REPLACE ";" " " LIBUNWIND_LINK_FLAGS "${LIBUNWIND_LINK_FLAGS}") set_property(SOURCE ${LIBUNWIND_CXX_SOURCES} - APPEND_STRING PROPERTY COMPILE_FLAGS " ${CMAKE_CXX_FLAGS} ${LIBUNWIND_CXX_FLAGS}") + APPEND_STRING PROPERTY COMPILE_FLAGS " ${LIBUNWIND_CXX_FLAGS}") set_property(SOURCE ${LIBUNWIND_C_SOURCES} - APPEND_STRING PROPERTY COMPILE_FLAGS " ${CMAKE_C_FLAGS} ${LIBUNWIND_C_FLAGS}") + APPEND_STRING PROPERTY COMPILE_FLAGS " ${LIBUNWIND_C_FLAGS}") # Add a object library that contains the compiled source files. add_library(unwind_objects OBJECT ${LIBUNWIND_SOURCES} ${LIBUNWIND_HEADERS}) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits