diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/Sema.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/Sema.h | 3 | ||||
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 19 |
3 files changed, 7 insertions, 17 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index e1eb86c98f..c9e4cd9833 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -103,9 +103,7 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer) KnownFunctionIDs[id_vsnprintf_chk] = &IT.get("__builtin___vsnprintf_chk"); KnownFunctionIDs[id_vprintf] = &IT.get("vprintf"); - Ident_TypeInfo = 0; StdNamespace = 0; - TUScope = 0; if (getLangOptions().CPlusPlus) FieldCollector.reset(new CXXFieldCollector()); diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index 7840dec5e7..52610ef6b7 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -192,9 +192,6 @@ public: /// This list is populated upon the creation of a Sema object. IdentifierInfo* KnownFunctionIDs[id_num_known_functions]; - /// Identifiers used by the C++ language - IdentifierInfo *Ident_TypeInfo; // "type_info" - lazily created - /// Translation Unit Scope - useful to Objective-C actions that need /// to lookup file scope declarations in the "ordinary" C decl namespace. /// For example, user-defined classes, built-in "id" type, etc. diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 0186fc3f14..80bd8eeef3 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -55,21 +55,16 @@ Action::ExprResult Sema::ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc) { const NamespaceDecl *StdNs = GetStdNamespace(); - if (!StdNs) { - Diag(OpLoc, diag::err_need_header_before_typeid); - return ExprResult(true); - } - if (!Ident_TypeInfo) { - Ident_TypeInfo = &PP.getIdentifierTable().get("type_info"); - } - Decl *TypeInfoDecl = LookupDecl(Ident_TypeInfo, + if (!StdNs) + return Diag(OpLoc, diag::err_need_header_before_typeid); + + IdentifierInfo *TypeInfoII = &PP.getIdentifierTable().get("type_info"); + Decl *TypeInfoDecl = LookupDecl(TypeInfoII, Decl::IDNS_Tag | Decl::IDNS_Ordinary, 0, StdNs, /*createBuiltins=*/false); RecordDecl *TypeInfoRecordDecl = dyn_cast_or_null<RecordDecl>(TypeInfoDecl); - if (!TypeInfoRecordDecl) { - Diag(OpLoc, diag::err_need_header_before_typeid); - return ExprResult(true); - } + if (!TypeInfoRecordDecl) + return Diag(OpLoc, diag::err_need_header_before_typeid); QualType TypeInfoType = Context.getTypeDeclType(TypeInfoRecordDecl); |