diff options
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index cfb1f99b07c..cf3ea30bd2c 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -12535,6 +12535,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, DeclContext *SearchDC = CurContext; DeclContext *DC = CurContext; bool isStdBadAlloc = false; + bool isStdAlignValT = false; RedeclarationKind Redecl = ForRedeclaration; if (TUK == TUK_Friend || TUK == TUK_Reference) @@ -12689,15 +12690,20 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, } if (getLangOpts().CPlusPlus && Name && DC && StdNamespace && - DC->Equals(getStdNamespace()) && Name->isStr("bad_alloc")) { - // This is a declaration of or a reference to "std::bad_alloc". - isStdBadAlloc = true; + DC->Equals(getStdNamespace())) { + if (Name->isStr("bad_alloc")) { + // This is a declaration of or a reference to "std::bad_alloc". + isStdBadAlloc = true; - if (Previous.empty() && StdBadAlloc) { - // std::bad_alloc has been implicitly declared (but made invisible to - // name lookup). Fill in this implicit declaration as the previous + // If std::bad_alloc has been implicitly declared (but made invisible to + // name lookup), fill in this implicit declaration as the previous // declaration, so that the declarations get chained appropriately. - Previous.addDecl(getStdBadAlloc()); + if (Previous.empty() && StdBadAlloc) + Previous.addDecl(getStdBadAlloc()); + } else if (Name->isStr("align_val_t")) { + isStdAlignValT = true; + if (Previous.empty() && StdAlignValT) + Previous.addDecl(getStdAlignValT()); } } @@ -13089,6 +13095,10 @@ CreateNewDecl: New = EnumDecl::Create(Context, SearchDC, KWLoc, Loc, Name, cast_or_null<EnumDecl>(PrevDecl), ScopedEnum, ScopedEnumUsesClassTag, !EnumUnderlying.isNull()); + + if (isStdAlignValT && (!StdAlignValT || getStdAlignValT()->isImplicit())) + StdAlignValT = cast<EnumDecl>(New); + // If this is an undefined enum, warn. if (TUK != TUK_Definition && !Invalid) { TagDecl *Def; |