diff --git a/clang/lib/Sema/SemaBSCTrait.cpp b/clang/lib/Sema/SemaBSCTrait.cpp index dfd08633e44d65f07d00a6c28dea26c16a8ebbce..8370c4f5b2d9c87c1d814c6c5f13b2cb9b420907 100644 --- a/clang/lib/Sema/SemaBSCTrait.cpp +++ b/clang/lib/Sema/SemaBSCTrait.cpp @@ -41,14 +41,17 @@ RecordDecl *Sema::ActOnDesugarVtableRecord(SourceLocation StartLoc, return Result; } -// when we saw a trait like: -// ` trait I {int g(This *this);}; -// we should generate two struct in ast: +// When we see a trait like: +// trait I { +// int g(This *this); +// }; +// +// We generate two structs in ast: // |--RecordDecl struct Trait_I_Vtable -// |----FieldDecl g 'int (*)(void *this)' +// `---FieldDecl g 'int (*)(void *this)' // |--RecordDecl struct Trait_I -// |----FieldDecl data (*)(void) -// |----FieldDecl vtable struct (*)Trait_I_Vtable +// `---FieldDecl data (*)(void) +// `---FieldDecl vtable struct (*)Trait_I_Vtable void Sema::ActOnDesugarTraitVtable(TraitDecl *Find, RecordDecl *TraitVtableRD, SourceLocation StartLoc, SourceLocation NameLoc, IdentifierInfo *Name, @@ -156,7 +159,6 @@ ImplTraitDecl *Sema::BuildImplTraitDecl(Scope *S, Declarator &D, DeclarationName Name = GetNameForDeclarator(D).getName(); IdentifierInfo *II = Name.getAsIdentifierInfo(); - // We should move this piece of code. ImplTraitDecl *ITD = nullptr; ITD = ImplTraitDecl::Create(Context, DC, D.getBeginLoc(), D.getIdentifierLoc(), @@ -250,10 +252,9 @@ VarDecl *Sema::DesugarImplTrait(ImplTraitDecl *ITD, Declarator &D) { QualType QT = TraitRecord->getTypeForDecl()->getCanonicalTypeInternal(); TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); QualType T = TInfo->getType().getCanonicalType(); - VarDecl *LookUpVar = TD->getTypeImpledVarDecl( - T); // If we have the same ImplTraitDecl before, return nullptr - if (LookUpVar) - return nullptr; + VarDecl *LookUpVar = TD->getTypeImpledVarDecl(T); + // If we have the same ImplTraitDecl before, return nullptr + if (LookUpVar) return nullptr; PrintingPolicy PrintPolicy = LangOptions(); SplitQualType T_split = T.split(); std::string Ty = T.getAsString(T_split, PrintPolicy); diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index b3fb666b4e6a4a8535d12b0f2edd79166719d97b..fddfe84b6ab45ee52666de3a1fff4ca63485f43e 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -463,9 +463,9 @@ void Sema::ActOnPragmaSafe(PragmaSafeStatus St) { void Sema::ActOnPragmaPreferInline(PragmaPreferInlineStatus St) { PreferInlineScopeSpecifier spec = PI_None; - if (St == PSS_On) { + if (St == PPI_On) { spec = PI_PreferInline; - } else if (St == PSS_Off) { + } else if (St == PPI_Off) { spec = PI_PreferNoInline; } SetPragmaPreferInlineInfo(spec);