[llvm] 1e1b92f - IR: Rename Metadata::ImplicitCode to SubclassData1, NFC
Duncan P. N. Exon Smith via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 24 12:57:04 PST 2021
Author: Duncan P. N. Exon Smith
Date: 2021-02-24T12:56:26-08:00
New Revision: 1e1b92f76de79b934ead3be075aff101bd880392
URL: https://github.com/llvm/llvm-project/commit/1e1b92f76de79b934ead3be075aff101bd880392
DIFF: https://github.com/llvm/llvm-project/commit/1e1b92f76de79b934ead3be075aff101bd880392.diff
LOG: IR: Rename Metadata::ImplicitCode to SubclassData1, NFC
Metadata::ImplicitCode is a bit shaved off of Metadata::Storage,
currently only in use by the subclass DILocation. However, the bit isn't
reserved for that purpose. Rename it `SubclassData1` to make it clear
that it has nothing to do with Metadata itself (and other subclasses are
free to use it).
As a drive-by, remove an old TODO about exposing bits to subclasses
(looks like that has mostly been done).
No functionality change here.
Differential Revision: https://reviews.llvm.org/D96740
Added:
Modified:
llvm/include/llvm/IR/DebugInfoMetadata.h
llvm/include/llvm/IR/Metadata.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h
index d93d67ce697f..a82418f638bc 100644
--- a/llvm/include/llvm/IR/DebugInfoMetadata.h
+++ b/llvm/include/llvm/IR/DebugInfoMetadata.h
@@ -1643,8 +1643,8 @@ class DILocation : public MDNode {
/// written explicitly by the user (e.g. cleanup stuff in C++ put on a closing
/// bracket). It's useful for code coverage to not show a counter on "empty"
/// lines.
- bool isImplicitCode() const { return ImplicitCode; }
- void setImplicitCode(bool ImplicitCode) { this->ImplicitCode = ImplicitCode; }
+ bool isImplicitCode() const { return SubclassData1; }
+ void setImplicitCode(bool ImplicitCode) { SubclassData1 = ImplicitCode; }
DIFile *getFile() const { return getScope()->getFile(); }
StringRef getFilename() const { return getScope()->getFilename(); }
diff --git a/llvm/include/llvm/IR/Metadata.h b/llvm/include/llvm/IR/Metadata.h
index 9a4480b75a30..2a2ce347972c 100644
--- a/llvm/include/llvm/IR/Metadata.h
+++ b/llvm/include/llvm/IR/Metadata.h
@@ -67,10 +67,8 @@ class Metadata {
/// Storage flag for non-uniqued, otherwise unowned, metadata.
unsigned char Storage : 7;
- // TODO: expose remaining bits to subclasses.
-
- unsigned char ImplicitCode : 1;
+ unsigned char SubclassData1 : 1;
unsigned short SubclassData16 = 0;
unsigned SubclassData32 = 0;
@@ -82,7 +80,7 @@ class Metadata {
protected:
Metadata(unsigned ID, StorageType Storage)
- : SubclassID(ID), Storage(Storage), ImplicitCode(false) {
+ : SubclassID(ID), Storage(Storage), SubclassData1(false) {
static_assert(sizeof(*this) == 8, "Metadata fields poorly packed");
}
More information about the llvm-commits
mailing list