[clang] 802b22b - Revert "[DebugInfo][clang][DWARF5]: Added support for debuginfo generation for defaulted parameters"
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 2 00:31:06 PST 2020
Author: Hans Wennborg
Date: 2020-03-02T09:30:52+01:00
New Revision: 802b22b5c8c30bebc1695a217478be02653c6b53
URL: https://github.com/llvm/llvm-project/commit/802b22b5c8c30bebc1695a217478be02653c6b53
DIFF: https://github.com/llvm/llvm-project/commit/802b22b5c8c30bebc1695a217478be02653c6b53.diff
LOG: Revert "[DebugInfo][clang][DWARF5]: Added support for debuginfo generation for defaulted parameters"
The Bitcode/DITemplateParameter-5.0.ll test is failing:
FAIL: LLVM :: Bitcode/DITemplateParameter-5.0.ll (5894 of 36324)
******************** TEST 'LLVM :: Bitcode/DITemplateParameter-5.0.ll' FAILED ********************
Script:
--
: 'RUN: at line 1'; /usr/local/google/home/thakis/src/llvm-project/out/gn/bin/llvm-dis -o - /usr/local/google/home/thakis/src/llvm-project/llvm/test/Bitcode/DITemplateParameter-5.0.ll.bc | /usr/local/google/home/thakis/src/llvm-project/out/gn/bin/FileCheck /usr/local/google/home/thakis/src/llvm-project/llvm/test/Bitcode/DITemplateParameter-5.0.ll
--
Exit Code: 2
Command Output (stderr):
--
It looks like the Bitcode/DITemplateParameter-5.0.ll.bc file was never checked in.
This reverts commit c2b437d53d40b6dc5603c97f527398f477d9c5f1.
Added:
Modified:
clang/lib/CodeGen/CGDebugInfo.cpp
llvm/include/llvm/IR/DIBuilder.h
llvm/include/llvm/IR/DebugInfoMetadata.h
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/Bitcode/Reader/MetadataLoader.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/lib/IR/AsmWriter.cpp
llvm/lib/IR/DIBuilder.cpp
llvm/lib/IR/DebugInfoMetadata.cpp
llvm/lib/IR/LLVMContextImpl.h
llvm/unittests/IR/MetadataTest.cpp
Removed:
llvm/test/Assembler/DITemplateParameter.ll
llvm/test/Bitcode/DITemplateParameter-5.0.ll
################################################################################
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 404ecfa975a1..e171082942f6 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1787,36 +1787,18 @@ CGDebugInfo::CollectTemplateParams(const TemplateParameterList *TPList,
for (unsigned i = 0, e = TAList.size(); i != e; ++i) {
const TemplateArgument &TA = TAList[i];
StringRef Name;
- bool defaultParameter = false;
if (TPList)
Name = TPList->getParam(i)->getName();
switch (TA.getKind()) {
case TemplateArgument::Type: {
llvm::DIType *TTy = getOrCreateType(TA.getAsType(), Unit);
-
- if (TPList)
- if (auto *templateType =
- dyn_cast_or_null<TemplateTypeParmDecl>(TPList->getParam(i)))
- if (templateType->hasDefaultArgument())
- defaultParameter =
- templateType->getDefaultArgument() == TA.getAsType();
-
- TemplateParams.push_back(DBuilder.createTemplateTypeParameter(
- TheCU, Name, TTy, defaultParameter));
-
+ TemplateParams.push_back(
+ DBuilder.createTemplateTypeParameter(TheCU, Name, TTy));
} break;
case TemplateArgument::Integral: {
llvm::DIType *TTy = getOrCreateType(TA.getIntegralType(), Unit);
- if (TPList)
- if (auto *templateType =
- dyn_cast_or_null<NonTypeTemplateParmDecl>(TPList->getParam(i)))
- if (templateType->hasDefaultArgument())
- defaultParameter =
- templateType->getDefaultArgument()->EvaluateKnownConstInt(
- CGM.getContext()) == TA.getAsIntegral();
-
TemplateParams.push_back(DBuilder.createTemplateValueParameter(
- TheCU, Name, TTy, defaultParameter,
+ TheCU, Name, TTy,
llvm::ConstantInt::get(CGM.getLLVMContext(), TA.getAsIntegral())));
} break;
case TemplateArgument::Declaration: {
@@ -1855,7 +1837,7 @@ CGDebugInfo::CollectTemplateParams(const TemplateParameterList *TPList,
V = V->stripPointerCasts();
}
TemplateParams.push_back(DBuilder.createTemplateValueParameter(
- TheCU, Name, TTy, defaultParameter, cast_or_null<llvm::Constant>(V)));
+ TheCU, Name, TTy, cast_or_null<llvm::Constant>(V)));
} break;
case TemplateArgument::NullPtr: {
QualType T = TA.getNullPtrType();
@@ -1873,8 +1855,8 @@ CGDebugInfo::CollectTemplateParams(const TemplateParameterList *TPList,
V = CGM.getCXXABI().EmitNullMemberPointer(MPT);
if (!V)
V = llvm::ConstantInt::get(CGM.Int8Ty, 0);
- TemplateParams.push_back(DBuilder.createTemplateValueParameter(
- TheCU, Name, TTy, defaultParameter, V));
+ TemplateParams.push_back(
+ DBuilder.createTemplateValueParameter(TheCU, Name, TTy, V));
} break;
case TemplateArgument::Template:
TemplateParams.push_back(DBuilder.createTemplateTemplateParameter(
@@ -1895,7 +1877,7 @@ CGDebugInfo::CollectTemplateParams(const TemplateParameterList *TPList,
assert(V && "Expression in template argument isn't constant");
llvm::DIType *TTy = getOrCreateType(T, Unit);
TemplateParams.push_back(DBuilder.createTemplateValueParameter(
- TheCU, Name, TTy, defaultParameter, V->stripPointerCasts()));
+ TheCU, Name, TTy, V->stripPointerCasts()));
} break;
// And the following should never occur:
case TemplateArgument::TemplateExpansion:
diff --git a/llvm/include/llvm/IR/DIBuilder.h b/llvm/include/llvm/IR/DIBuilder.h
index 604740dcdfb3..cbc96a483f91 100644
--- a/llvm/include/llvm/IR/DIBuilder.h
+++ b/llvm/include/llvm/IR/DIBuilder.h
@@ -443,22 +443,19 @@ namespace llvm {
/// \param Scope Scope in which this type is defined.
/// \param Name Type parameter name.
/// \param Ty Parameter type.
- /// \param IsDefault Parameter is default or not
- DITemplateTypeParameter *createTemplateTypeParameter(DIScope *Scope,
- StringRef Name,
- DIType *Ty,
- bool IsDefault);
+ DITemplateTypeParameter *
+ createTemplateTypeParameter(DIScope *Scope, StringRef Name, DIType *Ty);
/// Create debugging information for template
/// value parameter.
/// \param Scope Scope in which this type is defined.
/// \param Name Value parameter name.
/// \param Ty Parameter type.
- /// \param IsDefault Parameter is default or not
/// \param Val Constant parameter value.
- DITemplateValueParameter *
- createTemplateValueParameter(DIScope *Scope, StringRef Name, DIType *Ty,
- bool IsDefault, Constant *Val);
+ DITemplateValueParameter *createTemplateValueParameter(DIScope *Scope,
+ StringRef Name,
+ DIType *Ty,
+ Constant *Val);
/// Create debugging information for a template template parameter.
/// \param Scope Scope in which this type is defined.
diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h
index 032ae598c1d4..acc518445585 100644
--- a/llvm/include/llvm/IR/DebugInfoMetadata.h
+++ b/llvm/include/llvm/IR/DebugInfoMetadata.h
@@ -2131,11 +2131,9 @@ class DIModule : public DIScope {
/// Base class for template parameters.
class DITemplateParameter : public DINode {
protected:
- bool IsDefault;
-
DITemplateParameter(LLVMContext &Context, unsigned ID, StorageType Storage,
- unsigned Tag, bool IsDefault, ArrayRef<Metadata *> Ops)
- : DINode(Context, ID, Storage, Tag, Ops), IsDefault(IsDefault) {}
+ unsigned Tag, ArrayRef<Metadata *> Ops)
+ : DINode(Context, ID, Storage, Tag, Ops) {}
~DITemplateParameter() = default;
public:
@@ -2144,7 +2142,6 @@ class DITemplateParameter : public DINode {
MDString *getRawName() const { return getOperandAs<MDString>(0); }
Metadata *getRawType() const { return getOperand(1); }
- bool isDefault() const { return IsDefault; }
static bool classof(const Metadata *MD) {
return MD->getMetadataID() == DITemplateTypeParameterKind ||
@@ -2157,35 +2154,30 @@ class DITemplateTypeParameter : public DITemplateParameter {
friend class MDNode;
DITemplateTypeParameter(LLVMContext &Context, StorageType Storage,
- bool IsDefault, ArrayRef<Metadata *> Ops)
+ ArrayRef<Metadata *> Ops)
: DITemplateParameter(Context, DITemplateTypeParameterKind, Storage,
- dwarf::DW_TAG_template_type_parameter, IsDefault,
- Ops) {}
+ dwarf::DW_TAG_template_type_parameter, Ops) {}
~DITemplateTypeParameter() = default;
static DITemplateTypeParameter *getImpl(LLVMContext &Context, StringRef Name,
- DIType *Type, bool IsDefault,
- StorageType Storage,
+ DIType *Type, StorageType Storage,
bool ShouldCreate = true) {
- return getImpl(Context, getCanonicalMDString(Context, Name), Type,
- IsDefault, Storage, ShouldCreate);
+ return getImpl(Context, getCanonicalMDString(Context, Name), Type, Storage,
+ ShouldCreate);
}
static DITemplateTypeParameter *getImpl(LLVMContext &Context, MDString *Name,
- Metadata *Type, bool IsDefault,
- StorageType Storage,
+ Metadata *Type, StorageType Storage,
bool ShouldCreate = true);
TempDITemplateTypeParameter cloneImpl() const {
- return getTemporary(getContext(), getName(), getType(), isDefault());
+ return getTemporary(getContext(), getName(), getType());
}
public:
- DEFINE_MDNODE_GET(DITemplateTypeParameter,
- (StringRef Name, DIType *Type, bool IsDefault),
- (Name, Type, IsDefault))
- DEFINE_MDNODE_GET(DITemplateTypeParameter,
- (MDString *Name, Metadata *Type, bool IsDefault),
- (Name, Type, IsDefault))
+ DEFINE_MDNODE_GET(DITemplateTypeParameter, (StringRef Name, DIType *Type),
+ (Name, Type))
+ DEFINE_MDNODE_GET(DITemplateTypeParameter, (MDString * Name, Metadata *Type),
+ (Name, Type))
TempDITemplateTypeParameter clone() const { return cloneImpl(); }
@@ -2199,40 +2191,36 @@ class DITemplateValueParameter : public DITemplateParameter {
friend class MDNode;
DITemplateValueParameter(LLVMContext &Context, StorageType Storage,
- unsigned Tag, bool IsDefault,
- ArrayRef<Metadata *> Ops)
+ unsigned Tag, ArrayRef<Metadata *> Ops)
: DITemplateParameter(Context, DITemplateValueParameterKind, Storage, Tag,
- IsDefault, Ops) {}
+ Ops) {}
~DITemplateValueParameter() = default;
static DITemplateValueParameter *getImpl(LLVMContext &Context, unsigned Tag,
StringRef Name, DIType *Type,
- bool IsDefault, Metadata *Value,
- StorageType Storage,
+ Metadata *Value, StorageType Storage,
bool ShouldCreate = true) {
return getImpl(Context, Tag, getCanonicalMDString(Context, Name), Type,
- IsDefault, Value, Storage, ShouldCreate);
+ Value, Storage, ShouldCreate);
}
static DITemplateValueParameter *getImpl(LLVMContext &Context, unsigned Tag,
MDString *Name, Metadata *Type,
- bool IsDefault, Metadata *Value,
- StorageType Storage,
+ Metadata *Value, StorageType Storage,
bool ShouldCreate = true);
TempDITemplateValueParameter cloneImpl() const {
return getTemporary(getContext(), getTag(), getName(), getType(),
- isDefault(), getValue());
+ getValue());
}
public:
DEFINE_MDNODE_GET(DITemplateValueParameter,
- (unsigned Tag, StringRef Name, DIType *Type, bool IsDefault,
+ (unsigned Tag, StringRef Name, DIType *Type,
Metadata *Value),
- (Tag, Name, Type, IsDefault, Value))
- DEFINE_MDNODE_GET(DITemplateValueParameter,
- (unsigned Tag, MDString *Name, Metadata *Type,
- bool IsDefault, Metadata *Value),
- (Tag, Name, Type, IsDefault, Value))
+ (Tag, Name, Type, Value))
+ DEFINE_MDNODE_GET(DITemplateValueParameter, (unsigned Tag, MDString *Name,
+ Metadata *Type, Metadata *Value),
+ (Tag, Name, Type, Value))
TempDITemplateValueParameter clone() const { return cloneImpl(); }
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index ad74303a784d..a9ccc350052c 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -4842,38 +4842,33 @@ bool LLParser::ParseDIModule(MDNode *&Result, bool IsDistinct) {
}
/// ParseDITemplateTypeParameter:
-/// ::= !DITemplateTypeParameter(name: "Ty", type: !1, defaulted: false)
+/// ::= !DITemplateTypeParameter(name: "Ty", type: !1)
bool LLParser::ParseDITemplateTypeParameter(MDNode *&Result, bool IsDistinct) {
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
OPTIONAL(name, MDStringField, ); \
- REQUIRED(type, MDField, ); \
- OPTIONAL(defaulted, MDBoolField, );
+ REQUIRED(type, MDField, );
PARSE_MD_FIELDS();
#undef VISIT_MD_FIELDS
- Result = GET_OR_DISTINCT(DITemplateTypeParameter,
- (Context, name.Val, type.Val, defaulted.Val));
+ Result =
+ GET_OR_DISTINCT(DITemplateTypeParameter, (Context, name.Val, type.Val));
return false;
}
/// ParseDITemplateValueParameter:
/// ::= !DITemplateValueParameter(tag: DW_TAG_template_value_parameter,
-/// name: "V", type: !1, defaulted: false,
-/// value: i32 7)
+/// name: "V", type: !1, value: i32 7)
bool LLParser::ParseDITemplateValueParameter(MDNode *&Result, bool IsDistinct) {
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
OPTIONAL(tag, DwarfTagField, (dwarf::DW_TAG_template_value_parameter)); \
OPTIONAL(name, MDStringField, ); \
OPTIONAL(type, MDField, ); \
- OPTIONAL(defaulted, MDBoolField, ); \
REQUIRED(value, MDField, );
-
PARSE_MD_FIELDS();
#undef VISIT_MD_FIELDS
- Result = GET_OR_DISTINCT(
- DITemplateValueParameter,
- (Context, tag.Val, name.Val, type.Val, defaulted.Val, value.Val));
+ Result = GET_OR_DISTINCT(DITemplateValueParameter,
+ (Context, tag.Val, name.Val, type.Val, value.Val));
return false;
}
diff --git a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
index 9a78a2bbcb4f..3cff468dca89 100644
--- a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
+++ b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
@@ -1668,34 +1668,27 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
break;
}
case bitc::METADATA_TEMPLATE_TYPE: {
- if (Record.size() < 3 || Record.size() > 4)
+ if (Record.size() != 3)
return error("Invalid record");
IsDistinct = Record[0];
- MetadataList.assignValue(
- GET_OR_DISTINCT(DITemplateTypeParameter,
- (Context, getMDString(Record[1]),
- getDITypeRefOrNull(Record[2]),
- (Record.size() == 4) ? getMDOrNull(Record[3])
- : getMDOrNull(false))),
- NextMetadataNo);
+ MetadataList.assignValue(GET_OR_DISTINCT(DITemplateTypeParameter,
+ (Context, getMDString(Record[1]),
+ getDITypeRefOrNull(Record[2]))),
+ NextMetadataNo);
NextMetadataNo++;
break;
}
case bitc::METADATA_TEMPLATE_VALUE: {
- if (Record.size() < 5 || Record.size() > 6)
+ if (Record.size() != 5)
return error("Invalid record");
IsDistinct = Record[0];
-
MetadataList.assignValue(
- GET_OR_DISTINCT(
- DITemplateValueParameter,
- (Context, Record[1], getMDString(Record[2]),
- getDITypeRefOrNull(Record[3]),
- (Record.size() == 6) ? getMDOrNull(Record[4]) : getMDOrNull(false),
- (Record.size() == 6) ? getMDOrNull(Record[5])
- : getMDOrNull(Record[4]))),
+ GET_OR_DISTINCT(DITemplateValueParameter,
+ (Context, Record[1], getMDString(Record[2]),
+ getDITypeRefOrNull(Record[3]),
+ getMDOrNull(Record[4]))),
NextMetadataNo);
NextMetadataNo++;
break;
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index f2ee1fd930a8..6f3ff32279f1 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -1792,7 +1792,6 @@ void ModuleBitcodeWriter::writeDITemplateTypeParameter(
Record.push_back(N->isDistinct());
Record.push_back(VE.getMetadataOrNullID(N->getRawName()));
Record.push_back(VE.getMetadataOrNullID(N->getType()));
- Record.push_back(N->isDefault());
Stream.EmitRecord(bitc::METADATA_TEMPLATE_TYPE, Record, Abbrev);
Record.clear();
@@ -1805,7 +1804,6 @@ void ModuleBitcodeWriter::writeDITemplateValueParameter(
Record.push_back(N->getTag());
Record.push_back(VE.getMetadataOrNullID(N->getRawName()));
Record.push_back(VE.getMetadataOrNullID(N->getType()));
- Record.push_back(N->isDefault());
Record.push_back(VE.getMetadataOrNullID(N->getValue()));
Stream.EmitRecord(bitc::METADATA_TEMPLATE_VALUE, Record, Abbrev);
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 7c0b79fcabd9..049aedd754ab 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -2073,7 +2073,6 @@ static void writeDITemplateTypeParameter(raw_ostream &Out,
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
Printer.printString("name", N->getName());
Printer.printMetadata("type", N->getRawType(), /* ShouldSkipNull */ false);
- Printer.printBool("defaulted", N->isDefault(), /* Default= */ false);
Out << ")";
}
@@ -2088,7 +2087,6 @@ static void writeDITemplateValueParameter(raw_ostream &Out,
Printer.printTag(N);
Printer.printString("name", N->getName());
Printer.printMetadata("type", N->getRawType());
- Printer.printBool("defaulted", N->isDefault(), /* Default= */ false);
Printer.printMetadata("value", N->getValue(), /* ShouldSkipNull */ false);
Out << ")";
}
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index 762d9a1c1b46..60003991307d 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -406,26 +406,25 @@ DIBuilder::createObjCProperty(StringRef Name, DIFile *File, unsigned LineNumber,
DITemplateTypeParameter *
DIBuilder::createTemplateTypeParameter(DIScope *Context, StringRef Name,
- DIType *Ty, bool isDefault) {
+ DIType *Ty) {
assert((!Context || isa<DICompileUnit>(Context)) && "Expected compile unit");
- return DITemplateTypeParameter::get(VMContext, Name, Ty, isDefault);
+ return DITemplateTypeParameter::get(VMContext, Name, Ty);
}
static DITemplateValueParameter *
createTemplateValueParameterHelper(LLVMContext &VMContext, unsigned Tag,
DIScope *Context, StringRef Name, DIType *Ty,
- bool IsDefault, Metadata *MD) {
+ Metadata *MD) {
assert((!Context || isa<DICompileUnit>(Context)) && "Expected compile unit");
- return DITemplateValueParameter::get(VMContext, Tag, Name, Ty, IsDefault, MD);
+ return DITemplateValueParameter::get(VMContext, Tag, Name, Ty, MD);
}
DITemplateValueParameter *
DIBuilder::createTemplateValueParameter(DIScope *Context, StringRef Name,
- DIType *Ty, bool isDefault,
- Constant *Val) {
+ DIType *Ty, Constant *Val) {
return createTemplateValueParameterHelper(
VMContext, dwarf::DW_TAG_template_value_parameter, Context, Name, Ty,
- isDefault, getConstantOrNull(Val));
+ getConstantOrNull(Val));
}
DITemplateValueParameter *
@@ -433,7 +432,7 @@ DIBuilder::createTemplateTemplateParameter(DIScope *Context, StringRef Name,
DIType *Ty, StringRef Val) {
return createTemplateValueParameterHelper(
VMContext, dwarf::DW_TAG_GNU_template_template_param, Context, Name, Ty,
- false, MDString::get(VMContext, Val));
+ MDString::get(VMContext, Val));
}
DITemplateValueParameter *
@@ -441,7 +440,7 @@ DIBuilder::createTemplateParameterPack(DIScope *Context, StringRef Name,
DIType *Ty, DINodeArray Val) {
return createTemplateValueParameterHelper(
VMContext, dwarf::DW_TAG_GNU_template_parameter_pack, Context, Name, Ty,
- false, Val.get());
+ Val.get());
}
DICompositeType *DIBuilder::createClassType(
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index b630a2893b4d..c470a9696c3d 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -724,24 +724,24 @@ DIModule *DIModule::getImpl(LLVMContext &Context, Metadata *Scope,
DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(DIModule, Ops);
}
-DITemplateTypeParameter *
-DITemplateTypeParameter::getImpl(LLVMContext &Context, MDString *Name,
- Metadata *Type, bool isDefault,
- StorageType Storage, bool ShouldCreate) {
+DITemplateTypeParameter *DITemplateTypeParameter::getImpl(LLVMContext &Context,
+ MDString *Name,
+ Metadata *Type,
+ StorageType Storage,
+ bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
- DEFINE_GETIMPL_LOOKUP(DITemplateTypeParameter, (Name, Type, isDefault));
+ DEFINE_GETIMPL_LOOKUP(DITemplateTypeParameter, (Name, Type));
Metadata *Ops[] = {Name, Type};
- DEFINE_GETIMPL_STORE(DITemplateTypeParameter, (isDefault), Ops);
+ DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(DITemplateTypeParameter, Ops);
}
DITemplateValueParameter *DITemplateValueParameter::getImpl(
LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *Type,
- bool isDefault, Metadata *Value, StorageType Storage, bool ShouldCreate) {
+ Metadata *Value, StorageType Storage, bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
- DEFINE_GETIMPL_LOOKUP(DITemplateValueParameter,
- (Tag, Name, Type, isDefault, Value));
+ DEFINE_GETIMPL_LOOKUP(DITemplateValueParameter, (Tag, Name, Type, Value));
Metadata *Ops[] = {Name, Type, Value};
- DEFINE_GETIMPL_STORE(DITemplateValueParameter, (Tag, isDefault), Ops);
+ DEFINE_GETIMPL_STORE(DITemplateValueParameter, (Tag), Ops);
}
DIGlobalVariable *
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index 7f324b103997..e912c4ba1f70 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -843,45 +843,36 @@ template <> struct MDNodeKeyImpl<DIModule> {
template <> struct MDNodeKeyImpl<DITemplateTypeParameter> {
MDString *Name;
Metadata *Type;
- bool IsDefault;
- MDNodeKeyImpl(MDString *Name, Metadata *Type, bool IsDefault)
- : Name(Name), Type(Type), IsDefault(IsDefault) {}
+ MDNodeKeyImpl(MDString *Name, Metadata *Type) : Name(Name), Type(Type) {}
MDNodeKeyImpl(const DITemplateTypeParameter *N)
- : Name(N->getRawName()), Type(N->getRawType()),
- IsDefault(N->isDefault()) {}
+ : Name(N->getRawName()), Type(N->getRawType()) {}
bool isKeyOf(const DITemplateTypeParameter *RHS) const {
- return Name == RHS->getRawName() && Type == RHS->getRawType() &&
- IsDefault == RHS->isDefault();
+ return Name == RHS->getRawName() && Type == RHS->getRawType();
}
- unsigned getHashValue() const { return hash_combine(Name, Type, IsDefault); }
+ unsigned getHashValue() const { return hash_combine(Name, Type); }
};
template <> struct MDNodeKeyImpl<DITemplateValueParameter> {
unsigned Tag;
MDString *Name;
Metadata *Type;
- bool IsDefault;
Metadata *Value;
- MDNodeKeyImpl(unsigned Tag, MDString *Name, Metadata *Type, bool IsDefault,
- Metadata *Value)
- : Tag(Tag), Name(Name), Type(Type), IsDefault(IsDefault), Value(Value) {}
+ MDNodeKeyImpl(unsigned Tag, MDString *Name, Metadata *Type, Metadata *Value)
+ : Tag(Tag), Name(Name), Type(Type), Value(Value) {}
MDNodeKeyImpl(const DITemplateValueParameter *N)
: Tag(N->getTag()), Name(N->getRawName()), Type(N->getRawType()),
- IsDefault(N->isDefault()), Value(N->getValue()) {}
+ Value(N->getValue()) {}
bool isKeyOf(const DITemplateValueParameter *RHS) const {
return Tag == RHS->getTag() && Name == RHS->getRawName() &&
- Type == RHS->getRawType() && IsDefault == RHS->isDefault() &&
- Value == RHS->getValue();
+ Type == RHS->getRawType() && Value == RHS->getValue();
}
- unsigned getHashValue() const {
- return hash_combine(Tag, Name, Type, IsDefault, Value);
- }
+ unsigned getHashValue() const { return hash_combine(Tag, Name, Type, Value); }
};
template <> struct MDNodeKeyImpl<DIGlobalVariable> {
diff --git a/llvm/test/Assembler/DITemplateParameter.ll b/llvm/test/Assembler/DITemplateParameter.ll
deleted file mode 100644
index d78377adfada..000000000000
--- a/llvm/test/Assembler/DITemplateParameter.ll
+++ /dev/null
@@ -1,65 +0,0 @@
-; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
-; RUN: verify-uselistorder %s
-
-; ModuleID = '/dir/test.cpp'
-source_filename = "test.cpp"
-target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
-%class.foo = type { i8 }
-%class.foo.0 = type { i8 }
-; Function Attrs: noinline norecurse nounwind optnone uwtable
-define dso_local i32 @main() #0 !dbg !7 {
-entry:
- %retval = alloca i32, align 4
- %f1 = alloca %class.foo, align 1
- %f2 = alloca %class.foo.0, align 1
- store i32 0, i32* %retval, align 4
- call void @llvm.dbg.declare(metadata %class.foo* %f1, metadata !11, metadata !DIExpression()), !dbg !16
- call void @llvm.dbg.declare(metadata %class.foo.0* %f2, metadata !17, metadata !DIExpression()), !dbg !23
- ret i32 0, !dbg !24
-}
-; Function Attrs: nounwind readnone speculatable willreturn
-declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
-
-attributes #0 = { noinline norecurse nounwind optnone uwtable }
-attributes #1 = { nounwind readnone speculatable willreturn }
-
-!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!3, !4, !5}
-!llvm.ident = !{!6}
-
-!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 11.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
-!1 = !DIFile(filename: "test.cpp", directory: "/dir/", checksumkind: CSK_MD5, checksum: "863d08522c2300490dea873efc4b2369")
-!2 = !{}
-!3 = !{i32 7, !"Dwarf Version", i32 5}
-!4 = !{i32 2, !"Debug Info Version", i32 3}
-!5 = !{i32 1, !"wchar_size", i32 4}
-!6 = !{!"clang version 11.0.0"}
-!7 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 29, type: !8, scopeLine: 29, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
-!8 = !DISubroutineType(types: !9)
-!9 = !{!10}
-!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
-!11 = !DILocalVariable(name: "f1", scope: !7, file: !1, line: 30, type: !12)
-!12 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "foo<int, 6>", file: !1, line: 26, size: 8, flags: DIFlagTypePassByValue, elements: !2, templateParams: !13, identifier: "_ZTS3fooIiLi6EE")
-!13 = !{!14, !15}
-
-; CHECK: 14 = !DITemplateTypeParameter(name: "T", type: !{{[0-9]*}})
-!14 = !DITemplateTypeParameter(name: "T", type: !10)
-
-; CHECK: 15 = !DITemplateValueParameter(name: "i", type: !{{[0-9]*}}, value: i32 6)
-!15 = !DITemplateValueParameter(name: "i", type: !10, value: i32 6)
-
-!16 = !DILocation(line: 30, column: 14, scope: !7)
-!17 = !DILocalVariable(name: "f2", scope: !7, file: !1, line: 31, type: !18)
-!18 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "foo<char, 3>", file: !1, line: 26, size: 8, flags: DIFlagTypePassByValue, elements: !2, templateParams: !19, identifier: "_ZTS3fooIcLi3EE")
-!19 = !{!20, !22}
-
-; CHECK: 20 = !DITemplateTypeParameter({{.*}}, defaulted: true
-!20 = !DITemplateTypeParameter(name: "T", type: !21, defaulted: true)
-!21 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
-
-; CHECK: 22 = !DITemplateValueParameter({{.*}}, defaulted: true
-!22 = !DITemplateValueParameter(name: "i", type: !10, defaulted: true, value: i32 3)
-!23 = !DILocation(line: 31, column: 9, scope: !7)
-!24 = !DILocation(line: 32, column: 3, scope: !7)
diff --git a/llvm/test/Bitcode/DITemplateParameter-5.0.ll b/llvm/test/Bitcode/DITemplateParameter-5.0.ll
deleted file mode 100644
index 1659bd6d84a3..000000000000
--- a/llvm/test/Bitcode/DITemplateParameter-5.0.ll
+++ /dev/null
@@ -1,69 +0,0 @@
-; RUN: llvm-dis -o - %s.bc | FileCheck %s
-
-; ModuleID = '/dir/test.cpp'
-source_filename = "test.cpp"
-target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
-%class.foo = type { i8 }
-%class.foo.0 = type { i8 }
-; Function Attrs: noinline norecurse nounwind optnone uwtable
-define dso_local i32 @main() #0 !dbg !7 {
-entry:
- %retval = alloca i32, align 4
- %f1 = alloca %class.foo, align 1
- %f2 = alloca %class.foo.0, align 1
- store i32 0, i32* %retval, align 4
- call void @llvm.dbg.declare(metadata %class.foo* %f1, metadata !11, metadata !DIExpression()), !dbg !16
- call void @llvm.dbg.declare(metadata %class.foo.0* %f2, metadata !17, metadata !DIExpression()), !dbg !23
- ret i32 0, !dbg !24
-}
-; Function Attrs: nounwind readnone speculatable willreturn
-declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
-
-attributes #0 = { noinline norecurse nounwind optnone uwtable }
-attributes #1 = { nounwind readnone speculatable willreturn }
-
-!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!3, !4, !5}
-!llvm.ident = !{!6}
-
-!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 11.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
-!1 = !DIFile(filename: "test.cpp", directory: "/dir/", checksumkind: CSK_MD5, checksum: "863d08522c2300490dea873efc4b2369")
-!2 = !{}
-!3 = !{i32 7, !"Dwarf Version", i32 5}
-!4 = !{i32 2, !"Debug Info Version", i32 3}
-!5 = !{i32 1, !"wchar_size", i32 4}
-!6 = !{!"clang version 11.0.0"}
-!7 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 29, type: !8, scopeLine: 29, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
-!8 = !DISubroutineType(types: !9)
-!9 = !{!10}
-!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
-!11 = !DILocalVariable(name: "f1", scope: !7, file: !1, line: 30, type: !12)
-!12 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "foo<int, 6>", file: !1, line: 26, size: 8, flags: DIFlagTypePassByValue, elements: !2, templateParams: !13, identifier: "_ZTS3fooIiLi6EE")
-!13 = !{!14, !15}
-
-; Old-style DITemplateTypeParameter and DITemplateValueParameter should be
-; upgraded to include defaulted flag.
-
-; CHECK: !DITemplateTypeParameter({{.*}}
-!14 = !DITemplateTypeParameter(name: "T", type: !10)
-
-; CHECK: !DITemplateValueParameter({{.*}}
-!15 = !DITemplateValueParameter(name: "i", type: !10, value: i32 6)
-
-!16 = !DILocation(line: 30, column: 14, scope: !7)
-!17 = !DILocalVariable(name: "f2", scope: !7, file: !1, line: 31, type: !18)
-!18 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "foo<char, 3>", file: !1, line: 26, size: 8, flags: DIFlagTypePassByValue, elements: !2, templateParams: !19, identifier: "_ZTS3fooIcLi3EE")
-!19 = !{!20, !22}
-
-; CHECK: !DITemplateTypeParameter({{.*}} defaulted: true
-!20 = !DITemplateTypeParameter(name: "T", type: !21, defaulted: true)
-
-!21 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
-
-; CHECK: !DITemplateValueParameter({{.*}} defaulted: true
-!22 = !DITemplateValueParameter(name: "i", type: !10, defaulted: true, value: i32 3)
-
-!23 = !DILocation(line: 31, column: 9, scope: !7)
-!24 = !DILocation(line: 32, column: 3, scope: !7)
diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp
index 0480f9761731..6c06af8bd71e 100644
--- a/llvm/unittests/IR/MetadataTest.cpp
+++ b/llvm/unittests/IR/MetadataTest.cpp
@@ -2076,19 +2076,17 @@ typedef MetadataTest DITemplateTypeParameterTest;
TEST_F(DITemplateTypeParameterTest, get) {
StringRef Name = "template";
DIType *Type = getBasicType("basic");
- bool defaulted = false;
- auto *N = DITemplateTypeParameter::get(Context, Name, Type, defaulted);
+ auto *N = DITemplateTypeParameter::get(Context, Name, Type);
EXPECT_EQ(dwarf::DW_TAG_template_type_parameter, N->getTag());
EXPECT_EQ(Name, N->getName());
EXPECT_EQ(Type, N->getType());
- EXPECT_EQ(N, DITemplateTypeParameter::get(Context, Name, Type, defaulted));
+ EXPECT_EQ(N, DITemplateTypeParameter::get(Context, Name, Type));
- EXPECT_NE(N, DITemplateTypeParameter::get(Context, "other", Type, defaulted));
- EXPECT_NE(N, DITemplateTypeParameter::get(Context, Name,
- getBasicType("other"), defaulted));
- EXPECT_NE(N, DITemplateTypeParameter::get(Context, Name, Type, true));
+ EXPECT_NE(N, DITemplateTypeParameter::get(Context, "other", Type));
+ EXPECT_NE(N,
+ DITemplateTypeParameter::get(Context, Name, getBasicType("other")));
TempDITemplateTypeParameter Temp = N->clone();
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
@@ -2100,31 +2098,24 @@ TEST_F(DITemplateValueParameterTest, get) {
unsigned Tag = dwarf::DW_TAG_template_value_parameter;
StringRef Name = "template";
DIType *Type = getBasicType("basic");
- bool defaulted = false;
Metadata *Value = getConstantAsMetadata();
- auto *N =
- DITemplateValueParameter::get(Context, Tag, Name, Type, defaulted, Value);
+ auto *N = DITemplateValueParameter::get(Context, Tag, Name, Type, Value);
EXPECT_EQ(Tag, N->getTag());
EXPECT_EQ(Name, N->getName());
EXPECT_EQ(Type, N->getType());
EXPECT_EQ(Value, N->getValue());
- EXPECT_EQ(N, DITemplateValueParameter::get(Context, Tag, Name, Type,
- defaulted, Value));
+ EXPECT_EQ(N, DITemplateValueParameter::get(Context, Tag, Name, Type, Value));
EXPECT_NE(N, DITemplateValueParameter::get(
Context, dwarf::DW_TAG_GNU_template_template_param, Name,
- Type, defaulted, Value));
- EXPECT_NE(N, DITemplateValueParameter::get(Context, Tag, "other", Type,
- defaulted, Value));
- EXPECT_NE(N, DITemplateValueParameter::get(Context, Tag, Name,
- getBasicType("other"), defaulted,
- Value));
+ Type, Value));
EXPECT_NE(N,
- DITemplateValueParameter::get(Context, Tag, Name, Type, defaulted,
- getConstantAsMetadata()));
- EXPECT_NE(
- N, DITemplateValueParameter::get(Context, Tag, Name, Type, true, Value));
+ DITemplateValueParameter::get(Context, Tag, "other", Type, Value));
+ EXPECT_NE(N, DITemplateValueParameter::get(Context, Tag, Name,
+ getBasicType("other"), Value));
+ EXPECT_NE(N, DITemplateValueParameter::get(Context, Tag, Name, Type,
+ getConstantAsMetadata()));
TempDITemplateValueParameter Temp = N->clone();
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
More information about the cfe-commits
mailing list