Re: [PATCH] D35020: [Modules] Add ability to specify module name to module file mapping
Hello Boris, looks like this revision broke tests on our win10 builder: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/11760 Clang :: CXX/modules-ts/basic/basic.link/module-declaration.cpp I had to revert this revision. Could you please take a look? On 08/30/2017 11:47 AM, Phabricator via Phabricator via cfe-commits wrote: > This revision was automatically updated to reflect the committed changes. > Closed by commit rL312105: [modules] Add ability to specify module name to > module file mapping (authored by borisk). > > Changed prior to commit: > https://reviews.llvm.org/D35020?vs=111826=113207#toc > > Repository: > rL LLVM > > https://reviews.llvm.org/D35020 > > Files: > cfe/trunk/docs/Modules.rst > cfe/trunk/include/clang/Driver/Options.td > cfe/trunk/include/clang/Lex/HeaderSearch.h > cfe/trunk/include/clang/Lex/HeaderSearchOptions.h > cfe/trunk/include/clang/Serialization/ASTReader.h > cfe/trunk/include/clang/Serialization/ModuleManager.h > cfe/trunk/lib/Driver/ToolChains/Clang.cpp > cfe/trunk/lib/Frontend/CompilerInstance.cpp > cfe/trunk/lib/Frontend/CompilerInvocation.cpp > cfe/trunk/lib/Frontend/FrontendActions.cpp > cfe/trunk/lib/Lex/HeaderSearch.cpp > cfe/trunk/lib/Serialization/ASTReader.cpp > cfe/trunk/lib/Serialization/ASTWriter.cpp > cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp > cfe/trunk/lib/Serialization/ModuleManager.cpp > cfe/trunk/test/CXX/modules-ts/basic/basic.search/module-import.cpp > > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits -- Best Regards, Victor Leschuk | Software Engineer |Access Softek ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r312112 - Revert r312105 [modules] Add ability to specify module name to module file mapping
Author: vleschuk Date: Wed Aug 30 04:31:56 2017 New Revision: 312112 URL: http://llvm.org/viewvc/llvm-project?rev=312112=rev Log: Revert r312105 [modules] Add ability to specify module name to module file mapping Looks like it breaks win10 builder. Removed: cfe/trunk/test/CXX/modules-ts/basic/basic.search/ Modified: cfe/trunk/docs/Modules.rst cfe/trunk/include/clang/Driver/Options.td cfe/trunk/include/clang/Lex/HeaderSearch.h cfe/trunk/include/clang/Lex/HeaderSearchOptions.h cfe/trunk/include/clang/Serialization/ASTReader.h cfe/trunk/include/clang/Serialization/ModuleManager.h cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/lib/Frontend/CompilerInstance.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/lib/Frontend/FrontendActions.cpp cfe/trunk/lib/Lex/HeaderSearch.cpp cfe/trunk/lib/Serialization/ASTReader.cpp cfe/trunk/lib/Serialization/ASTWriter.cpp cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp cfe/trunk/lib/Serialization/ModuleManager.cpp Modified: cfe/trunk/docs/Modules.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/Modules.rst?rev=312112=312111=312112=diff == --- cfe/trunk/docs/Modules.rst (original) +++ cfe/trunk/docs/Modules.rst Wed Aug 30 04:31:56 2017 @@ -213,14 +213,8 @@ Command-line parameters ``-fno-implicit-modules`` All modules used by the build must be specified with ``-fmodule-file``. -``-fmodule-file=[=]`` - Specify the mapping of module names to precompiled module files. If the - name is omitted, then the module file is loaded whether actually required - or not. If the name is specified, then the mapping is treated as another - prebuilt module search mechanism (in addition to ``-fprebuilt-module-path``) - and the module is only loaded if required. Note that in this case the - specified file also overrides this module's paths that might be embedded - in other precompiled module files. +``-fmodule-file=`` + Load the given precompiled module file. ``-fprebuilt-module-path=`` Specify the path to the prebuilt modules. If specified, we will look for modules in this directory for a given top-level module name. We don't need a module map for loading prebuilt modules in this directory and the compiler will not try to rebuild these modules. This can be specified multiple times. @@ -951,3 +945,4 @@ PCHInternals_ .. [#] The preprocessing context in which the modules are parsed is actually dependent on the command-line options provided to the compiler, including the language dialect and any ``-D`` options. However, the compiled modules for different command-line options are kept distinct, and any preprocessor directives that occur within the translation unit are ignored. See the section on the `Configuration macros declaration`_ for more information. .. _PCHInternals: PCHInternals.html + Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=312112=312111=312112=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Wed Aug 30 04:31:56 2017 @@ -1125,8 +1125,8 @@ def fmodule_map_file : Joined<["-"], "fm Group, Flags<[DriverOption,CC1Option]>, MetaVarName<"">, HelpText<"Load this module map file">; def fmodule_file : Joined<["-"], "fmodule-file=">, - Group, Flags<[DriverOption,CC1Option]>, MetaVarName<"[=]">, - HelpText<"Specify the mapping of module name to precompiled module file, or load a module file if name is omitted.">; + Group, Flags<[DriverOption,CC1Option]>, + HelpText<"Load this precompiled module file">, MetaVarName<"">; def fmodules_ignore_macro : Joined<["-"], "fmodules-ignore-macro=">, Group, Flags<[CC1Option]>, HelpText<"Ignore the definition of the given macro when building and loading modules">; def fmodules_decluse : Flag <["-"], "fmodules-decluse">, Group, Modified: cfe/trunk/include/clang/Lex/HeaderSearch.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=312112=312111=312112=diff == --- cfe/trunk/include/clang/Lex/HeaderSearch.h (original) +++ cfe/trunk/include/clang/Lex/HeaderSearch.h Wed Aug 30 04:31:56 2017 @@ -471,41 +471,29 @@ public: /// \brief Get filenames for all registered header maps. void getHeaderMapFileNames(SmallVectorImpl ) const; - /// \brief Retrieve the name of the cached module file that should be used - /// to load the given module. + /// \brief Retrieve the name of the module file that should be used to + /// load the given module. /// /// \param Module The module whose module file name will be returned. /// /// \returns The name of the module file that corresponds to this module,
Re: ps4-buildslave1a down 08.23.2017
ps4-buildslave1a is back. On 08/23/2017 08:49 AM, Victor Leschuk wrote: > Hello all, ps4-buildslave1a is currently down. We are detecting the > cause and will fix it ASAP. I will inform when it is accessible again. > > Sorry for the inconvenience. > -- Best Regards, Victor Leschuk | Software Engineer |Access Softek ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
ps4-buildslave1a down 08.23.2017
Hello all, ps4-buildslave1a is currently down. We are detecting the cause and will fix it ASAP. I will inform when it is accessible again. Sorry for the inconvenience. -- Best Regards, Victor Leschuk | Software Engineer |Access Softek ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: Buildmaster restart 08.20.2017
Both buildmasters were updated and currently are up and running. On 08/20/2017 10:47 AM, Victor Leschuk wrote: > Hello everyone, > LLVM buildmasters (both main and staging) will be restarted in 2 hours > (~3:00 AM PDT). > -- Best Regards, Victor Leschuk | Software Engineer |Access Softek ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Buildmaster restart 08.20.2017
Hello everyone, LLVM buildmasters (both main and staging) will be restarted in 2 hours (~3:00 AM PDT). -- Best Regards, Victor Leschuk | Software Engineer |Access Softek ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: ps4-buildslave2 will be disconnected from master
ps4-buildslave2 is now disconnected from buildmaster, it will be back online when we solve the problem with hanging tests. On 08/18/2017 12:03 AM, Victor Leschuk wrote: > ps4-buildslave2 will be temporary disconnected from build master for > debugging purposes. It will be done approximately at 6:00 PM PDT 18, Aug > (Friday). > -- Best Regards, Victor Leschuk | Software Engineer |Access Softek ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
ps4-buildslave2 will be disconnected from master
ps4-buildslave2 will be temporary disconnected from build master for debugging purposes. It will be done approximately at 6:00 PM PDT 18, Aug (Friday). -- Best Regards, Victor Leschuk | Software Engineer |Access Softek ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Buildmaster reconfig
Hello everyone, LLVM buildmaster was updated and restarted, downtime was about 2 minutes. -- Best Regards, Victor Leschuk | Software Engineer |Access Softek ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Buildmaster restart
Hello everyone, LLVM buildmaster was updated and restarted, downtime was about 2 minutes. -- Best Regards, Victor Leschuk | Software Engineer |Access Softek ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Buildmaster restart
Hello everyone, LLVM buildmaster will be updated and restarted approximately at 08:00 AM PDT 4th August. -- Best Regards, Victor Leschuk | Software Engineer |Access Softek ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: Lab is down
Buildbot is up and running. Sorry for the delay. On 08/02/2017 06:31 PM, Victor Leschuk wrote: > Hello all, buildbot is currently down due to hardware failure. We are > currently working on it. Sorry for the inconvenience. > -- Best Regards, Victor ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: Lab is down
There is power outage in the area where the servers are located. They say the power will be restored at 10:45 AM PDT, I'd estimate buildbot online time about ~12:00. On 08/02/2017 06:31 PM, Victor Leschuk wrote: > Hello all, buildbot is currently down due to hardware failure. We are > currently working on it. Sorry for the inconvenience. > -- Best Regards, Victor ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Lab is down
Hello all, buildbot is currently down due to hardware failure. We are currently working on it. Sorry for the inconvenience. -- Best Regards, Victor ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r309484 - Fix incorrect assertion condition.
Author: vleschuk Date: Sat Jul 29 01:18:38 2017 New Revision: 309484 URL: http://llvm.org/viewvc/llvm-project?rev=309484=rev Log: Fix incorrect assertion condition. Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=309484=309483=309484=diff == --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original) +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Sat Jul 29 01:18:38 2017 @@ -643,8 +643,8 @@ struct CallObjCArcUse final : EHScopeSta Value *CodeGenFunction::EmitCheckedArgForBuiltin(const Expr *E, BuiltinCheckKind Kind) { - assert(Kind == BCK_CLZPassedZero || - Kind == BCK_CTZPassedZero && "Unsupported builtin check kind"); + assert((Kind == BCK_CLZPassedZero || Kind == BCK_CTZPassedZero) + && "Unsupported builtin check kind"); Value *ArgValue = EmitScalarExpr(E); if (!SanOpts.has(SanitizerKind::Builtin) || !getTarget().isCLZForZeroUndef()) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Buildmaster restart
Hello everyone, LLVM buildmaster will be updated and restarted approximately at 08:00 AM PDT 28th July. -- Best Regards, Victor Leschuk | Software Engineer |Access Softek ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26145: DebugInfo: support for DW_TAG_atomic_type
This revision was automatically updated to reflect the committed changes. Closed by commit rL285625: DebugInfo: support for DW_TAG_atomic_type (authored by vleschuk). Changed prior to commit: https://reviews.llvm.org/D26145?vs=76441=76458#toc Repository: rL LLVM https://reviews.llvm.org/D26145 Files: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/test/CodeGen/debug-info-atomic.c Index: cfe/trunk/test/CodeGen/debug-info-atomic.c === --- cfe/trunk/test/CodeGen/debug-info-atomic.c +++ cfe/trunk/test/CodeGen/debug-info-atomic.c @@ -0,0 +1,7 @@ +// RUN: %clang -g -c -std=c11 -S -emit-llvm -o - %s | FileCheck %s + +// CHECK: !DIGlobalVariable(name: "i"{{.*}}type: !5, isLocal: false, isDefinition: true) +// CHECK: !5 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !6) +// CHECK: !6 = !DIDerivedType(tag: DW_TAG_atomic_type, baseType: !7) +// CHECK: !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +_Atomic const int i; Index: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp === --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp @@ -2287,9 +2287,8 @@ } llvm::DIType *CGDebugInfo::CreateType(const AtomicType *Ty, llvm::DIFile *U) { - // Ignore the atomic wrapping - // FIXME: What is the correct representation? - return getOrCreateType(Ty->getValueType(), U); + auto *FromTy = getOrCreateType(Ty->getValueType(), U); + return DBuilder.createQualifiedType(llvm::dwarf::DW_TAG_atomic_type, FromTy); } llvm::DIType* CGDebugInfo::CreateType(const PipeType *Ty, Index: cfe/trunk/test/CodeGen/debug-info-atomic.c === --- cfe/trunk/test/CodeGen/debug-info-atomic.c +++ cfe/trunk/test/CodeGen/debug-info-atomic.c @@ -0,0 +1,7 @@ +// RUN: %clang -g -c -std=c11 -S -emit-llvm -o - %s | FileCheck %s + +// CHECK: !DIGlobalVariable(name: "i"{{.*}}type: !5, isLocal: false, isDefinition: true) +// CHECK: !5 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !6) +// CHECK: !6 = !DIDerivedType(tag: DW_TAG_atomic_type, baseType: !7) +// CHECK: !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +_Atomic const int i; Index: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp === --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp @@ -2287,9 +2287,8 @@ } llvm::DIType *CGDebugInfo::CreateType(const AtomicType *Ty, llvm::DIFile *U) { - // Ignore the atomic wrapping - // FIXME: What is the correct representation? - return getOrCreateType(Ty->getValueType(), U); + auto *FromTy = getOrCreateType(Ty->getValueType(), U); + return DBuilder.createQualifiedType(llvm::dwarf::DW_TAG_atomic_type, FromTy); } llvm::DIType* CGDebugInfo::CreateType(const PipeType *Ty, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r285625 - DebugInfo: support for DW_TAG_atomic_type
Author: vleschuk Date: Mon Oct 31 14:09:47 2016 New Revision: 285625 URL: http://llvm.org/viewvc/llvm-project?rev=285625=rev Log: DebugInfo: support for DW_TAG_atomic_type Mark C11 _Atomic variables with DW_TAG_atomic_type tag. Differential Revision: https://reviews.llvm.org/D26145 Added: cfe/trunk/test/CodeGen/debug-info-atomic.c 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=285625=285624=285625=diff == --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Oct 31 14:09:47 2016 @@ -2287,9 +2287,8 @@ llvm::DIType *CGDebugInfo::CreateType(co } llvm::DIType *CGDebugInfo::CreateType(const AtomicType *Ty, llvm::DIFile *U) { - // Ignore the atomic wrapping - // FIXME: What is the correct representation? - return getOrCreateType(Ty->getValueType(), U); + auto *FromTy = getOrCreateType(Ty->getValueType(), U); + return DBuilder.createQualifiedType(llvm::dwarf::DW_TAG_atomic_type, FromTy); } llvm::DIType* CGDebugInfo::CreateType(const PipeType *Ty, Added: cfe/trunk/test/CodeGen/debug-info-atomic.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-atomic.c?rev=285625=auto == --- cfe/trunk/test/CodeGen/debug-info-atomic.c (added) +++ cfe/trunk/test/CodeGen/debug-info-atomic.c Mon Oct 31 14:09:47 2016 @@ -0,0 +1,7 @@ +// RUN: %clang -g -c -std=c11 -S -emit-llvm -o - %s | FileCheck %s + +// CHECK: !DIGlobalVariable(name: "i"{{.*}}type: !5, isLocal: false, isDefinition: true) +// CHECK: !5 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !6) +// CHECK: !6 = !DIDerivedType(tag: DW_TAG_atomic_type, baseType: !7) +// CHECK: !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +_Atomic const int i; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26145: DebugInfo: support for DW_TAG_atomic_type
vleschuk updated this revision to Diff 76441. vleschuk added a comment. Made test more strict: it now checks that variable i is atomic. https://reviews.llvm.org/D26145 Files: lib/CodeGen/CGDebugInfo.cpp test/CodeGen/debug-info-atomic.c Index: test/CodeGen/debug-info-atomic.c === --- /dev/null +++ test/CodeGen/debug-info-atomic.c @@ -0,0 +1,7 @@ +// RUN: %clang -g -c -std=c11 -S -emit-llvm -o - %s | FileCheck %s + +// CHECK: !DIGlobalVariable(name: "i"{{.*}}type: !5, isLocal: false, isDefinition: true) +// CHECK: !5 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !6) +// CHECK: !6 = !DIDerivedType(tag: DW_TAG_atomic_type, baseType: !7) +// CHECK: !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +_Atomic const int i; Index: lib/CodeGen/CGDebugInfo.cpp === --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -2287,9 +2287,8 @@ } llvm::DIType *CGDebugInfo::CreateType(const AtomicType *Ty, llvm::DIFile *U) { - // Ignore the atomic wrapping - // FIXME: What is the correct representation? - return getOrCreateType(Ty->getValueType(), U); + auto *FromTy = getOrCreateType(Ty->getValueType(), U); + return DBuilder.createQualifiedType(llvm::dwarf::DW_TAG_atomic_type, FromTy); } llvm::DIType* CGDebugInfo::CreateType(const PipeType *Ty, Index: test/CodeGen/debug-info-atomic.c === --- /dev/null +++ test/CodeGen/debug-info-atomic.c @@ -0,0 +1,7 @@ +// RUN: %clang -g -c -std=c11 -S -emit-llvm -o - %s | FileCheck %s + +// CHECK: !DIGlobalVariable(name: "i"{{.*}}type: !5, isLocal: false, isDefinition: true) +// CHECK: !5 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !6) +// CHECK: !6 = !DIDerivedType(tag: DW_TAG_atomic_type, baseType: !7) +// CHECK: !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +_Atomic const int i; Index: lib/CodeGen/CGDebugInfo.cpp === --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -2287,9 +2287,8 @@ } llvm::DIType *CGDebugInfo::CreateType(const AtomicType *Ty, llvm::DIFile *U) { - // Ignore the atomic wrapping - // FIXME: What is the correct representation? - return getOrCreateType(Ty->getValueType(), U); + auto *FromTy = getOrCreateType(Ty->getValueType(), U); + return DBuilder.createQualifiedType(llvm::dwarf::DW_TAG_atomic_type, FromTy); } llvm::DIType* CGDebugInfo::CreateType(const PipeType *Ty, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26145: DebugInfo: support for DW_TAG_atomic_type
vleschuk added inline comments. Comment at: test/CodeGen/debug-info-atomic.c:3 + +// CHECK: !DIDerivedType(tag: DW_TAG_const_type +// CHECK: !DIDerivedType(tag: DW_TAG_atomic_type aprantl wrote: > Why do we need the const here? I thought it would be better to make sure that "enabling" atomic doesn't affect other qualifiers. https://reviews.llvm.org/D26145 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26145: DebugInfo: support for DW_TAG_atomic_type
vleschuk created this revision. vleschuk added reviewers: mehdi_amini, echristo, dblaikie, aprantl. vleschuk added a subscriber: cfe-commits. Mark C11 _Atomic variables with DW_TAG_atomic_type tag. This is the simplest way to achieve the goal: modifying Qualifiers results in much more changes and putting emission of tag into CreateQualifiedType() along with DW_TAG_const_type and friends seems more logic but requires way more changes and could break something else (my first attempt to add atomic to qualifiers resulted in lots of failures in OpenCL tests for some reason). https://reviews.llvm.org/D26145 Files: lib/CodeGen/CGDebugInfo.cpp test/CodeGen/debug-info-atomic.c Index: test/CodeGen/debug-info-atomic.c === --- /dev/null +++ test/CodeGen/debug-info-atomic.c @@ -0,0 +1,5 @@ +// RUN: %clang -g -c -std=c11 -S -emit-llvm -o - %s | FileCheck %s + +// CHECK: !DIDerivedType(tag: DW_TAG_const_type +// CHECK: !DIDerivedType(tag: DW_TAG_atomic_type +_Atomic const int i; Index: lib/CodeGen/CGDebugInfo.cpp === --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -2287,9 +2287,8 @@ } llvm::DIType *CGDebugInfo::CreateType(const AtomicType *Ty, llvm::DIFile *U) { - // Ignore the atomic wrapping - // FIXME: What is the correct representation? - return getOrCreateType(Ty->getValueType(), U); + auto *FromTy = getOrCreateType(Ty->getValueType(), U); + return DBuilder.createQualifiedType(llvm::dwarf::DW_TAG_atomic_type, FromTy); } llvm::DIType* CGDebugInfo::CreateType(const PipeType *Ty, Index: test/CodeGen/debug-info-atomic.c === --- /dev/null +++ test/CodeGen/debug-info-atomic.c @@ -0,0 +1,5 @@ +// RUN: %clang -g -c -std=c11 -S -emit-llvm -o - %s | FileCheck %s + +// CHECK: !DIDerivedType(tag: DW_TAG_const_type +// CHECK: !DIDerivedType(tag: DW_TAG_atomic_type +_Atomic const int i; Index: lib/CodeGen/CGDebugInfo.cpp === --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -2287,9 +2287,8 @@ } llvm::DIType *CGDebugInfo::CreateType(const AtomicType *Ty, llvm::DIFile *U) { - // Ignore the atomic wrapping - // FIXME: What is the correct representation? - return getOrCreateType(Ty->getValueType(), U); + auto *FromTy = getOrCreateType(Ty->getValueType(), U); + return DBuilder.createQualifiedType(llvm::dwarf::DW_TAG_atomic_type, FromTy); } llvm::DIType* CGDebugInfo::CreateType(const PipeType *Ty, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284683 - Upgrade debug-info-vla test: we do not pass default alignment now
Author: vleschuk Date: Wed Oct 19 19:37:07 2016 New Revision: 284683 URL: http://llvm.org/viewvc/llvm-project?rev=284683=rev Log: Upgrade debug-info-vla test: we do not pass default alignment now Modified: cfe/trunk/test/CodeGenCXX/debug-info-vla.cpp Modified: cfe/trunk/test/CodeGenCXX/debug-info-vla.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-vla.cpp?rev=284683=284682=284683=diff == --- cfe/trunk/test/CodeGenCXX/debug-info-vla.cpp (original) +++ cfe/trunk/test/CodeGenCXX/debug-info-vla.cpp Wed Oct 19 19:37:07 2016 @@ -15,7 +15,6 @@ int (*fp)(int[][*]) = nullptr; // // CHECK: !DICompositeType(tag: DW_TAG_array_type, // CHECK-NOT: size: -// CHECK-SAME: align: 32 // CHECK-SAME: elements: [[ELEM_TYPE:![0-9]+]] // CHECK: [[ELEM_TYPE]] = !{[[THREE:.*]], [[NOCOUNT]]} // CHECK: [[THREE]] = !DISubrange(count: 3) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24426: DebugInfo: Pass non-zero alignment to DIBuilder only if aligment was forced
This revision was automatically updated to reflect the committed changes. Closed by commit rL284679: DebugInfo: pass alignment value only if it was forced (authored by vleschuk). Changed prior to commit: https://reviews.llvm.org/D24426?vs=74686=75261#toc Repository: rL LLVM https://reviews.llvm.org/D24426 Files: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/lib/CodeGen/CGDebugInfo.h cfe/trunk/test/CodeGen/debug-info-packed-struct.c cfe/trunk/test/CodeGen/debug-info-vector.c cfe/trunk/test/CodeGenCXX/debug-info-calling-conventions.cpp cfe/trunk/test/CodeGenCXX/debug-info-enum-class.cpp cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp cfe/trunk/test/CodeGenCXX/debug-info-ms-bitfields.cpp cfe/trunk/test/CodeGenCXX/debug-info-ms-ptr-to-member.cpp cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp cfe/trunk/test/CodeGenCXX/debug-info-template-quals.cpp cfe/trunk/test/CodeGenCXX/debug-info-template.cpp cfe/trunk/test/CodeGenCXX/debug-info-union.cpp cfe/trunk/test/CodeGenCXX/debug-info-uuid.cpp cfe/trunk/test/CodeGenCXX/debug-info-vla.cpp cfe/trunk/test/CodeGenCXX/debug-info-zero-length-arrays.cpp cfe/trunk/test/CodeGenCXX/debug-info.cpp cfe/trunk/test/CodeGenCXX/debug-lambda-this.cpp cfe/trunk/test/CodeGenObjC/block-byref-debuginfo.m cfe/trunk/test/CodeGenObjC/debug-info-block-type.m cfe/trunk/test/CodeGenObjC/debug-info-ivars-extension.m cfe/trunk/test/CodeGenObjC/debug-info-ivars-private.m cfe/trunk/test/CodeGenObjC/debug-info-ivars.m cfe/trunk/test/CodeGenObjCXX/debug-info-cyclic.mm Index: cfe/trunk/test/CodeGen/debug-info-packed-struct.c === --- cfe/trunk/test/CodeGen/debug-info-packed-struct.c +++ cfe/trunk/test/CodeGen/debug-info-packed-struct.c @@ -19,9 +19,9 @@ }; // CHECK: l0_ofs0 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l0_ofs8", -// CHECK-SAME: {{.*}}size: 64, align: 64, offset: 64) +// CHECK-SAME: {{.*}}size: 64, offset: 64) // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l0_ofs16", -// CHECK-SAME: {{.*}}size: 1, align: 32, offset: 128, flags: DIFlagBitField, extraData: i64 128) +// CHECK-SAME: {{.*}}size: 1, offset: 128, flags: DIFlagBitField, extraData: i64 128) // - @@ -38,9 +38,9 @@ }; // CHECK: l1_ofs0 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l1_ofs1", -// CHECK-SAME: {{.*}}size: 64, align: 8, offset: 8) +// CHECK-SAME: {{.*}}size: 64, offset: 8) // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l1_ofs9", -// CHECK-SAME: {{.*}}size: 1, align: 32, offset: 72, flags: DIFlagBitField, extraData: i64 72) +// CHECK-SAME: {{.*}}size: 1, offset: 72, flags: DIFlagBitField, extraData: i64 72) // - @@ -59,9 +59,9 @@ #pragma pack() // CHECK: l2_ofs0 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l2_ofs1", -// CHECK-SAME: {{.*}}size: 64, align: 8, offset: 8) +// CHECK-SAME: {{.*}}size: 64, offset: 8) // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l2_ofs9", -// CHECK-SAME: {{.*}}size: 1, align: 32, offset: 72, flags: DIFlagBitField, extraData: i64 72) +// CHECK-SAME: {{.*}}size: 1, offset: 72, flags: DIFlagBitField, extraData: i64 72) @@ -81,9 +81,9 @@ #pragma pack() // CHECK: l3_ofs0 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l3_ofs4", -// CHECK-SAME: {{.*}}size: 64, align: 32, offset: 32) +// CHECK-SAME: {{.*}}size: 64, offset: 32) // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l3_ofs12", -// CHECK-SAME: {{.*}}size: 1, align: 32, offset: 96, flags: DIFlagBitField, extraData: i64 96) +// CHECK-SAME: {{.*}}size: 1, offset: 96, flags: DIFlagBitField, extraData: i64 96) struct layout3 l3; struct layout0 l0; Index: cfe/trunk/test/CodeGen/debug-info-vector.c === --- cfe/trunk/test/CodeGen/debug-info-vector.c +++ cfe/trunk/test/CodeGen/debug-info-vector.c @@ -6,6 +6,6 @@ // Test that we get an array type that's also a vector out of debug. // CHECK: !DICompositeType(tag: DW_TAG_array_type, // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 128, align: 128 +// CHECK-SAME: size: 128 // CHECK-SAME: DIFlagVector // CHECK: ![[INT]] = !DIBasicType(name: "int" Index: cfe/trunk/test/CodeGenObjC/block-byref-debuginfo.m === --- cfe/trunk/test/CodeGenObjC/block-byref-debuginfo.m +++ cfe/trunk/test/CodeGenObjC/block-byref-debuginfo.m @@ -5,7 +5,6 @@ // expression (256) that locates it inside of the byref descriptor: // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "foo", // CHECK-NOT:line: -// CHECK-SAME: align: 64 // CHECK-SAME: offset: 256 struct Foo { Index:
r284679 - DebugInfo: pass alignment value only if it was forced
Author: vleschuk Date: Wed Oct 19 19:13:19 2016 New Revision: 284679 URL: http://llvm.org/viewvc/llvm-project?rev=284679=rev Log: DebugInfo: pass alignment value only if it was forced Preparation to implement DW_AT_alignment support: - We pass non-zero align value to DIBuilder only when alignment was forced - Modify tests to match this change Differential Revision: https://reviews.llvm.org/D24426 Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/lib/CodeGen/CGDebugInfo.h cfe/trunk/test/CodeGen/debug-info-packed-struct.c cfe/trunk/test/CodeGen/debug-info-vector.c cfe/trunk/test/CodeGenCXX/debug-info-calling-conventions.cpp cfe/trunk/test/CodeGenCXX/debug-info-enum-class.cpp cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp cfe/trunk/test/CodeGenCXX/debug-info-ms-bitfields.cpp cfe/trunk/test/CodeGenCXX/debug-info-ms-ptr-to-member.cpp cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp cfe/trunk/test/CodeGenCXX/debug-info-template-quals.cpp cfe/trunk/test/CodeGenCXX/debug-info-template.cpp cfe/trunk/test/CodeGenCXX/debug-info-union.cpp cfe/trunk/test/CodeGenCXX/debug-info-uuid.cpp cfe/trunk/test/CodeGenCXX/debug-info-vla.cpp cfe/trunk/test/CodeGenCXX/debug-info-zero-length-arrays.cpp cfe/trunk/test/CodeGenCXX/debug-info.cpp cfe/trunk/test/CodeGenCXX/debug-lambda-this.cpp cfe/trunk/test/CodeGenObjC/block-byref-debuginfo.m cfe/trunk/test/CodeGenObjC/debug-info-block-type.m cfe/trunk/test/CodeGenObjC/debug-info-ivars-extension.m cfe/trunk/test/CodeGenObjC/debug-info-ivars-private.m cfe/trunk/test/CodeGenObjC/debug-info-ivars.m cfe/trunk/test/CodeGenObjCXX/debug-info-cyclic.mm Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=284679=284678=284679=diff == --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Oct 19 19:13:19 2016 @@ -44,6 +44,19 @@ using namespace clang; using namespace clang::CodeGen; +static uint32_t getTypeAlignIfRequired(const Type *Ty, const ASTContext ) { + auto TI = Ctx.getTypeInfo(Ty); + return TI.AlignIsRequired ? TI.Align : 0; +} + +static uint32_t getTypeAlignIfRequired(QualType Ty, const ASTContext ) { + return getTypeAlignIfRequired(Ty.getTypePtr(), Ctx); +} + +static uint32_t getDeclAlignIfRequired(const Decl *D, const ASTContext ) { + return D->hasAttr() ? D->getMaxAlignment() : 0; +} + CGDebugInfo::CGDebugInfo(CodeGenModule ) : CGM(CGM), DebugKind(CGM.getCodeGenOpts().getDebugInfo()), DebugTypeExtRefs(CGM.getCodeGenOpts().DebugTypeExtRefs), @@ -594,21 +607,19 @@ llvm::DIType *CGDebugInfo::CreateType(co BTName = BT->getName(CGM.getLangOpts()); break; } - // Bit size, align and offset of the type. + // Bit size and offset of the type. uint64_t Size = CGM.getContext().getTypeSize(BT); - uint32_t Align = CGM.getContext().getTypeAlign(BT); - return DBuilder.createBasicType(BTName, Size, Align, Encoding); + return DBuilder.createBasicType(BTName, Size, Encoding); } llvm::DIType *CGDebugInfo::CreateType(const ComplexType *Ty) { - // Bit size, align and offset of the type. + // Bit size and offset of the type. llvm::dwarf::TypeKind Encoding = llvm::dwarf::DW_ATE_complex_float; if (Ty->isComplexIntegerType()) Encoding = llvm::dwarf::DW_ATE_lo_user; uint64_t Size = CGM.getContext().getTypeSize(Ty); - uint32_t Align = CGM.getContext().getTypeAlign(Ty); - return DBuilder.createBasicType("complex", Size, Align, Encoding); + return DBuilder.createBasicType("complex", Size, Encoding); } llvm::DIType *CGDebugInfo::CreateQualifiedType(QualType Ty, @@ -726,7 +737,7 @@ CGDebugInfo::getOrCreateRecordFwdDecl(co const RecordDecl *D = RD->getDefinition(); if (D && D->isCompleteDefinition()) { Size = CGM.getContext().getTypeSize(Ty); -Align = CGM.getContext().getTypeAlign(Ty); +Align = getDeclAlignIfRequired(D, CGM.getContext()); } // Create the type. @@ -749,7 +760,7 @@ llvm::DIType *CGDebugInfo::CreatePointer // because that does not return the correct value for references. unsigned AS = CGM.getContext().getTargetAddressSpace(PointeeTy); uint64_t Size = CGM.getTarget().getPointerWidth(AS); - uint32_t Align = CGM.getContext().getTypeAlign(Ty); + auto Align = getTypeAlignIfRequired(Ty, CGM.getContext()); if (Tag == llvm::dwarf::DW_TAG_reference_type || Tag == llvm::dwarf::DW_TAG_rvalue_reference_type) @@ -965,21 +976,20 @@ llvm::DIType *CGDebugInfo::createBitFiel CGM.getTypes().getCGRecordLayout(RD).getBitFieldInfo(BitFieldDecl); uint64_t SizeInBits = BitFieldInfo.Size; assert(SizeInBits > 0 && "found named 0-width bitfield"); - uint32_t AlignInBits = CGM.getContext().getTypeAlign(Ty); uint64_t StorageOffsetInBits =
[PATCH] D25621: DebugInfo: use uin32_t for alignment
This revision was automatically updated to reflect the committed changes. Closed by commit rL284651: DebugInfo: use uint32_t for alignment variables. (authored by vleschuk). Changed prior to commit: https://reviews.llvm.org/D25621?vs=75143=75241#toc Repository: rL LLVM https://reviews.llvm.org/D25621 Files: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Index: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp === --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp @@ -596,7 +596,7 @@ } // Bit size, align and offset of the type. uint64_t Size = CGM.getContext().getTypeSize(BT); - uint64_t Align = CGM.getContext().getTypeAlign(BT); + uint32_t Align = CGM.getContext().getTypeAlign(BT); return DBuilder.createBasicType(BTName, Size, Align, Encoding); } @@ -607,7 +607,7 @@ Encoding = llvm::dwarf::DW_ATE_lo_user; uint64_t Size = CGM.getContext().getTypeSize(Ty); - uint64_t Align = CGM.getContext().getTypeAlign(Ty); + uint32_t Align = CGM.getContext().getTypeAlign(Ty); return DBuilder.createBasicType("complex", Size, Align, Encoding); } @@ -721,7 +721,7 @@ StringRef RDName = getClassName(RD); uint64_t Size = 0; - uint64_t Align = 0; + uint32_t Align = 0; const RecordDecl *D = RD->getDefinition(); if (D && D->isCompleteDefinition()) { @@ -749,7 +749,7 @@ // because that does not return the correct value for references. unsigned AS = CGM.getContext().getTargetAddressSpace(PointeeTy); uint64_t Size = CGM.getTarget().getPointerWidth(AS); - uint64_t Align = CGM.getContext().getTypeAlign(Ty); + uint32_t Align = CGM.getContext().getTypeAlign(Ty); if (Tag == llvm::dwarf::DW_TAG_reference_type || Tag == llvm::dwarf::DW_TAG_rvalue_reference_type) @@ -776,7 +776,7 @@ SmallVector EltTys; QualType FType; uint64_t FieldSize, FieldOffset; - unsigned FieldAlign; + uint32_t FieldAlign; llvm::DINodeArray Elements; FieldOffset = 0; @@ -965,7 +965,7 @@ CGM.getTypes().getCGRecordLayout(RD).getBitFieldInfo(BitFieldDecl); uint64_t SizeInBits = BitFieldInfo.Size; assert(SizeInBits > 0 && "found named 0-width bitfield"); - unsigned AlignInBits = CGM.getContext().getTypeAlign(Ty); + uint32_t AlignInBits = CGM.getContext().getTypeAlign(Ty); uint64_t StorageOffsetInBits = CGM.getContext().toBits(BitFieldInfo.StorageOffset); uint64_t OffsetInBits = StorageOffsetInBits + BitFieldInfo.Offset; @@ -987,7 +987,7 @@ unsigned line = getLineNumber(loc); uint64_t SizeInBits = 0; - unsigned AlignInBits = 0; + uint32_t AlignInBits = 0; if (!type->isIncompleteArrayType()) { TypeInfo TI = CGM.getContext().getTypeInfo(type); SizeInBits = TI.Width; @@ -1181,7 +1181,7 @@ QualType PointeeTy = ThisPtrTy->getPointeeType(); unsigned AS = CGM.getContext().getTargetAddressSpace(PointeeTy); uint64_t Size = CGM.getTarget().getPointerWidth(AS); -uint64_t Align = CGM.getContext().getTypeAlign(ThisPtrTy); +uint32_t Align = CGM.getContext().getTypeAlign(ThisPtrTy); llvm::DIType *PointeeType = getOrCreateType(PointeeTy, Unit); llvm::DIType *ThisPtrType = DBuilder.createPointerType(PointeeType, Size, Align); @@ -1968,7 +1968,7 @@ // Bit size, align and offset of the type. uint64_t Size = CGM.getContext().getTypeSize(Ty); - uint64_t Align = CGM.getContext().getTypeAlign(Ty); + uint32_t Align = CGM.getContext().getTypeAlign(Ty); llvm::DINode::DIFlags Flags = llvm::DINode::FlagZero; if (ID->getImplementation()) @@ -2052,7 +2052,7 @@ unsigned FieldLine = getLineNumber(Field->getLocation()); QualType FType = Field->getType(); uint64_t FieldSize = 0; -unsigned FieldAlign = 0; +uint32_t FieldAlign = 0; if (!FType->isIncompleteArrayType()) { @@ -2134,14 +2134,14 @@ llvm::DINodeArray SubscriptArray = DBuilder.getOrCreateArray(Subscript); uint64_t Size = CGM.getContext().getTypeSize(Ty); - uint64_t Align = CGM.getContext().getTypeAlign(Ty); + uint32_t Align = CGM.getContext().getTypeAlign(Ty); return DBuilder.createVectorType(Size, Align, ElementTy, SubscriptArray); } llvm::DIType *CGDebugInfo::CreateType(const ArrayType *Ty, llvm::DIFile *Unit) { uint64_t Size; - uint64_t Align; + uint32_t Align; // FIXME: make getTypeAlign() aware of VLAs and incomplete array types if (const auto *VAT = dyn_cast(Ty)) { @@ -2264,7 +2264,7 @@ const EnumDecl *ED = Ty->getDecl(); uint64_t Size = 0; - uint64_t Align = 0; + uint32_t Align = 0; if (!ED->getTypeForDecl()->isIncompleteType()) { Size = CGM.getContext().getTypeSize(ED->getTypeForDecl()); Align = CGM.getContext().getTypeAlign(ED->getTypeForDecl()); @@ -2307,7 +2307,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) { const EnumDecl *ED = Ty->getDecl(); uint64_t Size = 0; - uint64_t Align = 0; + uint32_t Align = 0; if
r284651 - DebugInfo: use uint32_t for alignment variables.
Author: vleschuk Date: Wed Oct 19 17:11:07 2016 New Revision: 284651 URL: http://llvm.org/viewvc/llvm-project?rev=284651=rev Log: DebugInfo: use uint32_t for alignment variables. LLVM now uses uint32_t for DebugInfo alignment for space efficiency, in this patch we change frontend DebugInfo-related variables to uint32_t too. Differential Revision: https://reviews.llvm.org/D25621 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=284651=284650=284651=diff == --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Oct 19 17:11:07 2016 @@ -596,7 +596,7 @@ llvm::DIType *CGDebugInfo::CreateType(co } // Bit size, align and offset of the type. uint64_t Size = CGM.getContext().getTypeSize(BT); - uint64_t Align = CGM.getContext().getTypeAlign(BT); + uint32_t Align = CGM.getContext().getTypeAlign(BT); return DBuilder.createBasicType(BTName, Size, Align, Encoding); } @@ -607,7 +607,7 @@ llvm::DIType *CGDebugInfo::CreateType(co Encoding = llvm::dwarf::DW_ATE_lo_user; uint64_t Size = CGM.getContext().getTypeSize(Ty); - uint64_t Align = CGM.getContext().getTypeAlign(Ty); + uint32_t Align = CGM.getContext().getTypeAlign(Ty); return DBuilder.createBasicType("complex", Size, Align, Encoding); } @@ -721,7 +721,7 @@ CGDebugInfo::getOrCreateRecordFwdDecl(co StringRef RDName = getClassName(RD); uint64_t Size = 0; - uint64_t Align = 0; + uint32_t Align = 0; const RecordDecl *D = RD->getDefinition(); if (D && D->isCompleteDefinition()) { @@ -749,7 +749,7 @@ llvm::DIType *CGDebugInfo::CreatePointer // because that does not return the correct value for references. unsigned AS = CGM.getContext().getTargetAddressSpace(PointeeTy); uint64_t Size = CGM.getTarget().getPointerWidth(AS); - uint64_t Align = CGM.getContext().getTypeAlign(Ty); + uint32_t Align = CGM.getContext().getTypeAlign(Ty); if (Tag == llvm::dwarf::DW_TAG_reference_type || Tag == llvm::dwarf::DW_TAG_rvalue_reference_type) @@ -776,7 +776,7 @@ llvm::DIType *CGDebugInfo::CreateType(co SmallVector EltTys; QualType FType; uint64_t FieldSize, FieldOffset; - unsigned FieldAlign; + uint32_t FieldAlign; llvm::DINodeArray Elements; FieldOffset = 0; @@ -965,7 +965,7 @@ llvm::DIType *CGDebugInfo::createBitFiel CGM.getTypes().getCGRecordLayout(RD).getBitFieldInfo(BitFieldDecl); uint64_t SizeInBits = BitFieldInfo.Size; assert(SizeInBits > 0 && "found named 0-width bitfield"); - unsigned AlignInBits = CGM.getContext().getTypeAlign(Ty); + uint32_t AlignInBits = CGM.getContext().getTypeAlign(Ty); uint64_t StorageOffsetInBits = CGM.getContext().toBits(BitFieldInfo.StorageOffset); uint64_t OffsetInBits = StorageOffsetInBits + BitFieldInfo.Offset; @@ -987,7 +987,7 @@ CGDebugInfo::createFieldType(StringRef n unsigned line = getLineNumber(loc); uint64_t SizeInBits = 0; - unsigned AlignInBits = 0; + uint32_t AlignInBits = 0; if (!type->isIncompleteArrayType()) { TypeInfo TI = CGM.getContext().getTypeInfo(type); SizeInBits = TI.Width; @@ -1181,7 +1181,7 @@ llvm::DISubroutineType *CGDebugInfo::get QualType PointeeTy = ThisPtrTy->getPointeeType(); unsigned AS = CGM.getContext().getTargetAddressSpace(PointeeTy); uint64_t Size = CGM.getTarget().getPointerWidth(AS); -uint64_t Align = CGM.getContext().getTypeAlign(ThisPtrTy); +uint32_t Align = CGM.getContext().getTypeAlign(ThisPtrTy); llvm::DIType *PointeeType = getOrCreateType(PointeeTy, Unit); llvm::DIType *ThisPtrType = DBuilder.createPointerType(PointeeType, Size, Align); @@ -1968,7 +1968,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDef // Bit size, align and offset of the type. uint64_t Size = CGM.getContext().getTypeSize(Ty); - uint64_t Align = CGM.getContext().getTypeAlign(Ty); + uint32_t Align = CGM.getContext().getTypeAlign(Ty); llvm::DINode::DIFlags Flags = llvm::DINode::FlagZero; if (ID->getImplementation()) @@ -2052,7 +2052,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDef unsigned FieldLine = getLineNumber(Field->getLocation()); QualType FType = Field->getType(); uint64_t FieldSize = 0; -unsigned FieldAlign = 0; +uint32_t FieldAlign = 0; if (!FType->isIncompleteArrayType()) { @@ -2134,14 +2134,14 @@ llvm::DIType *CGDebugInfo::CreateType(co llvm::DINodeArray SubscriptArray = DBuilder.getOrCreateArray(Subscript); uint64_t Size = CGM.getContext().getTypeSize(Ty); - uint64_t Align = CGM.getContext().getTypeAlign(Ty); + uint32_t Align = CGM.getContext().getTypeAlign(Ty); return DBuilder.createVectorType(Size, Align, ElementTy, SubscriptArray); } llvm::DIType *CGDebugInfo::CreateType(const ArrayType *Ty, llvm::DIFile *Unit) { uint64_t Size;
[PATCH] D25621: DebugInfo: use uin32_t for alignment
vleschuk added a comment. In https://reviews.llvm.org/D25621#573671, @aprantl wrote: > This patch is conflating two set of changes: > (1) NFC: rename all occurrences of unsigned for alignment purposes in the > frontend with uint32_t > (2) shrink all debug-info-related alignment variables from uint64_t -> > unint32_t. > > I think this patch should only be doing the changes in (2). Agreed. Update this one. The (1) will come as separate NFC review along with corresponding LLVM patch. https://reviews.llvm.org/D25621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25621: DebugInfo: use uin32_t for alignment
vleschuk updated this revision to Diff 75143. vleschuk added a comment. - Removed all changes non-related to CGDebugInfo: will post them in separate NFC patch which will switch all unsigned alignment entries to uint32_t. https://reviews.llvm.org/D25621 Files: lib/CodeGen/CGDebugInfo.cpp Index: lib/CodeGen/CGDebugInfo.cpp === --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -596,7 +596,7 @@ } // Bit size, align and offset of the type. uint64_t Size = CGM.getContext().getTypeSize(BT); - uint64_t Align = CGM.getContext().getTypeAlign(BT); + uint32_t Align = CGM.getContext().getTypeAlign(BT); return DBuilder.createBasicType(BTName, Size, Align, Encoding); } @@ -607,7 +607,7 @@ Encoding = llvm::dwarf::DW_ATE_lo_user; uint64_t Size = CGM.getContext().getTypeSize(Ty); - uint64_t Align = CGM.getContext().getTypeAlign(Ty); + uint32_t Align = CGM.getContext().getTypeAlign(Ty); return DBuilder.createBasicType("complex", Size, Align, Encoding); } @@ -721,7 +721,7 @@ StringRef RDName = getClassName(RD); uint64_t Size = 0; - uint64_t Align = 0; + uint32_t Align = 0; const RecordDecl *D = RD->getDefinition(); if (D && D->isCompleteDefinition()) { @@ -749,7 +749,7 @@ // because that does not return the correct value for references. unsigned AS = CGM.getContext().getTargetAddressSpace(PointeeTy); uint64_t Size = CGM.getTarget().getPointerWidth(AS); - uint64_t Align = CGM.getContext().getTypeAlign(Ty); + uint32_t Align = CGM.getContext().getTypeAlign(Ty); if (Tag == llvm::dwarf::DW_TAG_reference_type || Tag == llvm::dwarf::DW_TAG_rvalue_reference_type) @@ -776,7 +776,7 @@ SmallVector EltTys; QualType FType; uint64_t FieldSize, FieldOffset; - unsigned FieldAlign; + uint32_t FieldAlign; llvm::DINodeArray Elements; FieldOffset = 0; @@ -965,7 +965,7 @@ CGM.getTypes().getCGRecordLayout(RD).getBitFieldInfo(BitFieldDecl); uint64_t SizeInBits = BitFieldInfo.Size; assert(SizeInBits > 0 && "found named 0-width bitfield"); - unsigned AlignInBits = CGM.getContext().getTypeAlign(Ty); + uint32_t AlignInBits = CGM.getContext().getTypeAlign(Ty); uint64_t StorageOffsetInBits = CGM.getContext().toBits(BitFieldInfo.StorageOffset); uint64_t OffsetInBits = StorageOffsetInBits + BitFieldInfo.Offset; @@ -987,7 +987,7 @@ unsigned line = getLineNumber(loc); uint64_t SizeInBits = 0; - unsigned AlignInBits = 0; + uint32_t AlignInBits = 0; if (!type->isIncompleteArrayType()) { TypeInfo TI = CGM.getContext().getTypeInfo(type); SizeInBits = TI.Width; @@ -1181,7 +1181,7 @@ QualType PointeeTy = ThisPtrTy->getPointeeType(); unsigned AS = CGM.getContext().getTargetAddressSpace(PointeeTy); uint64_t Size = CGM.getTarget().getPointerWidth(AS); -uint64_t Align = CGM.getContext().getTypeAlign(ThisPtrTy); +uint32_t Align = CGM.getContext().getTypeAlign(ThisPtrTy); llvm::DIType *PointeeType = getOrCreateType(PointeeTy, Unit); llvm::DIType *ThisPtrType = DBuilder.createPointerType(PointeeType, Size, Align); @@ -1968,7 +1968,7 @@ // Bit size, align and offset of the type. uint64_t Size = CGM.getContext().getTypeSize(Ty); - uint64_t Align = CGM.getContext().getTypeAlign(Ty); + uint32_t Align = CGM.getContext().getTypeAlign(Ty); llvm::DINode::DIFlags Flags = llvm::DINode::FlagZero; if (ID->getImplementation()) @@ -2052,7 +2052,7 @@ unsigned FieldLine = getLineNumber(Field->getLocation()); QualType FType = Field->getType(); uint64_t FieldSize = 0; -unsigned FieldAlign = 0; +uint32_t FieldAlign = 0; if (!FType->isIncompleteArrayType()) { @@ -2134,14 +2134,14 @@ llvm::DINodeArray SubscriptArray = DBuilder.getOrCreateArray(Subscript); uint64_t Size = CGM.getContext().getTypeSize(Ty); - uint64_t Align = CGM.getContext().getTypeAlign(Ty); + uint32_t Align = CGM.getContext().getTypeAlign(Ty); return DBuilder.createVectorType(Size, Align, ElementTy, SubscriptArray); } llvm::DIType *CGDebugInfo::CreateType(const ArrayType *Ty, llvm::DIFile *Unit) { uint64_t Size; - uint64_t Align; + uint32_t Align; // FIXME: make getTypeAlign() aware of VLAs and incomplete array types if (const auto *VAT = dyn_cast(Ty)) { @@ -2264,7 +2264,7 @@ const EnumDecl *ED = Ty->getDecl(); uint64_t Size = 0; - uint64_t Align = 0; + uint32_t Align = 0; if (!ED->getTypeForDecl()->isIncompleteType()) { Size = CGM.getContext().getTypeSize(ED->getTypeForDecl()); Align = CGM.getContext().getTypeAlign(ED->getTypeForDecl()); @@ -2307,7 +2307,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) { const EnumDecl *ED = Ty->getDecl(); uint64_t Size = 0; - uint64_t Align = 0; + uint32_t Align = 0; if (!ED->getTypeForDecl()->isIncompleteType()) { Size = CGM.getContext().getTypeSize(ED->getTypeForDecl());
[PATCH] D25621: DebugInfo: use uin32_t for alignment
vleschuk added a comment. Can anyone take a look at this please? =) https://reviews.llvm.org/D25621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25621: DebugInfo: use DIAlignment type.
vleschuk updated this revision to Diff 74899. vleschuk added a comment. - Use uint32_t directly for alignment instead of creating typedef ofr it - Get rid of DebugInfo dependency in AST https://reviews.llvm.org/D25621 Files: include/clang/AST/ASTContext.h include/clang/AST/DeclBase.h lib/AST/DeclBase.cpp lib/CodeGen/CGDebugInfo.cpp Index: lib/CodeGen/CGDebugInfo.cpp === --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -596,7 +596,7 @@ } // Bit size, align and offset of the type. uint64_t Size = CGM.getContext().getTypeSize(BT); - uint64_t Align = CGM.getContext().getTypeAlign(BT); + auto Align = CGM.getContext().getTypeAlign(BT); return DBuilder.createBasicType(BTName, Size, Align, Encoding); } @@ -607,7 +607,7 @@ Encoding = llvm::dwarf::DW_ATE_lo_user; uint64_t Size = CGM.getContext().getTypeSize(Ty); - uint64_t Align = CGM.getContext().getTypeAlign(Ty); + auto Align = CGM.getContext().getTypeAlign(Ty); return DBuilder.createBasicType("complex", Size, Align, Encoding); } @@ -721,7 +721,7 @@ StringRef RDName = getClassName(RD); uint64_t Size = 0; - uint64_t Align = 0; + uint32_t Align = 0; const RecordDecl *D = RD->getDefinition(); if (D && D->isCompleteDefinition()) { @@ -749,7 +749,7 @@ // because that does not return the correct value for references. unsigned AS = CGM.getContext().getTargetAddressSpace(PointeeTy); uint64_t Size = CGM.getTarget().getPointerWidth(AS); - uint64_t Align = CGM.getContext().getTypeAlign(Ty); + auto Align = CGM.getContext().getTypeAlign(Ty); if (Tag == llvm::dwarf::DW_TAG_reference_type || Tag == llvm::dwarf::DW_TAG_rvalue_reference_type) @@ -776,7 +776,7 @@ SmallVector EltTys; QualType FType; uint64_t FieldSize, FieldOffset; - unsigned FieldAlign; + uint32_t FieldAlign; llvm::DINodeArray Elements; FieldOffset = 0; @@ -965,7 +965,7 @@ CGM.getTypes().getCGRecordLayout(RD).getBitFieldInfo(BitFieldDecl); uint64_t SizeInBits = BitFieldInfo.Size; assert(SizeInBits > 0 && "found named 0-width bitfield"); - unsigned AlignInBits = CGM.getContext().getTypeAlign(Ty); + auto AlignInBits = CGM.getContext().getTypeAlign(Ty); uint64_t StorageOffsetInBits = CGM.getContext().toBits(BitFieldInfo.StorageOffset); uint64_t OffsetInBits = StorageOffsetInBits + BitFieldInfo.Offset; @@ -987,7 +987,7 @@ unsigned line = getLineNumber(loc); uint64_t SizeInBits = 0; - unsigned AlignInBits = 0; + uint32_t AlignInBits = 0; if (!type->isIncompleteArrayType()) { TypeInfo TI = CGM.getContext().getTypeInfo(type); SizeInBits = TI.Width; @@ -1181,7 +1181,7 @@ QualType PointeeTy = ThisPtrTy->getPointeeType(); unsigned AS = CGM.getContext().getTargetAddressSpace(PointeeTy); uint64_t Size = CGM.getTarget().getPointerWidth(AS); -uint64_t Align = CGM.getContext().getTypeAlign(ThisPtrTy); +auto Align = CGM.getContext().getTypeAlign(ThisPtrTy); llvm::DIType *PointeeType = getOrCreateType(PointeeTy, Unit); llvm::DIType *ThisPtrType = DBuilder.createPointerType(PointeeType, Size, Align); @@ -1968,7 +1968,7 @@ // Bit size, align and offset of the type. uint64_t Size = CGM.getContext().getTypeSize(Ty); - uint64_t Align = CGM.getContext().getTypeAlign(Ty); + auto Align = CGM.getContext().getTypeAlign(Ty); llvm::DINode::DIFlags Flags = llvm::DINode::FlagZero; if (ID->getImplementation()) @@ -2052,7 +2052,7 @@ unsigned FieldLine = getLineNumber(Field->getLocation()); QualType FType = Field->getType(); uint64_t FieldSize = 0; -unsigned FieldAlign = 0; +uint32_t FieldAlign = 0; if (!FType->isIncompleteArrayType()) { @@ -2134,14 +2134,14 @@ llvm::DINodeArray SubscriptArray = DBuilder.getOrCreateArray(Subscript); uint64_t Size = CGM.getContext().getTypeSize(Ty); - uint64_t Align = CGM.getContext().getTypeAlign(Ty); + auto Align = CGM.getContext().getTypeAlign(Ty); return DBuilder.createVectorType(Size, Align, ElementTy, SubscriptArray); } llvm::DIType *CGDebugInfo::CreateType(const ArrayType *Ty, llvm::DIFile *Unit) { uint64_t Size; - uint64_t Align; + uint32_t Align; // FIXME: make getTypeAlign() aware of VLAs and incomplete array types if (const auto *VAT = dyn_cast(Ty)) { @@ -2264,7 +2264,7 @@ const EnumDecl *ED = Ty->getDecl(); uint64_t Size = 0; - uint64_t Align = 0; + uint32_t Align = 0; if (!ED->getTypeForDecl()->isIncompleteType()) { Size = CGM.getContext().getTypeSize(ED->getTypeForDecl()); Align = CGM.getContext().getTypeAlign(ED->getTypeForDecl()); @@ -2307,7 +2307,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) { const EnumDecl *ED = Ty->getDecl(); uint64_t Size = 0; - uint64_t Align = 0; + uint32_t Align = 0; if (!ED->getTypeForDecl()->isIncompleteType()) { Size =
[PATCH] D25621: DebugInfo: use DIAlignment type.
vleschuk marked an inline comment as done. vleschuk added inline comments. Comment at: include/clang/AST/ASTContext.h:83 uint64_t Width; -unsigned Align; +llvm::DIAlignment Align; bool AlignIsRequired : 1; vleschuk wrote: > aprantl wrote: > > I'm not sure we want to use a debug info type inside the AST. I think we > > only want to use them in CGDebugInfo.cpp. > We use TypeInfo and related functions heavily in CGDebugInfo.cpp, leaving > this field as "unsigned" will make us to perform conversions from "unsigned" > to llvm::DIAlignment, I think having this changed will result in simpler code. @dblaikie wrote: > It'd still be a layering violation to have AST depend on debug info > types/concepts. If it makes sense to change it to uint32_t in AST, that'd > probably be reasonable. We are discussing the possibility of changing this to "unsigned" in https://reviews.llvm.org/D25620, after we come to consensus I'll update both patches. Thanks for the advice, I agree that using DebugInfo types in AST was a bad idea. https://reviews.llvm.org/D25621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25621: DebugInfo: use DIAlignment type.
vleschuk marked an inline comment as done. vleschuk added inline comments. Comment at: include/clang/AST/ASTContext.h:83 uint64_t Width; -unsigned Align; +llvm::DIAlignment Align; bool AlignIsRequired : 1; aprantl wrote: > I'm not sure we want to use a debug info type inside the AST. I think we only > want to use them in CGDebugInfo.cpp. We use TypeInfo and related functions heavily in CGDebugInfo.cpp, leaving this field as "unsigned" will make us to perform conversions from "unsigned" to llvm::DIAlignment, I think having this changed will result in simpler code. https://reviews.llvm.org/D25621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24426: DebugInfo: Pass non-zero alignment to DIBuilder only if aligment was forced
vleschuk updated this revision to Diff 74686. vleschuk added a comment. Use DIAlignment type instead of uint64_t for alignment in DebugInfo. https://reviews.llvm.org/D24426 Files: lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h test/CodeGen/debug-info-packed-struct.c test/CodeGen/debug-info-vector.c test/CodeGenCXX/debug-info-calling-conventions.cpp test/CodeGenCXX/debug-info-enum-class.cpp test/CodeGenCXX/debug-info-indirect-field-decl.cpp test/CodeGenCXX/debug-info-ms-bitfields.cpp test/CodeGenCXX/debug-info-ms-ptr-to-member.cpp test/CodeGenCXX/debug-info-rvalue-ref.cpp test/CodeGenCXX/debug-info-template-quals.cpp test/CodeGenCXX/debug-info-template.cpp test/CodeGenCXX/debug-info-union.cpp test/CodeGenCXX/debug-info-uuid.cpp test/CodeGenCXX/debug-info-vla.cpp test/CodeGenCXX/debug-info-zero-length-arrays.cpp test/CodeGenCXX/debug-info.cpp test/CodeGenCXX/debug-lambda-this.cpp test/CodeGenObjC/block-byref-debuginfo.m test/CodeGenObjC/debug-info-block-type.m test/CodeGenObjC/debug-info-ivars-extension.m test/CodeGenObjC/debug-info-ivars-private.m test/CodeGenObjC/debug-info-ivars.m test/CodeGenObjCXX/debug-info-cyclic.mm Index: test/CodeGenObjCXX/debug-info-cyclic.mm === --- test/CodeGenObjCXX/debug-info-cyclic.mm +++ test/CodeGenObjCXX/debug-info-cyclic.mm @@ -3,7 +3,7 @@ struct B { // CHECK: ![[B:[0-9]+]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "B" // CHECK-SAME: line: [[@LINE-2]], -// CHECK-SAME: size: 8, align: 8, +// CHECK-SAME: size: 8, // CHECK-NOT: offset: // CHECK-NOT: DIFlagFwdDecl // CHECK-SAME: elements: ![[BMEMBERS:[0-9]+]] Index: test/CodeGenObjC/debug-info-ivars.m === --- test/CodeGenObjC/debug-info-ivars.m +++ test/CodeGenObjC/debug-info-ivars.m @@ -21,24 +21,24 @@ // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i" // CHECK-SAME: line: 10 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32, +// CHECK-SAME: size: 32, // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagProtected // CHECK: ![[INT]] = !DIBasicType(name: "int" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_1" // CHECK-SAME: line: 11 // CHECK-SAME: baseType: ![[UNSIGNED:[0-9]+]] -// CHECK-SAME: size: 9, align: 32, +// CHECK-SAME: size: 9, // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagProtected // CHECK: ![[UNSIGNED]] = !DIBasicType(name: "unsigned int" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_2" // CHECK-SAME: line: 12 // CHECK-SAME: baseType: ![[UNSIGNED]] -// CHECK-SAME: size: 9, align: 32, offset: 1, +// CHECK-SAME: size: 9, offset: 1, // CHECK-SAME: flags: DIFlagProtected // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_3" // CHECK-SAME: line: 14 // CHECK-SAME: baseType: ![[UNSIGNED]] -// CHECK-SAME: size: 9, align: 32, offset: 3, +// CHECK-SAME: size: 9, offset: 3, // CHECK-SAME: flags: DIFlagProtected Index: test/CodeGenObjC/debug-info-ivars-private.m === --- test/CodeGenObjC/debug-info-ivars-private.m +++ test/CodeGenObjC/debug-info-ivars-private.m @@ -35,13 +35,13 @@ // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "foo" // CHECK-SAME: line: 14 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32, +// CHECK-SAME: size: 32, // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagProtected // CHECK: ![[INT]] = !DIBasicType(name: "int" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "bar" // CHECK-SAME: line: 27 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32, +// CHECK-SAME: size: 32, // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagPrivate Index: test/CodeGenObjC/debug-info-ivars-extension.m === --- test/CodeGenObjC/debug-info-ivars-extension.m +++ test/CodeGenObjC/debug-info-ivars-extension.m @@ -30,7 +30,7 @@ // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "a" // CHECK-SAME: line: 7 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32 +// CHECK-SAME: size: 32 // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagPublic // CHECK: ![[INT]] = !DIBasicType(name: "int" @@ -42,6 +42,6 @@ // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "b" //
[PATCH] D25621: DebugInfo: use DIAlignment type.
vleschuk created this revision. vleschuk added reviewers: aprantl, mehdi_amini, dblaikie, echristo. vleschuk added a subscriber: cfe-commits. Use DIAlignment type introduced in https://reviews.llvm.org/D25620 https://reviews.llvm.org/D25621 Files: include/clang/AST/ASTContext.h include/clang/AST/DeclBase.h lib/AST/DeclBase.cpp lib/CodeGen/CGDebugInfo.cpp Index: lib/CodeGen/CGDebugInfo.cpp === --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -596,7 +596,7 @@ } // Bit size, align and offset of the type. uint64_t Size = CGM.getContext().getTypeSize(BT); - uint64_t Align = CGM.getContext().getTypeAlign(BT); + llvm::DIAlignment Align = CGM.getContext().getTypeAlign(BT); return DBuilder.createBasicType(BTName, Size, Align, Encoding); } @@ -607,7 +607,7 @@ Encoding = llvm::dwarf::DW_ATE_lo_user; uint64_t Size = CGM.getContext().getTypeSize(Ty); - uint64_t Align = CGM.getContext().getTypeAlign(Ty); + llvm::DIAlignment Align = CGM.getContext().getTypeAlign(Ty); return DBuilder.createBasicType("complex", Size, Align, Encoding); } @@ -721,7 +721,7 @@ StringRef RDName = getClassName(RD); uint64_t Size = 0; - uint64_t Align = 0; + llvm::DIAlignment Align = 0; const RecordDecl *D = RD->getDefinition(); if (D && D->isCompleteDefinition()) { @@ -749,7 +749,7 @@ // because that does not return the correct value for references. unsigned AS = CGM.getContext().getTargetAddressSpace(PointeeTy); uint64_t Size = CGM.getTarget().getPointerWidth(AS); - uint64_t Align = CGM.getContext().getTypeAlign(Ty); + llvm::DIAlignment Align = CGM.getContext().getTypeAlign(Ty); if (Tag == llvm::dwarf::DW_TAG_reference_type || Tag == llvm::dwarf::DW_TAG_rvalue_reference_type) @@ -1181,7 +1181,7 @@ QualType PointeeTy = ThisPtrTy->getPointeeType(); unsigned AS = CGM.getContext().getTargetAddressSpace(PointeeTy); uint64_t Size = CGM.getTarget().getPointerWidth(AS); -uint64_t Align = CGM.getContext().getTypeAlign(ThisPtrTy); +llvm::DIAlignment Align = CGM.getContext().getTypeAlign(ThisPtrTy); llvm::DIType *PointeeType = getOrCreateType(PointeeTy, Unit); llvm::DIType *ThisPtrType = DBuilder.createPointerType(PointeeType, Size, Align); @@ -1968,12 +1968,12 @@ // Bit size, align and offset of the type. uint64_t Size = CGM.getContext().getTypeSize(Ty); - uint64_t Align = CGM.getContext().getTypeAlign(Ty); + llvm::DIAlignment Align = CGM.getContext().getTypeAlign(Ty); llvm::DINode::DIFlags Flags = llvm::DINode::FlagZero; if (ID->getImplementation()) Flags |= llvm::DINode::FlagObjcClassComplete; - + llvm::DIScope *Mod = getParentModuleOrNull(ID); llvm::DICompositeType *RealDecl = DBuilder.createStructType( Mod ? Mod : Unit, ID->getName(), DefUnit, Line, Size, Align, Flags, @@ -2134,14 +2134,14 @@ llvm::DINodeArray SubscriptArray = DBuilder.getOrCreateArray(Subscript); uint64_t Size = CGM.getContext().getTypeSize(Ty); - uint64_t Align = CGM.getContext().getTypeAlign(Ty); + llvm::DIAlignment Align = CGM.getContext().getTypeAlign(Ty); return DBuilder.createVectorType(Size, Align, ElementTy, SubscriptArray); } llvm::DIType *CGDebugInfo::CreateType(const ArrayType *Ty, llvm::DIFile *Unit) { uint64_t Size; - uint64_t Align; + llvm::DIAlignment Align; // FIXME: make getTypeAlign() aware of VLAs and incomplete array types if (const auto *VAT = dyn_cast(Ty)) { @@ -2264,7 +2264,7 @@ const EnumDecl *ED = Ty->getDecl(); uint64_t Size = 0; - uint64_t Align = 0; + llvm::DIAlignment Align = 0; if (!ED->getTypeForDecl()->isIncompleteType()) { Size = CGM.getContext().getTypeSize(ED->getTypeForDecl()); Align = CGM.getContext().getTypeAlign(ED->getTypeForDecl()); @@ -2307,7 +2307,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) { const EnumDecl *ED = Ty->getDecl(); uint64_t Size = 0; - uint64_t Align = 0; + llvm::DIAlignment Align = 0; if (!ED->getTypeForDecl()->isIncompleteType()) { Size = CGM.getContext().getTypeSize(ED->getTypeForDecl()); Align = CGM.getContext().getTypeAlign(ED->getTypeForDecl()); @@ -2607,7 +2607,7 @@ return getOrCreateRecordFwdDecl(Ty, RDContext); uint64_t Size = CGM.getContext().getTypeSize(Ty); - uint64_t Align = CGM.getContext().getTypeAlign(Ty); + llvm::DIAlignment Align = CGM.getContext().getTypeAlign(Ty); SmallString<256> FullName = getUniqueTagTypeName(Ty, CGM, TheCU); Index: lib/AST/DeclBase.cpp === --- lib/AST/DeclBase.cpp +++ lib/AST/DeclBase.cpp @@ -327,11 +327,11 @@ return getASTContext().getASTMutationListener(); } -unsigned Decl::getMaxAlignment() const { +llvm::DIAlignment Decl::getMaxAlignment() const { if (!hasAttrs()) return 0; - unsigned Align = 0; + llvm::DIAlignment Align = 0; const
[PATCH] D24426: DebugInfo: Pass non-zero alignment to DIBuilder only if aligment was forced
vleschuk updated this revision to Diff 73537. vleschuk added a comment. Pass alignment in bits instead of bytes to backend (conversion is done when emitting DW_AT_alignment). https://reviews.llvm.org/D24426 Files: lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h test/CodeGen/debug-info-packed-struct.c test/CodeGen/debug-info-vector.c test/CodeGenCXX/debug-info-calling-conventions.cpp test/CodeGenCXX/debug-info-enum-class.cpp test/CodeGenCXX/debug-info-indirect-field-decl.cpp test/CodeGenCXX/debug-info-ms-bitfields.cpp test/CodeGenCXX/debug-info-ms-ptr-to-member.cpp test/CodeGenCXX/debug-info-rvalue-ref.cpp test/CodeGenCXX/debug-info-template-quals.cpp test/CodeGenCXX/debug-info-template.cpp test/CodeGenCXX/debug-info-union.cpp test/CodeGenCXX/debug-info-uuid.cpp test/CodeGenCXX/debug-info-vla.cpp test/CodeGenCXX/debug-info-zero-length-arrays.cpp test/CodeGenCXX/debug-info.cpp test/CodeGenCXX/debug-lambda-this.cpp test/CodeGenObjC/block-byref-debuginfo.m test/CodeGenObjC/debug-info-block-type.m test/CodeGenObjC/debug-info-ivars-extension.m test/CodeGenObjC/debug-info-ivars-private.m test/CodeGenObjC/debug-info-ivars.m test/CodeGenObjCXX/debug-info-cyclic.mm Index: test/CodeGenObjCXX/debug-info-cyclic.mm === --- test/CodeGenObjCXX/debug-info-cyclic.mm +++ test/CodeGenObjCXX/debug-info-cyclic.mm @@ -3,7 +3,7 @@ struct B { // CHECK: ![[B:[0-9]+]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "B" // CHECK-SAME: line: [[@LINE-2]], -// CHECK-SAME: size: 8, align: 8, +// CHECK-SAME: size: 8, // CHECK-NOT: offset: // CHECK-NOT: DIFlagFwdDecl // CHECK-SAME: elements: ![[BMEMBERS:[0-9]+]] Index: test/CodeGenObjC/debug-info-ivars.m === --- test/CodeGenObjC/debug-info-ivars.m +++ test/CodeGenObjC/debug-info-ivars.m @@ -21,24 +21,24 @@ // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i" // CHECK-SAME: line: 10 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32, +// CHECK-SAME: size: 32, // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagProtected // CHECK: ![[INT]] = !DIBasicType(name: "int" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_1" // CHECK-SAME: line: 11 // CHECK-SAME: baseType: ![[UNSIGNED:[0-9]+]] -// CHECK-SAME: size: 9, align: 32, +// CHECK-SAME: size: 9, // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagProtected // CHECK: ![[UNSIGNED]] = !DIBasicType(name: "unsigned int" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_2" // CHECK-SAME: line: 12 // CHECK-SAME: baseType: ![[UNSIGNED]] -// CHECK-SAME: size: 9, align: 32, offset: 1, +// CHECK-SAME: size: 9, offset: 1, // CHECK-SAME: flags: DIFlagProtected // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_3" // CHECK-SAME: line: 14 // CHECK-SAME: baseType: ![[UNSIGNED]] -// CHECK-SAME: size: 9, align: 32, offset: 3, +// CHECK-SAME: size: 9, offset: 3, // CHECK-SAME: flags: DIFlagProtected Index: test/CodeGenObjC/debug-info-ivars-private.m === --- test/CodeGenObjC/debug-info-ivars-private.m +++ test/CodeGenObjC/debug-info-ivars-private.m @@ -35,13 +35,13 @@ // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "foo" // CHECK-SAME: line: 14 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32, +// CHECK-SAME: size: 32, // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagProtected // CHECK: ![[INT]] = !DIBasicType(name: "int" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "bar" // CHECK-SAME: line: 27 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32, +// CHECK-SAME: size: 32, // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagPrivate Index: test/CodeGenObjC/debug-info-ivars-extension.m === --- test/CodeGenObjC/debug-info-ivars-extension.m +++ test/CodeGenObjC/debug-info-ivars-extension.m @@ -30,7 +30,7 @@ // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "a" // CHECK-SAME: line: 7 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32 +// CHECK-SAME: size: 32 // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagPublic // CHECK: ![[INT]] = !DIBasicType(name: "int" @@ -42,6 +42,6 @@ // CHECK: !DIDerivedType(tag:
[PATCH] D24426: DebugInfo: Pass non-zero alignment to DIBuilder only if aligment was forced
vleschuk updated this revision to Diff 73318. vleschuk added a comment. Fix code style: - Two overloaded methods instead of 1 template - lower-case-headed method names - static methods instead of anon namespace - extra new line between methods https://reviews.llvm.org/D24426 Files: lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h test/CodeGen/debug-info-packed-struct.c test/CodeGen/debug-info-vector.c test/CodeGenCXX/debug-info-calling-conventions.cpp test/CodeGenCXX/debug-info-enum-class.cpp test/CodeGenCXX/debug-info-indirect-field-decl.cpp test/CodeGenCXX/debug-info-ms-bitfields.cpp test/CodeGenCXX/debug-info-ms-ptr-to-member.cpp test/CodeGenCXX/debug-info-rvalue-ref.cpp test/CodeGenCXX/debug-info-template-quals.cpp test/CodeGenCXX/debug-info-template.cpp test/CodeGenCXX/debug-info-union.cpp test/CodeGenCXX/debug-info-uuid.cpp test/CodeGenCXX/debug-info-vla.cpp test/CodeGenCXX/debug-info-zero-length-arrays.cpp test/CodeGenCXX/debug-info.cpp test/CodeGenCXX/debug-lambda-this.cpp test/CodeGenObjC/block-byref-debuginfo.m test/CodeGenObjC/debug-info-block-type.m test/CodeGenObjC/debug-info-ivars-extension.m test/CodeGenObjC/debug-info-ivars-private.m test/CodeGenObjC/debug-info-ivars.m test/CodeGenObjCXX/debug-info-cyclic.mm Index: test/CodeGenObjCXX/debug-info-cyclic.mm === --- test/CodeGenObjCXX/debug-info-cyclic.mm +++ test/CodeGenObjCXX/debug-info-cyclic.mm @@ -3,7 +3,7 @@ struct B { // CHECK: ![[B:[0-9]+]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "B" // CHECK-SAME: line: [[@LINE-2]], -// CHECK-SAME: size: 8, align: 8, +// CHECK-SAME: size: 8, // CHECK-NOT: offset: // CHECK-NOT: DIFlagFwdDecl // CHECK-SAME: elements: ![[BMEMBERS:[0-9]+]] Index: test/CodeGenObjC/debug-info-ivars.m === --- test/CodeGenObjC/debug-info-ivars.m +++ test/CodeGenObjC/debug-info-ivars.m @@ -21,24 +21,24 @@ // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i" // CHECK-SAME: line: 10 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32, +// CHECK-SAME: size: 32, // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagProtected // CHECK: ![[INT]] = !DIBasicType(name: "int" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_1" // CHECK-SAME: line: 11 // CHECK-SAME: baseType: ![[UNSIGNED:[0-9]+]] -// CHECK-SAME: size: 9, align: 32, +// CHECK-SAME: size: 9, // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagProtected // CHECK: ![[UNSIGNED]] = !DIBasicType(name: "unsigned int" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_2" // CHECK-SAME: line: 12 // CHECK-SAME: baseType: ![[UNSIGNED]] -// CHECK-SAME: size: 9, align: 32, offset: 1, +// CHECK-SAME: size: 9, offset: 1, // CHECK-SAME: flags: DIFlagProtected // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_3" // CHECK-SAME: line: 14 // CHECK-SAME: baseType: ![[UNSIGNED]] -// CHECK-SAME: size: 9, align: 32, offset: 3, +// CHECK-SAME: size: 9, offset: 3, // CHECK-SAME: flags: DIFlagProtected Index: test/CodeGenObjC/debug-info-ivars-private.m === --- test/CodeGenObjC/debug-info-ivars-private.m +++ test/CodeGenObjC/debug-info-ivars-private.m @@ -35,13 +35,13 @@ // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "foo" // CHECK-SAME: line: 14 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32, +// CHECK-SAME: size: 32, // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagProtected // CHECK: ![[INT]] = !DIBasicType(name: "int" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "bar" // CHECK-SAME: line: 27 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32, +// CHECK-SAME: size: 32, // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagPrivate Index: test/CodeGenObjC/debug-info-ivars-extension.m === --- test/CodeGenObjC/debug-info-ivars-extension.m +++ test/CodeGenObjC/debug-info-ivars-extension.m @@ -30,7 +30,7 @@ // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "a" // CHECK-SAME: line: 7 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32 +// CHECK-SAME: size: 32 // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagPublic // CHECK: ![[INT]] =
[PATCH] D24426: DebugInfo: Pass non-zero alignment to DIBuilder only if aligment was forced
vleschuk marked 3 inline comments as done. vleschuk added inline comments. > vleschuk wrote in CGDebugInfo.cpp:608 > Will check if this works in all cases. I think it's worth putting this > snippet into helper function within anon namespace. That is correct for types, for particular decls we still need to use hasAttr<>. Moved both cases into separate functions. > dblaikie wrote in CGDebugInfo.cpp:609 > Maybe add a comment here about why we're specifying zero alignment (or > possibly change the API to not take an alignment at all so we don't have to > explain it?) > > (similarly for other cases where the alignment is just hardcoded to zero) Default arguments now are zeros. https://reviews.llvm.org/D24426 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24426: DebugInfo: Pass non-zero alignment to DIBuilder only if aligment was forced
vleschuk updated this revision to Diff 73228. vleschuk added a comment. - Move alignment detection into helper functions in anon namespace - Use updated LLVM DIBuilder API (from https://reviews.llvm.org/D24425) https://reviews.llvm.org/D24426 Files: lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h test/CodeGen/debug-info-packed-struct.c test/CodeGen/debug-info-vector.c test/CodeGenCXX/debug-info-calling-conventions.cpp test/CodeGenCXX/debug-info-enum-class.cpp test/CodeGenCXX/debug-info-indirect-field-decl.cpp test/CodeGenCXX/debug-info-ms-bitfields.cpp test/CodeGenCXX/debug-info-ms-ptr-to-member.cpp test/CodeGenCXX/debug-info-rvalue-ref.cpp test/CodeGenCXX/debug-info-template-quals.cpp test/CodeGenCXX/debug-info-template.cpp test/CodeGenCXX/debug-info-union.cpp test/CodeGenCXX/debug-info-uuid.cpp test/CodeGenCXX/debug-info-vla.cpp test/CodeGenCXX/debug-info-zero-length-arrays.cpp test/CodeGenCXX/debug-info.cpp test/CodeGenCXX/debug-lambda-this.cpp test/CodeGenObjC/block-byref-debuginfo.m test/CodeGenObjC/debug-info-block-type.m test/CodeGenObjC/debug-info-ivars-extension.m test/CodeGenObjC/debug-info-ivars-private.m test/CodeGenObjC/debug-info-ivars.m test/CodeGenObjCXX/debug-info-cyclic.mm Index: test/CodeGenObjCXX/debug-info-cyclic.mm === --- test/CodeGenObjCXX/debug-info-cyclic.mm +++ test/CodeGenObjCXX/debug-info-cyclic.mm @@ -3,7 +3,7 @@ struct B { // CHECK: ![[B:[0-9]+]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "B" // CHECK-SAME: line: [[@LINE-2]], -// CHECK-SAME: size: 8, align: 8, +// CHECK-SAME: size: 8, // CHECK-NOT: offset: // CHECK-NOT: DIFlagFwdDecl // CHECK-SAME: elements: ![[BMEMBERS:[0-9]+]] Index: test/CodeGenObjC/debug-info-ivars.m === --- test/CodeGenObjC/debug-info-ivars.m +++ test/CodeGenObjC/debug-info-ivars.m @@ -21,24 +21,24 @@ // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i" // CHECK-SAME: line: 10 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32, +// CHECK-SAME: size: 32, // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagProtected // CHECK: ![[INT]] = !DIBasicType(name: "int" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_1" // CHECK-SAME: line: 11 // CHECK-SAME: baseType: ![[UNSIGNED:[0-9]+]] -// CHECK-SAME: size: 9, align: 32, +// CHECK-SAME: size: 9, // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagProtected // CHECK: ![[UNSIGNED]] = !DIBasicType(name: "unsigned int" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_2" // CHECK-SAME: line: 12 // CHECK-SAME: baseType: ![[UNSIGNED]] -// CHECK-SAME: size: 9, align: 32, offset: 1, +// CHECK-SAME: size: 9, offset: 1, // CHECK-SAME: flags: DIFlagProtected // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_3" // CHECK-SAME: line: 14 // CHECK-SAME: baseType: ![[UNSIGNED]] -// CHECK-SAME: size: 9, align: 32, offset: 3, +// CHECK-SAME: size: 9, offset: 3, // CHECK-SAME: flags: DIFlagProtected Index: test/CodeGenObjC/debug-info-ivars-private.m === --- test/CodeGenObjC/debug-info-ivars-private.m +++ test/CodeGenObjC/debug-info-ivars-private.m @@ -35,13 +35,13 @@ // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "foo" // CHECK-SAME: line: 14 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32, +// CHECK-SAME: size: 32, // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagProtected // CHECK: ![[INT]] = !DIBasicType(name: "int" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "bar" // CHECK-SAME: line: 27 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32, +// CHECK-SAME: size: 32, // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagPrivate Index: test/CodeGenObjC/debug-info-ivars-extension.m === --- test/CodeGenObjC/debug-info-ivars-extension.m +++ test/CodeGenObjC/debug-info-ivars-extension.m @@ -30,7 +30,7 @@ // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "a" // CHECK-SAME: line: 7 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32 +// CHECK-SAME: size: 32 // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagPublic // CHECK: ![[INT]] = !DIBasicType(name: "int" @@ -42,6 +42,6
Re: [PATCH] D24426: DebugInfo: Pass non-zero alignment to DIBuilder only if aligment was forced
vleschuk added inline comments. Comment at: lib/CodeGen/CGDebugInfo.cpp:608 @@ -608,2 +607,3 @@ uint64_t Size = CGM.getContext().getTypeSize(Ty); + uint64_t Align = 0; rnk wrote: > IMO this is what we should be doing everywhere, rather than manually checking > AlignedAttr: > TypeInfo TI = CGM.getContext().getTypeInfo(Ty); > uint64_t Size = TI.Width; > uint64_t Align = TI.AlignIsRequired ? TI.Align : 0; > > This saves a hash lookup, and handles some corner cases. AlignIsRequired is > already supposed to capture whether the alignment was changed. Will check if this works in all cases. I think it's worth putting this snippet into helper function within anon namespace. https://reviews.llvm.org/D24426 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D24426: DebugInfo: Pass non-zero alignment to DIBuilder only if aligment was forced
vleschuk added inline comments. Comment at: lib/CodeGen/CGDebugInfo.cpp:3691 @@ -3635,1 +3690,3 @@ + if (D->hasAttr()) +AlignInBits = D->getMaxAlignment(); StringRef DeclName, LinkageName; probinson wrote: > dblaikie wrote: > > is max alignment the right thing here? Should it be min alignment? > > (is alignment in bits the desired thing across all of this too? It looked > > like in the backend patch there was some division by CHAR_BITS, etc?) > I should think bits is the right choice here; seems more the province of the > backend to convert it into the appropriate addressable units (commonly but > not universally chars). > is max alignment the right thing here? Should it be min alignment? The DWARF document says: > This constant describes the actual alignment used by the compiler (if there > are multiple specified by the user, or if the user specified an alignment the > compiler couldn't satisfy, then only the strictest alignment will be added > through a DW_AT_alignment). So I think max alignment is right choice here. https://reviews.llvm.org/D24426 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D24426: DebugInfo: Pass non-zero alignment to DIBuilder only if aligment was forced
vleschuk retitled this revision from "DebugInfo: use llvm::DINode::FlagAlignment to mark forcibly aligned data" to "DebugInfo: Pass non-zero alignment to DIBuilder only if aligment was forced". vleschuk updated the summary for this revision. vleschuk updated this revision to Diff 70965. vleschuk added a comment. Got rid of DINode::FlagAlignment. Check for forced alignment (alignas(), _Alignas(), __attribute(aligned (N) when creating DI* objects with DIBuilder. If alignment was not forced pass zero, otherwise pass actual alignment value. Updated related tests according to new behavior. https://reviews.llvm.org/D24426 Files: lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h test/CodeGen/debug-info-packed-struct.c test/CodeGen/debug-info-vector.c test/CodeGenCXX/debug-info-calling-conventions.cpp test/CodeGenCXX/debug-info-enum-class.cpp test/CodeGenCXX/debug-info-indirect-field-decl.cpp test/CodeGenCXX/debug-info-ms-bitfields.cpp test/CodeGenCXX/debug-info-ms-ptr-to-member.cpp test/CodeGenCXX/debug-info-rvalue-ref.cpp test/CodeGenCXX/debug-info-template-quals.cpp test/CodeGenCXX/debug-info-template.cpp test/CodeGenCXX/debug-info-union.cpp test/CodeGenCXX/debug-info-uuid.cpp test/CodeGenCXX/debug-info-vla.cpp test/CodeGenCXX/debug-info-zero-length-arrays.cpp test/CodeGenCXX/debug-info.cpp test/CodeGenCXX/debug-lambda-this.cpp test/CodeGenObjC/block-byref-debuginfo.m test/CodeGenObjC/debug-info-block-type.m test/CodeGenObjC/debug-info-ivars-extension.m test/CodeGenObjC/debug-info-ivars-private.m test/CodeGenObjC/debug-info-ivars.m test/CodeGenObjCXX/debug-info-cyclic.mm Index: test/CodeGenObjCXX/debug-info-cyclic.mm === --- test/CodeGenObjCXX/debug-info-cyclic.mm +++ test/CodeGenObjCXX/debug-info-cyclic.mm @@ -3,7 +3,7 @@ struct B { // CHECK: ![[B:[0-9]+]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "B" // CHECK-SAME: line: [[@LINE-2]], -// CHECK-SAME: size: 8, align: 8, +// CHECK-SAME: size: 8, // CHECK-NOT: offset: // CHECK-NOT: DIFlagFwdDecl // CHECK-SAME: elements: ![[BMEMBERS:[0-9]+]] Index: test/CodeGenObjC/debug-info-ivars.m === --- test/CodeGenObjC/debug-info-ivars.m +++ test/CodeGenObjC/debug-info-ivars.m @@ -21,24 +21,24 @@ // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i" // CHECK-SAME: line: 10 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32, +// CHECK-SAME: size: 32, // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagProtected // CHECK: ![[INT]] = !DIBasicType(name: "int" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_1" // CHECK-SAME: line: 11 // CHECK-SAME: baseType: ![[UNSIGNED:[0-9]+]] -// CHECK-SAME: size: 9, align: 32, +// CHECK-SAME: size: 9, // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagProtected // CHECK: ![[UNSIGNED]] = !DIBasicType(name: "unsigned int" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_2" // CHECK-SAME: line: 12 // CHECK-SAME: baseType: ![[UNSIGNED]] -// CHECK-SAME: size: 9, align: 32, offset: 1, +// CHECK-SAME: size: 9, offset: 1, // CHECK-SAME: flags: DIFlagProtected // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_3" // CHECK-SAME: line: 14 // CHECK-SAME: baseType: ![[UNSIGNED]] -// CHECK-SAME: size: 9, align: 32, offset: 3, +// CHECK-SAME: size: 9, offset: 3, // CHECK-SAME: flags: DIFlagProtected Index: test/CodeGenObjC/debug-info-ivars-private.m === --- test/CodeGenObjC/debug-info-ivars-private.m +++ test/CodeGenObjC/debug-info-ivars-private.m @@ -35,13 +35,13 @@ // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "foo" // CHECK-SAME: line: 14 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32, +// CHECK-SAME: size: 32, // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagProtected // CHECK: ![[INT]] = !DIBasicType(name: "int" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "bar" // CHECK-SAME: line: 27 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32, +// CHECK-SAME: size: 32, // CHECK-NOT:offset: // CHECK-SAME: flags: DIFlagPrivate Index: test/CodeGenObjC/debug-info-ivars-extension.m === --- test/CodeGenObjC/debug-info-ivars-extension.m +++
Re: [PATCH] D24426: DebugInfo: use llvm::DINode::FlagAlignment to mark forcibly aligned data
vleschuk marked 2 inline comments as done. vleschuk added a comment. https://reviews.llvm.org/D24426 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D24426: DebugInfo: use llvm::DINode::FlagAlignment to mark forcibly aligned data
vleschuk updated this revision to Diff 70949. vleschuk added a comment. Reverted formatting changes. https://reviews.llvm.org/D24426 Files: lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h Index: lib/CodeGen/CGDebugInfo.h === --- lib/CodeGen/CGDebugInfo.h +++ lib/CodeGen/CGDebugInfo.h @@ -238,6 +238,13 @@ llvm::DIScope *scope, const RecordDecl *RD = nullptr); + llvm::DIType *createFieldType(StringRef Name, QualType Type, +SourceLocation Loc, uint64_t AlignInBits, +uint64_t OffsetInBits, +llvm::DINode::DIFlags Flags, +llvm::DIFile *TUnit, llvm::DIScope *Scope, +const RecordDecl *RD = nullptr); + /// Create new bit field member. llvm::DIType *createBitFieldType(const FieldDecl *BitFieldDecl, llvm::DIScope *RecordTy, Index: lib/CodeGen/CGDebugInfo.cpp === --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -999,6 +999,28 @@ AlignInBits, offsetInBits, flags, debugType); } +llvm::DIType * +CGDebugInfo::createFieldType(StringRef Name, QualType Type, SourceLocation Loc, + uint64_t AlignInBits, uint64_t OffsetInBits, + llvm::DINode::DIFlags Flags, + llvm::DIFile *TUnit, llvm::DIScope *Scope, + const RecordDecl *RD) { + llvm::DIType *DebugType = getOrCreateType(Type, TUnit); + + // Get the location for the field. + llvm::DIFile *File = getOrCreateFile(Loc); + unsigned Line = getLineNumber(Loc); + + uint64_t SizeInBits = 0; + if (!Type->isIncompleteArrayType()) { +TypeInfo TI = CGM.getContext().getTypeInfo(Type); +SizeInBits = TI.Width; + } + + return DBuilder.createMemberType(Scope, Name, File, Line, SizeInBits, + AlignInBits, OffsetInBits, Flags, DebugType); +} + void CGDebugInfo::CollectRecordLambdaFields( const CXXRecordDecl *CXXDecl, SmallVectorImpl , llvm::DIType *RecordTy) { @@ -1012,15 +1034,21 @@ E = CXXDecl->captures_end(); I != E; ++I, ++Field, ++fieldno) { const LambdaCapture = *I; +uint64_t AlignInBits = 0; +llvm::DINode::DIFlags Flags = llvm::DINode::FlagZero; if (C.capturesVariable()) { SourceLocation Loc = C.getLocation(); assert(!Field->isBitField() && "lambdas don't have bitfield members!"); VarDecl *V = C.getCapturedVar(); StringRef VName = V->getName(); + AlignInBits = V->getMaxAlignment(); + Flags |= getAccessFlag(Field->getAccess(), CXXDecl); + if (V->hasAttr()) +Flags |= llvm::DINode::FlagAlignment; llvm::DIFile *VUnit = getOrCreateFile(Loc); llvm::DIType *FieldType = createFieldType( - VName, Field->getType(), Loc, Field->getAccess(), - layout.getFieldOffset(fieldno), VUnit, RecordTy, CXXDecl); + VName, Field->getType(), Loc, AlignInBits, + layout.getFieldOffset(fieldno), Flags, VUnit, RecordTy, CXXDecl); elements.push_back(FieldType); } else if (C.capturesThis()) { // TODO: Need to handle 'this' in some way by probably renaming the @@ -1061,9 +1089,14 @@ } } + uint64_t AlignInBits = 0; llvm::DINode::DIFlags Flags = getAccessFlag(Var->getAccess(), RD); + if (Var->hasAttr()) { +Flags |= llvm::DINode::FlagAlignment; +AlignInBits = Var->getMaxAlignment(); + } llvm::DIDerivedType *GV = DBuilder.createStaticMemberType( - RecordTy, VName, VUnit, LineNumber, VTy, Flags, C); + RecordTy, VName, VUnit, LineNumber, VTy, AlignInBits, Flags, C); StaticDataMemberCache[Var->getCanonicalDecl()].reset(GV); return GV; } @@ -1074,6 +1107,14 @@ const RecordDecl *RD) { StringRef name = field->getName(); QualType type = field->getType(); + uint64_t AlignInBits = 0; + llvm::DINode::DIFlags Flags = getAccessFlag(field->getAccess(), RD); + if (field->hasAttr()) { +Flags |= llvm::DINode::FlagAlignment; +AlignInBits = field->getMaxAlignment(); + } else if (!type->isIncompleteArrayType()) { +AlignInBits = CGM.getContext().getTypeInfo(type).Align; + } // Ignore unnamed fields unless they're anonymous structs/unions. if (name.empty() && !type->isRecordType()) @@ -1084,8 +1125,8 @@ FieldType = createBitFieldType(field, RecordTy, RD); } else { FieldType = -createFieldType(name, type, field->getLocation(), field->getAccess(), -OffsetInBits, tunit, RecordTy, RD); +createFieldType(name, type, field->getLocation(), AlignInBits, +OffsetInBits, Flags, tunit,
Re: [PATCH] D24426: DebugInfo: use llvm::DINode::FlagAlignment to mark forcibly aligned data
vleschuk added inline comments. Comment at: lib/CodeGen/CGDebugInfo.cpp:979 @@ -978,4 +978,3 @@ llvm::DIType * -CGDebugInfo::createFieldType(StringRef name, QualType type, SourceLocation loc, - AccessSpecifier AS, uint64_t offsetInBits, - llvm::DIFile *tunit, llvm::DIScope *scope, +CGDebugInfo::createFieldType(StringRef Name, QualType Type, SourceLocation Loc, + AccessSpecifier AS, uint64_t OffsetInBits, aprantl wrote: > Could you please do the re-formatting as a separate NFC commit? No need to > for a separate review. > This makes reviewing, cherry-picking, and bisection much easier. Sure, sorry for that. Will revert. https://reviews.llvm.org/D24426 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24426: DebugInfo: use llvm::DINode::FlagAlignment to mark forcibly aligned data
vleschuk created this revision. vleschuk added reviewers: echristo, aprantl, dblaikie, mehdi_amini. vleschuk added a subscriber: cfe-commits. Herald added a subscriber: mehdi_amini. Add llvm::DINode::FlagAlignment to entities marked with C++11 'alignas', C11 '_Alignas' keywords or ObjC clang attribute((aligned (N))). https://reviews.llvm.org/D24426 Files: lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h Index: lib/CodeGen/CGDebugInfo.h === --- lib/CodeGen/CGDebugInfo.h +++ lib/CodeGen/CGDebugInfo.h @@ -232,10 +232,17 @@ CollectCXXTemplateParams(const ClassTemplateSpecializationDecl *TS, llvm::DIFile *F); - llvm::DIType *createFieldType(StringRef name, QualType type, -SourceLocation loc, AccessSpecifier AS, -uint64_t offsetInBits, llvm::DIFile *tunit, -llvm::DIScope *scope, + llvm::DIType *createFieldType(StringRef Name, QualType Type, +SourceLocation Loc, AccessSpecifier AS, +uint64_t OffsetInBits, +llvm::DIFile *TUnit, llvm::DIScope *Scope, +const RecordDecl *RD = nullptr); + + llvm::DIType *createFieldType(StringRef Name, QualType Type, +SourceLocation Loc, uint64_t AlignInBits, +uint64_t OffsetInBits, +llvm::DINode::DIFlags Flags, +llvm::DIFile *TUnit, llvm::DIScope *Scope, const RecordDecl *RD = nullptr); /// Create new bit field member. Index: lib/CodeGen/CGDebugInfo.cpp === --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -976,27 +976,49 @@ } llvm::DIType * -CGDebugInfo::createFieldType(StringRef name, QualType type, SourceLocation loc, - AccessSpecifier AS, uint64_t offsetInBits, - llvm::DIFile *tunit, llvm::DIScope *scope, +CGDebugInfo::createFieldType(StringRef Name, QualType Type, SourceLocation Loc, + AccessSpecifier AS, uint64_t OffsetInBits, + llvm::DIFile *TUnit, llvm::DIScope *Scope, const RecordDecl *RD) { - llvm::DIType *debugType = getOrCreateType(type, tunit); + llvm::DIType *DebugType = getOrCreateType(Type, TUnit); // Get the location for the field. - llvm::DIFile *file = getOrCreateFile(loc); - unsigned line = getLineNumber(loc); + llvm::DIFile *File = getOrCreateFile(Loc); + unsigned Line = getLineNumber(Loc); uint64_t SizeInBits = 0; - unsigned AlignInBits = 0; - if (!type->isIncompleteArrayType()) { -TypeInfo TI = CGM.getContext().getTypeInfo(type); + uint64_t AlignInBits = 0; + if (!Type->isIncompleteArrayType()) { +TypeInfo TI = CGM.getContext().getTypeInfo(Type); SizeInBits = TI.Width; AlignInBits = TI.Align; } + llvm::DINode::DIFlags Flags = getAccessFlag(AS, RD); - llvm::DINode::DIFlags flags = getAccessFlag(AS, RD); - return DBuilder.createMemberType(scope, name, file, line, SizeInBits, - AlignInBits, offsetInBits, flags, debugType); + return DBuilder.createMemberType(Scope, Name, File, Line, SizeInBits, + AlignInBits, OffsetInBits, Flags, DebugType); +} + +llvm::DIType * +CGDebugInfo::createFieldType(StringRef Name, QualType Type, SourceLocation Loc, + uint64_t AlignInBits, uint64_t OffsetInBits, + llvm::DINode::DIFlags Flags, + llvm::DIFile *TUnit, llvm::DIScope *Scope, + const RecordDecl *RD) { + llvm::DIType *DebugType = getOrCreateType(Type, TUnit); + + // Get the location for the field. + llvm::DIFile *File = getOrCreateFile(Loc); + unsigned Line = getLineNumber(Loc); + + uint64_t SizeInBits = 0; + if (!Type->isIncompleteArrayType()) { +TypeInfo TI = CGM.getContext().getTypeInfo(Type); +SizeInBits = TI.Width; + } + + return DBuilder.createMemberType(Scope, Name, File, Line, SizeInBits, + AlignInBits, OffsetInBits, Flags, DebugType); } void CGDebugInfo::CollectRecordLambdaFields( @@ -1012,15 +1034,21 @@ E = CXXDecl->captures_end(); I != E; ++I, ++Field, ++fieldno) { const LambdaCapture = *I; +uint64_t AlignInBits = 0; +llvm::DINode::DIFlags Flags = llvm::DINode::FlagZero; if (C.capturesVariable()) { SourceLocation Loc = C.getLocation(); assert(!Field->isBitField() && "lambdas don't have bitfield members!"); VarDecl *V = C.getCapturedVar(); StringRef VName = V->getName(); +