forked from OSchip/llvm-project
Fix PCH issue. Attributes of a declaration were truncated to just one when the decl was read from a PCH file.
llvm-svn: 105852
This commit is contained in:
parent
649caee022
commit
9116717189
|
@ -297,6 +297,7 @@ public:
|
|||
}
|
||||
|
||||
bool hasAttrs() const { return HasAttrs; }
|
||||
void initAttrs(Attr *attrs);
|
||||
void addAttr(Attr *attr);
|
||||
const Attr *getAttrs() const {
|
||||
if (!HasAttrs) return 0; // common case, no attributes.
|
||||
|
|
|
@ -314,9 +314,20 @@ unsigned Decl::getIdentifierNamespaceForKind(Kind DeclKind) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void Decl::initAttrs(Attr *attrs) {
|
||||
assert(!HasAttrs && "Decl already contains attrs.");
|
||||
|
||||
Attr *&AttrBlank = getASTContext().getDeclAttrs(this);
|
||||
assert(AttrBlank == 0 && "HasAttrs was wrong?");
|
||||
|
||||
AttrBlank = attrs;
|
||||
HasAttrs = true;
|
||||
}
|
||||
|
||||
void Decl::addAttr(Attr *NewAttr) {
|
||||
Attr *&ExistingAttr = getASTContext().getDeclAttrs(this);
|
||||
|
||||
assert(NewAttr->getNext() == 0 && "Chain of attributes will be truncated!");
|
||||
NewAttr->setNext(ExistingAttr);
|
||||
ExistingAttr = NewAttr;
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ void PCHDeclReader::VisitDecl(Decl *D) {
|
|||
D->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
||||
D->setInvalidDecl(Record[Idx++]);
|
||||
if (Record[Idx++])
|
||||
D->addAttr(Reader.ReadAttributes());
|
||||
D->initAttrs(Reader.ReadAttributes());
|
||||
D->setImplicit(Record[Idx++]);
|
||||
D->setUsed(Record[Idx++]);
|
||||
D->setAccess((AccessSpecifier)Record[Idx++]);
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
|
||||
|
||||
|
||||
int f(int) __attribute__((overloadable));
|
||||
int f(int) __attribute__((visibility("default"), overloadable));
|
||||
|
|
Loading…
Reference in New Issue