summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/IdentifierResolver.h
Commit message (Collapse)AuthorAgeFilesLines
* Move Sema's headers into include/clang/Sema, renaming a few along the way.Douglas Gregor2010-08-121-203/+0
| | | | llvm-svn: 110945
* Eliminate dead code.Eli Friedman2010-01-021-11/+0
| | | | llvm-svn: 92424
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-5/+5
| | | | llvm-svn: 81346
* Lazy deserialization of the declaration chains associated withDouglas Gregor2009-04-211-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | identifiers from a precompiled header. This patch changes the primary name lookup method for entities within a precompiled header. Previously, we would load all of the names of declarations at translation unit scope into a large DenseMap (inside the TranslationUnitDecl's DeclContext), and then perform a special "last resort" lookup into this DeclContext when we knew there was a PCH file (see Sema::LookupName). Now, when we see an identifier named for the first time, we load all of the declarations with that name that are visible from the translation unit into the IdentifierInfo's chain of declarations. Thus, the explicit "look into the translation unit's DeclContext" code is gone, and Sema effectively uses the same IdentifierInfo-based name lookup mechanism whether we are using a PCH file or not. This approach should help PCH scale with the size of the input program rather than the size of the PCH file. The "Hello, World!" application with Carbon.h as a PCH file now loads 20% of the identifiers in the PCH file rather than 85% of the identifiers. 90% of the 20% of identifiers loaded are actually loaded when we deserialize the preprocessor state. The next step is to make the preprocessor load macros lazily, which should drastically reduce the number of types, declarations, and identifiers loaded for "Hello, World". llvm-svn: 69737
* Rework the way we find locally-scoped external declarations when weDouglas Gregor2009-03-021-0/+10
| | | | | | | | | | | need them to evaluate redeclarations or call a function that hasn't already been declared. We now keep a DenseMap of these locally-scoped declarations so that they are not visible but can be quickly found, e.g., when we're looking for previous declarations or before we go ahead and implicitly declare a function that's being called. Fixes PR3672. llvm-svn: 65792
* Now that ObjC decls have DeclContexts too, remove an ugly hack from ↵Argyrios Kyrtzidis2009-02-171-52/+0
| | | | | | IdentifierResolver. llvm-svn: 64802
* Eliminated LookupCriteria, whose creation was causing a bottleneck forDouglas Gregor2009-01-301-20/+16
| | | | | | | | | | | | | | | | | | LookupName et al. Instead, use an enum and a bool to describe its contents. Optimized the C/Objective-C path through LookupName, eliminating any unnecessarily C++isms. Simplify IdentifierResolver::iterator, removing some code and arguments that are no longer used. Eliminated LookupDeclInScope/LookupDeclInContext, moving all callers over to LookupName, LookupQualifiedName, or LookupParsedName, as appropriate. All together, I'm seeing a 0.2% speedup on Cocoa.h with PTH and -disable-free. Plus, we're down to three name-lookup routines. llvm-svn: 63354
* Remove ScopedDecl, collapsing all of its functionality into Decl, soDouglas Gregor2009-01-201-3/+3
| | | | | | | | | | | | | | | | that every declaration lives inside a DeclContext. Moved several things that don't have names but were ScopedDecls (and, therefore, NamedDecls) to inherit from Decl rather than NamedDecl, including ObjCImplementationDecl and LinkageSpecDecl. Now, we don't store empty DeclarationNames for these things, nor do we try to insert them into DeclContext's lookup structure. The serialization tests are temporarily disabled. We'll re-enable them once we've sorted out the remaining ownership/serialiazation issues between DeclContexts and TranslationUnion, DeclGroups, etc. llvm-svn: 62562
* Refactor name lookup.Douglas Gregor2009-01-141-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change refactors and cleans up our handling of name lookup with LookupDecl. There are several aspects to this refactoring: - The criteria for name lookup is now encapsulated into the class LookupCriteria, which replaces the hideous set of boolean values that LookupDecl currently has. - The results of name lookup are returned in a new class LookupResult, which can lazily build OverloadedFunctionDecls for overloaded function sets (and, eventually, eliminate the need to allocate member for OverloadedFunctionDecls) and contains a placeholder for handling ambiguous name lookup (for C++). - The primary entry points for name lookup are now LookupName (for unqualified name lookup) and LookupQualifiedName (for qualified name lookup). There is also a convenience function LookupParsedName that handles qualified/unqualified name lookup when given a scope specifier. Together, these routines are meant to gradually replace the kludgy LookupDecl, but this won't happen until after we have base class lookup (which forces us to cope with ambiguities). - Documented the heck out of name lookup. Experimenting a little with using Doxygen's member groups to make some sense of the Sema class. Feedback welcome! - Fixes some lingering issues with name lookup for nested-name-specifiers, which now goes through LookupName/LookupQualifiedName. llvm-svn: 62245
* Introduce support for "transparent" DeclContexts, which areDouglas Gregor2009-01-051-16/+1
| | | | | | | | | | | | | | | | | | | | | | DeclContexts whose members are visible from enclosing DeclContexts up to (and including) the innermost enclosing non-transparent DeclContexts. Transparent DeclContexts unify the mechanism to be used for various language features, including C enumerations, anonymous unions, C++0x inline namespaces, and C++ linkage specifications. Please refer to the documentation in the Clang internals manual for more information. Only enumerations and linkage specifications currently use transparent DeclContexts. Still to do: use transparent DeclContexts to implement anonymous unions and GCC's anonymous structs extension, and, later, the C++0x features. We also need to tighten up the DeclContext/ScopedDecl link to ensure that every ScopedDecl is in a single DeclContext, which will ensure that we can then enforce ownership and reduce the memory footprint of DeclContext. llvm-svn: 61735
* Don't push OverloadedFunctionDecls onto the chain of declarationsDouglas Gregor2008-12-231-0/+7
| | | | | | | | attached to an identifier. Instead, all overloaded functions will be pushed into scope, and we'll synthesize an OverloadedFunctionDecl on the fly when we need it. llvm-svn: 61386
* Unifies the name-lookup mechanisms used in various parts of the ASTDouglas Gregor2008-12-111-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and separates lexical name lookup from qualified name lookup. In particular: * Make DeclContext the central data structure for storing and looking up declarations within existing declarations, e.g., members of structs/unions/classes, enumerators in C++0x enums, members of C++ namespaces, and (later) members of Objective-C interfaces/implementations. DeclContext uses a lazily-constructed data structure optimized for fast lookup (array for small contexts, hash table for larger contexts). * Implement C++ qualified name lookup in terms of lookup into DeclContext. * Implement C++ unqualified name lookup in terms of qualified+unqualified name lookup (since unqualified lookup is not purely lexical in C++!) * Limit the use of the chains of declarations stored in IdentifierInfo to those names declared lexically. * Eliminate CXXFieldDecl, collapsing its behavior into FieldDecl. (FieldDecl is now a ScopedDecl). * Make RecordDecl into a DeclContext and eliminates its Members/NumMembers fields (since one can just iterate through the DeclContext to get the fields). llvm-svn: 60878
* Rename: FindContext -> FindDeclVisibleInContext.Zhongxing Xu2008-12-051-4/+4
| | | | llvm-svn: 60574
* Updated IdentifierResolver to deal with DeclarationNames. The names ofDouglas Gregor2008-11-171-13/+14
| | | | | | | | | | | | | | | | | | | | | C++ constructors, destructors, and conversion functions now have a FETokenInfo field that IdentifierResolver can access, so that these special names are handled just like ordinary identifiers. A few other Sema routines now use DeclarationNames instead of IdentifierInfo*'s. To validate this design, this code also implements parsing and semantic analysis for id-expressions that name conversion functions, e.g., return operator bool(); The new parser action ActOnConversionFunctionExpr takes the result of parsing "operator type-id" and turning it into an expression, using the IdentifierResolver with the DeclarationName of the conversion function. ActOnDeclarator pushes those conversion function names into scope so that the IdentifierResolver can find them, of course. llvm-svn: 59462
* Implement C++ 'typeid' parsing and sema.Sebastian Redl2008-11-111-3/+3
| | | | llvm-svn: 59042
* Make IdentifierResolver::isDeclInScope regard declarations of a parent ↵Argyrios Kyrtzidis2008-09-091-1/+1
| | | | | | | | | | | | | | | 'control' scope as part of the current scope. The 'control' scope is the 'condition' scope of if/switch/while statements and the scope that contains the for-init-statement and 'condition' of a for statement. e.g: if (int x = 0 /*'control' scope*/) { // x will be regarded as part of this substatement scope. } else { // and as part of this substatement scope too. } llvm-svn: 56020
* Add a LangOptions member to IdentifierResolver.Argyrios Kyrtzidis2008-09-091-1/+3
| | | | | | Make Sema pass the LangOptions to IdentifierResolver's constructor. llvm-svn: 56015
* IdentifierResolver cleanup. Make some methods out-of-line.Argyrios Kyrtzidis2008-09-091-63/+6
| | | | llvm-svn: 56002
* Make the default constructor of IdentifierResolver::iterator public.Argyrios Kyrtzidis2008-08-011-1/+2
| | | | llvm-svn: 54264
* Unify ctx_iterator/ctx_begin()/ctx_end() and iterator/begin()/end() so that ↵Argyrios Kyrtzidis2008-07-171-120/+50
| | | | | | a single iterator type is used for both traversing decls of the same declaration context *and* of the parent declaration contexts, depending on the value of the bool parameter 'LookInParentCtx' that is passed to IdentifierResolver::begin(). llvm-svn: 53724
* 'Educate' IdentifierResolver about the declaration context of CXXFieldDecls.Argyrios Kyrtzidis2008-06-241-0/+4
| | | | llvm-svn: 52698
* Comments fix.Argyrios Kyrtzidis2008-05-151-1/+1
| | | | llvm-svn: 51151
* Change CRLF line endings to LF.Argyrios Kyrtzidis2008-05-141-6/+6
| | | | llvm-svn: 51103
* -Implement proper name lookup for namespaces.Argyrios Kyrtzidis2008-05-091-14/+331
| | | | | | | -identifierResolver exposes an iterator interface to get all decls through the scope chain. -The semantic staff (checking IdentifierNamespace and Doug's checking for shadowed tags were moved out of IdentifierResolver and back into Sema. IdentifierResolver just gives an iterator for all reachable decls of an identifier. llvm-svn: 50923
* Move IdDeclInfoMap class in an anonymous namespace. Suggestion by Chris Lattner.Argyrios Kyrtzidis2008-04-141-2/+3
| | | | llvm-svn: 49628
* Introduce support for finding class and enum names via ordinary name lookup ↵Douglas Gregor2008-04-131-2/+2
| | | | | | in C++ llvm-svn: 49621
* Fixed comments.Argyrios Kyrtzidis2008-04-121-5/+5
| | | | | | | Moved IdDeclInfo class to anonymous namespace. Replaced array with a std::vector. llvm-svn: 49570
* two new files for previous patch, by Argiris KirtzidisChris Lattner2008-04-111-0/+52
llvm-svn: 49521
OpenPOWER on IntegriCloud