summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaLookup.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Be a bit smarter about what nested name qualifiers to allow whenKaelyn Uhrain2014-03-211-7/+11
| | | | | | performing typo correction on very short (1 or 2 char) identifiers. llvm-svn: 204525
* [C++11] Simplify some loops in Sema::CorrectTypo as range-based for loops.Kaelyn Uhrain2014-03-211-24/+14
| | | | llvm-svn: 204524
* [C++11] Replacing DeclContext iterators using_directives_begin() and ↵Aaron Ballman2014-03-171-9/+7
| | | | | | using_directives_end() with iterator_range using_directives(). Updating all of the usages of the iterators with range-based for loops, and removing the no-longer-needed iterator versions. Also used as an opportunity to normalize the name from getUsingDirectives() to using_directives(). llvm-svn: 204061
* [C++11] Replacing Scope iterators using_directives_begin() and ↵Aaron Ballman2014-03-171-4/+2
| | | | | | using_directives_end() with iterator_range using_directives(). Updating all of the usages of the iterators with range-based for loops, and removing the no-longer-needed iterator versions. llvm-svn: 204053
* [C++11] Replacing Scope iterators decl_begin() and decl_end() with ↵Aaron Ballman2014-03-171-3/+2
| | | | | | iterator_range decls(). Updating all of the usages of the iterators with range-based for loops, and removing the no-longer-needed iterator versions. llvm-svn: 204052
* [C++11] Replacing ObjCObjectPointerType iterators qual_begin() and ↵Aaron Ballman2014-03-171-4/+2
| | | | | | qual_end() with iterator_range quals(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 204048
* [C++11] Replacing FunctionProtoType iterators param_type_begin() and ↵Aaron Ballman2014-03-171-5/+2
| | | | | | param_type_end() with iterator_range param_types(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 204045
* Call RequireCompleteType when performing ADL even if the type is alreadyRichard Smith2014-03-141-6/+8
| | | | | | | | complete. We hook into this check from a couple of other places (modules, debug info) so it's not OK to elide the check if the type was already complete. llvm-svn: 203978
* [C++11] Removing the types_begin() and types_end() APIs and replacing with a ↵Aaron Ballman2014-03-141-4/+2
| | | | | | range-only types() API. llvm-svn: 203971
* [C++11] Replacing DeclContext iterators lookups_begin() and lookups_end() ↵Aaron Ballman2014-03-141-7/+3
| | | | | | with iterator_range lookups(). Similar for noload_lookups(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203933
* [C++11] Replacing ObjCCategoryDecl iterators protocol_begin() and ↵Aaron Ballman2014-03-141-3/+2
| | | | | | protocol_end() with iterator_range protocols(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203922
* [C++11] Replacing ObjCProtocolDecl iterators protocol_begin() and ↵Aaron Ballman2014-03-131-3/+2
| | | | | | protocol_end() with iterator_range protocols(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203863
* [C++11] Replacing ObjCInterfaceDecl iterators visible_categories_begin() and ↵Aaron Ballman2014-03-131-5/+2
| | | | | | visible_categories_end() with iterator_range visible_categories(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203851
* [C++11] Replacing ObjCInterfaceDecl iterators ↵Aaron Ballman2014-03-131-4/+2
| | | | | | all_referenced_protocol_begin() and all_referenced_protocol_end() with iterator_range all_referenced_protocols(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203848
* [C++11] Replacing CXXRecordDecl iterators bases_begin() and bases_end() with ↵Aaron Ballman2014-03-131-8/+4
| | | | | | iterator_range bases(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203803
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-121-3/+3
| | | | | | class. llvm-svn: 203640
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-071-1/+1
| | | | | | This compiles cleanly with lldb/lld/clang-tools-extra/llvm. llvm-svn: 203279
* [C++11] Updating getUsingDirectives to use iterator_range instead of a ↵Aaron Ballman2014-03-071-8/+5
| | | | | | std::pair. llvm-svn: 203239
* [C++11] Replacing iterators redecls_begin() and redecls_end() with ↵Aaron Ballman2014-03-061-3/+2
| | | | | | iterator_range redecls(). Updating all of the usages of the iterators with range-based for loops, which allows the begin/end forms to be removed entirely. llvm-svn: 203179
* [C++11] Replace llvm::tie with std::tie.Benjamin Kramer2014-03-021-7/+7
| | | | llvm-svn: 202639
* [C++11] Replace llvm::next and llvm::prior with std::next and std::prev.Benjamin Kramer2014-03-021-1/+1
| | | | llvm-svn: 202635
* Don't suggest non-static methods as corrections when they obviouslyKaelyn Uhrain2014-02-281-5/+27
| | | | | | | won't work (i.e. when not doing a member lookup and not in a method from the same class or a descendant class). llvm-svn: 202520
* PR18685: Ignore class template specializations as potentialKaelyn Uhrain2014-02-091-0/+7
| | | | | | | nested-name-specifiers for typos unless the typo already has a nested-name-specifier that is a template specialization. llvm-svn: 201056
* Don't consider records with a NULL identifier as a name for typo correction.Kaelyn Uhrain2014-02-051-1/+1
| | | | | | | | | Because in C++, "anonymous" doesn't mean "nameless" for records. In other words, RecordDecl::isAnonymousStructOrUnion only returns true if the record lacks a name *and* is not used as the type in an object's declaration. llvm-svn: 200868
* Add implicit declarations of allocation functions when looking them up forRichard Smith2014-02-041-21/+19
| | | | | | | | redeclaration, not just when looking them up for a use -- we need the implicit declaration to appropriately check various properties of them (notably, whether they're deleted). llvm-svn: 200729
* Rename getResultType() on function and method declarations to getReturnType()Alp Toker2014-01-251-1/+1
| | | | | | | | | | | | | | | A return type is the declared or deduced part of the function type specified in the declaration. A result type is the (potentially adjusted) type of the value of an expression that calls the function. Rule of thumb: * Declarations have return types and parameters. * Expressions have result types and arguments. llvm-svn: 200082
* Don't forget about a builtin if we're about to redeclare it and we couldn'tRichard Smith2014-01-221-8/+0
| | | | | | | | | | | | | create an implicit declaration of it (because some type it depends on is unavailable). This had the effect of causing us to not implicitly give it the right attributes. It turns out that glibc's __sigsetjmp is declared before sigjmp_buf is declared, and this resulted in us not implicitly giving it __attribute__((returns_twice)), which in turn resulted in miscompiles in any C code calling glibc's sigsetjmp. (See also the vaguely-related sourceware.org/PR4662.) llvm-svn: 199850
* Introduce and use Decl::getAsFunction() to simplify templated function checksAlp Toker2014-01-221-23/+7
| | | | | | | | | | | | | | Lift the getFunctionDecl() utility out of the parser into a general Decl::getAsFunction() and use it to simplify other parts of the implementation. Reduce isFunctionOrFunctionTemplate() to a simple type check that works the same was as the other is* functions and move unwrapping of shadowed decls to callers so it doesn't get run twice. Shuffle around canSkipFunctionBody() to reduce virtual dispatch on ASTConsumer. There's no need to query when we already know the body can't be skipped. llvm-svn: 199794
* Rename FunctionProtoType accessors from 'arguments' to 'parameters'Alp Toker2014-01-201-8/+9
| | | | | | | | | | | | | | | | | Fix a perennial source of confusion in the clang type system: Declarations and function prototypes have parameters to which arguments are supplied, so calling these 'arguments' was a stretch even in C mode, let alone C++ where default arguments, templates and overloading make the distinction important to get right. Readability win across the board, especially in the casting, ADL and overloading implementations which make a lot more sense at a glance now. Will keep an eye on the builders and update dependent projects shortly. No functional change. llvm-svn: 199686
* Rename language option MicrosoftMode to MSVCCompatAlp Toker2014-01-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | There's been long-standing confusion over the role of these two options. This commit makes the necessary changes to differentiate them clearly, following up from r198936. MicrosoftExt (aka. fms-extensions): Enable largely unobjectionable Microsoft language extensions to ease portability. This mode, also supported by gcc, is used for building software like FreeBSD and Linux kernel extensions that share code with Windows drivers. MSVCCompat (aka. -fms-compatibility, formerly MicrosoftMode): Turn on a special mode supporting 'heinous' extensions for drop-in compatibility with the Microsoft Visual C++ product. Standards-compilant C and C++ code isn't guaranteed to work in this mode. Implies MicrosoftExt. Note that full -fms-compatibility mode is currently enabled by default on the Windows target, which may need tuning to serve as a reasonable default. See cfe-commits for the full discourse, thread 'r198497 - Move MS predefined type_info out of InitializePredefinedMacros' No change in behaviour. llvm-svn: 199209
* Use the appropriate SourceLocation for the template backtrace when doingNick Lewycky2014-01-111-1/+1
| | | | | | template argument deduction. llvm-svn: 198995
* Eliminate the last trivial NDEBUG uses in clang headersAlp Toker2013-12-071-1/+2
| | | | | | assert(sanity()) reads so much better than preprocessor conditional blocks. llvm-svn: 196657
* Sema: Make helper function static.Benjamin Kramer2013-11-011-1/+1
| | | | llvm-svn: 193857
* PR17731: When determining whether a tag and a non-tag were declared in the sameRichard Smith2013-10-301-2/+17
| | | | | | | scope, be careful about function-scope declarations (which are not declared in their semantic context). llvm-svn: 193671
* Allow CorrectTypo to replace CXXScopeSpecifiers that refer to classes.Kaelyn Uhrain2013-10-191-1/+13
| | | | | | | | | | | Now that CorrectTypo knows how to correctly search classes for typo correction candidates, there is no good reason to only replace an existing CXXScopeSpecifier if it refers to a namespace. While the actual enablement was a matter of changing a single comparison, the fallout from enabling the functionality required a lot more code changes (including my two previous commits). llvm-svn: 193020
* Be smarter about deciding to add a leading '::' to aKaelyn Uhrain2013-10-191-22/+49
| | | | | | NestedNameSpecifier that replaces an existing specifier. llvm-svn: 193019
* Merge NamespaceSpecifierSet's AddNamespace and AddRecord as they areKaelyn Uhrain2013-10-191-75/+9
| | | | | | essentially the same. llvm-svn: 193018
* PR17592: Ensure we diagnose shadowing a template parameter with a local externRichard Smith2013-10-161-2/+4
| | | | | | declaration. llvm-svn: 192846
* Fixed code style of my change.Serge Pavlov2013-10-151-1/+1
| | | | llvm-svn: 192708
* Do not use typo correction that is unaccessible.Serge Pavlov2013-10-141-2/+9
| | | | | | | | This patch fixes PR17019. When doing typo correction, Sema::CorrectTypo uses correction already seen for the same typo. This causes problems if that correction is from another scope and cannot be accessed in the current. llvm-svn: 192594
* Convert anachronistic use of 'void *' to 'DeclContext *' in Scope that was a ↵Ted Kremenek2013-10-081-15/+12
| | | | | | holdover from the long-dead Action interface. llvm-svn: 192203
* Add support for WG21 N3599 (literal operator template for strings) as a GNURichard Smith2013-10-071-13/+32
| | | | | | | | | extension. The GCC folks have decided to support this even though the standard committee have not yet approved this feature. Patch by Hristo Venev! llvm-svn: 192128
* Silencing an MSVC warning; SmallSet::count returns a bool instead of a size_t.Aaron Ballman2013-10-051-1/+1
| | | | llvm-svn: 192043
* Speed up CorrectTypo by avoiding lookups on unreasonable candidates.Kaelyn Uhrain2013-10-021-37/+47
| | | | llvm-svn: 191846
* Fix typo correction usage of SemaAccess.cpp.Eli Friedman2013-10-011-1/+1
| | | | | | | | | | When we check access for lookup results, make sure we propagate the result's access to the access control APIs; this can be different from the natural access of the declaration depending on the path used by the lookup. PR17394. llvm-svn: 191726
* Cache the location of failed typo corrections so that typo correctionKaelyn Uhrain2013-09-271-25/+26
| | | | | | isn't repeatedly attempted for the same identifier at the same location. llvm-svn: 191543
* Teach typo correction to look inside of classes like it does namespaces.Kaelyn Uhrain2013-09-261-5/+102
| | | | | | | | | | | | | | | Unlike with namespaces, searching inside of classes requires also checking the access to correction candidates (i.e. don't suggest a correction to a private class member for a correction occurring outside that class and its methods or friends). Included is a small (one line) fix for a bug, that was uncovered while cleaning up the unit tests, where the decls from a TypoCorrection candidate were preserved in new TypoCorrection candidates that are derived (copied) from the old TypoCorrection--notably when creating a new candidate by changing the NestedNameSpecifier associated with the base idenitifer. llvm-svn: 191449
* Switch the semantic DeclContext for a block-scope declaration of a function orRichard Smith2013-09-201-2/+42
| | | | | | | | | | | | | | variable from being the function to being the enclosing namespace scope (in C++) or the TU (in C). This allows us to fix a selection of related issues where we would build incorrect redeclaration chains for such declarations, and fail to notice type mismatches. Such declarations are put into a new IdentifierNamespace, IDNS_LocalExtern, which is only found when searching scopes, and not found when searching DeclContexts. Such a declaration is only made visible in its DeclContext if there are no non-LocalExtern declarations. llvm-svn: 191064
* PR13657 (and duplicates):Richard Smith2013-09-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a comma occurs in a default argument or default initializer within a class, disambiguate whether it is part of the initializer or whether it ends the initializer. The way this works (which I will be proposing for standardization) is to treat the comma as ending the default argument or default initializer if the following token sequence matches the syntactic constraints of a parameter-declaration-clause or init-declarator-list (respectively). This is both consistent with the disambiguation rules elsewhere (where entities are treated as declarations if they can be), and should have no regressions over our old behavior. I think it might also disambiguate all cases correctly, but I don't have a proof of that. There is an annoyance here: because we're performing a tentative parse in a situation where we may not have seen declarations of all relevant entities (if the comma is part of the initializer, lookup may find entites declared later in the class), we need to turn off typo-correction and diagnostics during the tentative parse, and in the rare case that we decide the comma is part of the initializer, we need to revert all token annotations we performed while disambiguating. Any diagnostics that occur outside of the immediate context of the tentative parse (for instance, if we trigger the implicit instantiation of a class template) are *not* suppressed, mirroring the usual rules for a SFINAE context. llvm-svn: 190639
* C++ modules: if a class is defined in multiple modules (for instance, becauseRichard Smith2013-09-091-1/+1
| | | | | | | | | | | | it is an implicit instantiation of a class template specialization), pick the first-loaded definition to be the canonical definition, and merge all other definitions into it. This is still rather incomplete -- we need to extend every form of declaration that can appear within a CXXRecordDecl to be redeclarable if it came from an AST file (this includes fields, enumerators, ...). llvm-svn: 190315
OpenPOWER on IntegriCloud