}
// Target-dependent attributes:
case lltok::StringConstant: {
- std::string Attr = Lex.getStrVal();
- Lex.Lex();
- std::string Val;
- if (EatIfPresent(lltok::equal) &&
- ParseStringConstant(Val))
+ if (ParseStringAttribute(B))
return true;
-
- B.addAttribute(Attr, Val);
continue;
}
ParseToken(lltok::rparen, "expected ')' in address space");
}
+/// ParseStringAttribute
+/// := StringConstant
+/// := StringConstant '=' StringConstant
+bool LLParser::ParseStringAttribute(AttrBuilder &B) {
+ std::string Attr = Lex.getStrVal();
+ Lex.Lex();
+ std::string Val;
+ if (EatIfPresent(lltok::equal) && ParseStringConstant(Val))
+ return true;
+ B.addAttribute(Attr, Val);
+ return false;
+}
+
/// ParseOptionalParamAttrs - Parse a potentially empty list of parameter attributes.
bool LLParser::ParseOptionalParamAttrs(AttrBuilder &B) {
bool HaveError = false;
switch (Token) {
default: // End of attributes.
return HaveError;
+ case lltok::StringConstant: {
+ if (ParseStringAttribute(B))
+ return true;
+ continue;
+ }
case lltok::kw_align: {
unsigned Alignment;
if (ParseOptionalAlignment(Alignment))
switch (Token) {
default: // End of attributes.
return HaveError;
+ case lltok::StringConstant: {
+ if (ParseStringAttribute(B))
+ return true;
+ continue;
+ }
case lltok::kw_dereferenceable: {
uint64_t Bytes;
if (ParseOptionalDerefAttrBytes(lltok::kw_dereferenceable, Bytes))
if (!F) {
// Make a global variable as a placeholder for this reference.
GlobalValue *&FwdRef =
- ForwardRefBlockAddresses.insert(std::make_pair(
- std::move(Fn),
- std::map<ValID, GlobalValue *>()))
+ ForwardRefBlockAddresses.insert(std::make_pair, std::move(Fn),
+ std::map<ValID, GlobalValue *>())
.first->second.insert(std::make_pair(std::move(Label), nullptr))
.first->second;
if (!FwdRef)
}
}
- SmallPtrSet<const Type*, 4> Visited;
+ SmallPtrSet<Type*, 4> Visited;
if (!Indices.empty() && !Ty->isSized(&Visited))
return Error(ID.Loc, "base element of getelementptr must be sized");
/// enums: !1, retainedTypes: !2, subprograms: !3,
/// globals: !4, imports: !5, dwoId: 0x0abcd)
bool LLParser::ParseDICompileUnit(MDNode *&Result, bool IsDistinct) {
+ if (!IsDistinct)
+ return Lex.Error("missing 'distinct', required for !DICompileUnit");
+
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
REQUIRED(language, DwarfLangField, ); \
REQUIRED(file, MDField, (/* AllowNull */ false)); \
PARSE_MD_FIELDS();
#undef VISIT_MD_FIELDS
- Result = GET_OR_DISTINCT(DICompileUnit,
- (Context, language.Val, file.Val, producer.Val,
- isOptimized.Val, flags.Val, runtimeVersion.Val,
- splitDebugFilename.Val, emissionKind.Val, enums.Val,
- retainedTypes.Val, subprograms.Val, globals.Val,
- imports.Val, dwoId.Val));
+ Result = DICompileUnit::getDistinct(
+ Context, language.Val, file.Val, producer.Val, isOptimized.Val, flags.Val,
+ runtimeVersion.Val, splitDebugFilename.Val, emissionKind.Val, enums.Val,
+ retainedTypes.Val, subprograms.Val, globals.Val, imports.Val, dwoId.Val);
return false;
}
Indices.push_back(Val);
}
- SmallPtrSet<const Type*, 4> Visited;
+ SmallPtrSet<Type*, 4> Visited;
if (!Indices.empty() && !Ty->isSized(&Visited))
return Error(Loc, "base element of getelementptr must be sized");