зеркало из https://github.com/microsoft/clang-1.git
compared to the rest of the code in Sema::GetStdNamespace(),
looking up the "std" identifier is trivial. Just do it, particularly since this is only done if the namespace hasn't already been looked up. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59710 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
2bac0f6b37
Коммит
8edea83d4d
|
@ -103,7 +103,6 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer)
|
||||||
KnownFunctionIDs[id_vsnprintf_chk] = &IT.get("__builtin___vsnprintf_chk");
|
KnownFunctionIDs[id_vsnprintf_chk] = &IT.get("__builtin___vsnprintf_chk");
|
||||||
KnownFunctionIDs[id_vprintf] = &IT.get("vprintf");
|
KnownFunctionIDs[id_vprintf] = &IT.get("vprintf");
|
||||||
|
|
||||||
Ident_StdNs = &IT.get("std");
|
|
||||||
Ident_TypeInfo = 0;
|
Ident_TypeInfo = 0;
|
||||||
StdNamespace = 0;
|
StdNamespace = 0;
|
||||||
|
|
||||||
|
|
|
@ -193,7 +193,6 @@ public:
|
||||||
IdentifierInfo* KnownFunctionIDs[id_num_known_functions];
|
IdentifierInfo* KnownFunctionIDs[id_num_known_functions];
|
||||||
|
|
||||||
/// Identifiers used by the C++ language
|
/// Identifiers used by the C++ language
|
||||||
IdentifierInfo *Ident_StdNs; // "std"
|
|
||||||
IdentifierInfo *Ident_TypeInfo; // "type_info" - lazily created
|
IdentifierInfo *Ident_TypeInfo; // "type_info" - lazily created
|
||||||
|
|
||||||
/// Translation Unit Scope - useful to Objective-C actions that need
|
/// Translation Unit Scope - useful to Objective-C actions that need
|
||||||
|
|
|
@ -278,8 +278,9 @@ ScopedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid,
|
||||||
/// everything from the standard library is defined.
|
/// everything from the standard library is defined.
|
||||||
NamespaceDecl *Sema::GetStdNamespace() {
|
NamespaceDecl *Sema::GetStdNamespace() {
|
||||||
if (!StdNamespace) {
|
if (!StdNamespace) {
|
||||||
|
IdentifierInfo *StdIdent = &PP.getIdentifierTable().get("std");
|
||||||
DeclContext *Global = Context.getTranslationUnitDecl();
|
DeclContext *Global = Context.getTranslationUnitDecl();
|
||||||
Decl *Std = LookupDecl(Ident_StdNs, Decl::IDNS_Tag | Decl::IDNS_Ordinary,
|
Decl *Std = LookupDecl(StdIdent, Decl::IDNS_Tag | Decl::IDNS_Ordinary,
|
||||||
0, Global, /*enableLazyBuiltinCreation=*/false);
|
0, Global, /*enableLazyBuiltinCreation=*/false);
|
||||||
StdNamespace = dyn_cast_or_null<NamespaceDecl>(Std);
|
StdNamespace = dyn_cast_or_null<NamespaceDecl>(Std);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче