summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/NestedNameSpecifier.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove trailing spaceFangrui Song2018-07-301-52/+52
| | | | | | sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} llvm-svn: 338291
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-091-10/+10
| | | | | | | | | | | | | | | | | | | This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 llvm-svn: 331834
* Clean up use of C allocation functionsSerge Pavlov2018-02-211-1/+1
| | | | | | | | | | | | | | | | If the value returned by `malloc`, `calloc` or `realloc` is not checked for null pointer, this change replaces them for `safe_malloc`, `safe_calloc` or `safe_realloc`, which are defined in the namespace `llvm`. These function report fatal error on out of memory. In the plain C files, assertion statements are added to ensure that memory is successfully allocated. The aim of this change is to get better diagnostics of OOM on Windows. Differential Revision: https://reviews.llvm.org/D43017 llvm-svn: 325661
* Refactor functions PrintTemplateArgumentListSerge Pavlov2017-11-281-2/+2
| | | | | | | | | | | These functions were defined as static members of TemplateSpecializationType. Now they are moved to namespace level. Previously there were different implementations for lists containing TemplateArgument and TemplateArgumentLoc, now these implementations share the same code. This change is a result of refactoring patch D40508. NFC. llvm-svn: 319178
* [AST] Fix some Clang-tidy modernize and Include What You Use warnings; other ↵Eugene Zelenko2017-11-211-54/+60
| | | | | | minor fixes (NFC). llvm-svn: 318813
* Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.Galina Kistanova2017-06-031-0/+1
| | | | llvm-svn: 304650
* Retire llvm::alignOf in favor of C++11 alignof.Benjamin Kramer2016-10-201-5/+4
| | | | | | No functionality change intended. llvm-svn: 284730
* Un-tabify source files, NFC.Yaron Keren2016-10-081-2/+2
| | | | llvm-svn: 283657
* [AST] Use ArrayRef in more interfacesDavid Majnemer2016-07-071-1/+1
| | | | | | | | | ArrayRef is a little better than passing around a pointer/length pair. No functional change is intended. llvm-svn: 274732
* P0136R1, DR1573, DR1645, DR1715, DR1736, DR1903, DR1941, DR1959, DR1991:Richard Smith2016-06-281-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace inheriting constructors implementation with new approach, voted into C++ last year as a DR against C++11. Instead of synthesizing a set of derived class constructors for each inherited base class constructor, we make the constructors of the base class visible to constructor lookup in the derived class, using the normal rules for using-declarations. For constructors, UsingShadowDecl now has a ConstructorUsingShadowDecl derived class that tracks the requisite additional information. We create shadow constructors (not found by name lookup) in the derived class to model the actual initialization, and have a new expression node, CXXInheritedCtorInitExpr, to model the initialization of a base class from such a constructor. (This initialization is special because it performs real perfect forwarding of arguments.) In cases where argument forwarding is not possible (for inalloca calls, variadic calls, and calls with callee parameter cleanup), the shadow inheriting constructor is not emitted and instead we directly emit the initialization code into the caller of the inherited constructor. Note that this new model is not perfectly compatible with the old model in some corner cases. In particular: * if B inherits a private constructor from A, and C uses that constructor to construct a B, then we previously required that A befriends B and B befriends C, but the new rules require A to befriend C directly, and * if a derived class has its own constructors (and so its implicit default constructor is suppressed), it may still inherit a default constructor from a base class llvm-svn: 274049
* Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith ↵Yaron Keren2016-01-291-1/+1
| | | | | | r259192 post commit comment. llvm-svn: 259232
* Constify NestedNameSpecifier::dump and add a no-argument dump function ↵Yaron Keren2015-12-271-1/+6
| | | | | | suitable for calling from a debugger. llvm-svn: 256472
* [UB] Fix the two ways that we would try to memcpy from a null buffer inChandler Carruth2015-08-041-7/+9
| | | | | | | | | | | | | the nested name specifier code. First, skip the entire thing when the input is empty. Next, handle the case where we started off with a null buffer and a zero capacity to skip copying and freeing. This was found with UBSan. llvm-svn: 243946
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-2/+2
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-2/+2
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* -ms-extensions: Implement __super scope specifier (PR13236).Nikola Smiljanic2014-09-261-12/+59
| | | | | | | | | We build a NestedNameSpecifier that records the CXXRecordDecl in which __super appeared. Name lookup is performed in all base classes of the recorded CXXRecordDecl. Use of __super is allowed only inside class and member function scope. llvm-svn: 218484
* Simplify memory management in NestedNameSpecifierLocBuilder.Serge Pavlov2014-07-161-8/+4
| | | | | | | With this change the memory of buffer in NestedNameSpecifierLocBuilder is allocated in one place. It also prevents from allocation of tiny blocks. llvm-svn: 213178
* [C++11] Use 'nullptr'. AST edition.Craig Topper2014-05-121-10/+12
| | | | llvm-svn: 208517
* Use pop_back_val() instead of both back() and pop_back().Robert Wilhelm2013-08-231-2/+1
| | | | | | No functionality change intended. llvm-svn: 189112
* Streamify getNameForDiagnostic and remove the string versions of ↵Benjamin Kramer2013-02-221-7/+3
| | | | | | PrintTemplateArgumentList. llvm-svn: 175894
* Add constness for NestedNameSpecifier::Create parameterDmitri Gribenko2013-01-231-2/+3
| | | | llvm-svn: 173274
* Use the right alignment when allocating NestedNameSpecifier objects.Richard Smith2012-08-151-3/+6
| | | | llvm-svn: 161920
* [AST] NestedNameSpecifier's ctor/dtor are trivial and should be inlined.Daniel Dunbar2012-03-091-8/+0
| | | | llvm-svn: 152365
* Revert my patches which removed Diagnostic.h includes by moving some ↵Benjamin Kramer2012-02-071-7/+0
| | | | | | | | | | | | | | | | | | operator overloads out of line. This seems to negatively affect compile time onsome ObjC tests (which use a lot of partial diagnostics I assume). I have to come up with a way to keep them inline without including Diagnostic.h everywhere. Now adding a new diagnostic requires a full rebuild of e.g. the static analyzer which doesn't even use those diagnostics. This reverts commit 6496bd10dc3a6d5e3266348f08b6e35f8184bc99. This reverts commit 7af19b817ba964ac560b50c1ed6183235f699789. This reverts commit fdd15602a42bbe26185978ef1e17019f6d969aa7. This reverts commit 00bd44d5677783527d7517c1ffe45e4d75a0f56f. This reverts commit ef9b60ffed980864a8db26ad30344be429e58ff5. llvm-svn: 150006
* Move various diagnostic operator<< overloads out of line and remove includes ↵Benjamin Kramer2012-02-041-0/+7
| | | | | | | | | of Diagnostic.h. Fix all the files that depended on transitive includes of Diagnostic.h. With this patch in place changing a diagnostic no longer requires a full rebuild of the StaticAnalyzer. llvm-svn: 149781
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-201-10/+7
| | | | llvm-svn: 148577
* Add a printing policy flag to suppress printing "<anonymous>::" priorDouglas Gregor2011-11-031-0/+3
| | | | | | | | | to types. Enable this flag for code completion, where knowing whether something is in an anonymous or inline namespace is actually not useful, since you don't have to type it anyway. Fixes <rdar://problem/10208818>. llvm-svn: 143599
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-2/+2
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Introduce the notion of instantiation dependence into Clang's AST. ADouglas Gregor2011-07-011-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | type/expression/template argument/etc. is instantiation-dependent if it somehow involves a template parameter, even if it doesn't meet the requirements for the more common kinds of dependence (dependent type, type-dependent expression, value-dependent expression). When we see an instantiation-dependent type, we know we always need to perform substitution into that instantiation-dependent type. This keeps us from short-circuiting evaluation in places where we shouldn't, and lets us properly implement C++0x [temp.type]p2. In theory, this would also allow us to properly mangle instantiation-dependent-but-not-dependent decltype types per the Itanium C++ ABI, but we aren't quite there because we still mangle based on the canonical type in cases like, e.g., template<unsigned> struct A { }; template<typename T> void f(A<sizeof(sizeof(decltype(T() + T())))>) { } template void f<int>(A<sizeof(sizeof(int))>); and therefore get the wrong answer. llvm-svn: 134225
* Refactor the construction of nested-name-specifiers withDouglas Gregor2011-02-281-0/+246
| | | | | | | | | | source-location information into a NestedNameSpecifierLocBuilder class, which lives within the AST library and centralize all knowledge of the format of nested-name-specifier location information here. No functionality change. llvm-svn: 126716
* Push nested-name-specifier source location information into using directives.Douglas Gregor2011-02-251-1/+7
| | | | llvm-svn: 126489
* Update UsingDecl, UnresolvedUsingTypenameDecl, andDouglas Gregor2011-02-251-2/+13
| | | | | | | | | | | | | | UnresolvedUsingValueDecl to use NestedNameSpecifierLoc rather than the extremely-lossy NestedNameSpecifier/SourceRange pair it used to use, improving source-location information. Various infrastructure updates to support NestedNameSpecifierLoc: - AST/PCH (de-)serialization - Recursive AST visitor - libclang traversal (including the first tests of this functionality) llvm-svn: 126459
* Retain complete source-location information for C++Douglas Gregor2011-02-241-0/+92
| | | | | | | | | | | | nested-name-specifiers throughout the parser, and provide a new class (NestedNameSpecifierLoc) that contains a nested-name-specifier along with its type-source information. Right now, this information is completely useless, because we don't actually store the source-location information anywhere in the AST. Call this Step 1/N. llvm-svn: 126391
* Teach NestedNameSpecifier to keep track of namespace aliases the sameDouglas Gregor2011-02-241-5/+68
| | | | | | | | way it keeps track of namespaces. Previously, we would map from the namespace alias to its underlying namespace when building a nested-name-specifier, losing source information in the process. llvm-svn: 126358
* Change QualType::getTypePtr() to return a const pointer, then change aJohn McCall2011-01-191-3/+3
| | | | | | thousand other things which were (generally inadvertantly) relying on that. llvm-svn: 123814
* PR3558: mark "logically const" accessor methods in ASTContext as const,Jay Foad2011-01-121-8/+10
| | | | | | | and mark the fields they use as mutable. This allows us to remove a few const_casts. llvm-svn: 123314
* Variadic templates: extend Type, NestedNameSpecifier, TemplateName,Douglas Gregor2010-12-131-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | and TemplateArgument with an operation that determines whether there are any unexpanded parameter packs within that construct. Use this information to diagnose the appearance of the names of parameter packs that have not been expanded (C++ [temp.variadic]p5). Since this property is checked often (every declaration, ever expression statement, etc.), we extend Type and Expr with a bit storing the result of this computation, rather than walking the AST each time to determine whether any unexpanded parameter packs occur. This commit is deficient in several ways, which will be remedied with future commits: - Expr has a bit to store the presence of an unexpanded parameter pack, but it is never set. - The error messages don't point out where the unexpanded parameter packs were named in the type/expression, but they should. - We don't check for unexpanded parameter packs in all of the places where we should. - Testing is sparse, pending the resolution of the above three issues. llvm-svn: 121724
* Kill off the last Destroy method in the AST libraryDouglas Gregor2010-07-251-5/+0
| | | | llvm-svn: 109378
* Merged Elaborated and QualifiedName types.Abramo Bagnara2010-05-111-3/+3
| | | | llvm-svn: 103517
* When pretty-printing tag types, only print the tag if we're in C (andJohn McCall2010-03-101-1/+0
| | | | | | | | | | therefore not creating ElaboratedTypes, which are still pretty-printed with the written tag). Most of these testcase changes were done by script, so don't feel too sorry for my fingers. llvm-svn: 98149
* Move all of the type-printing logic to its own C++ source fileDouglas Gregor2009-11-101-1/+1
| | | | llvm-svn: 86629
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-14/+14
| | | | llvm-svn: 81346
* Initial stab at implement dependent member references to memberDouglas Gregor2009-09-091-1/+1
| | | | | | | | | | | | | templates, e.g., x.template get<T> We can now parse these, represent them within an UnresolvedMemberExpr expression, then instantiate that expression node in simple cases. This allows us to stumble through parsing LLVM's Casting.h. llvm-svn: 81300
* Start emitting ElaboratedTypes in C++ mode. Support the effort in variousJohn McCall2009-09-051-0/+1
| | | | | | | | ways: remove elab types during desugaring, enhance pretty-printing to allow tags to be suppressed without suppressing scopes, look through elab types when associating a typedef name with an anonymous record type. llvm-svn: 81065
* Add a wicked little test-case that illustrates what we have to dealDouglas Gregor2009-09-021-1/+11
| | | | | | | | with to properly support member access expressions in templates. This test is XFAIL'd, because we get it completely wrong, but I've made the minimal changes to the representation to at least avoid a crash. llvm-svn: 80856
* Improve diagnostics and recovery when the nested-name-specifier of aDouglas Gregor2009-08-261-7/+25
| | | | | | | | | | | | qualified name does not actually refer into a class/class template/class template partial specialization. Improve printing of nested-name-specifiers to eliminate redudant qualifiers. Also, make it possible to output a nested-name-specifier through a DiagnosticBuilder, although there are relatively few places that will use this leeway. llvm-svn: 80056
* Key decisions about 'bool' vs '_Bool' to be based on a new flag in langoptions.Chris Lattner2009-06-301-4/+2
| | | | | | | | | | | | This is simple enough, but then I thought it would be nice to make PrintingPolicy get a LangOptions so that various things can key off "bool" and "C++" independently. This spiraled out of control. There are many fixme's, but I think things are slightly better than they were before. One thing that can be improved: CFG should probably have an ASTContext pointer in it, which would simplify its clients. llvm-svn: 74493
* Create a new PrintingPolicy class, which we pass down through the ASTDouglas Gregor2009-05-291-7/+11
| | | | | | | | | printing logic to help customize the output. For now, we use this rather than a special flag to suppress the "struct" when printing "struct X" and to print the Boolean type as "bool" in C++ but "_Bool" in C. llvm-svn: 72590
* Parsing, semantic analysis, and template instantiation for typenameDouglas Gregor2009-04-011-13/+13
| | | | | | | | | | | | | specifiers that terminate in a simple-template-id, e.g., typename MetaFun::template apply<T1, T2> Also, implement template instantiation for dependent nested-name-specifiers that involve unresolved identifiers, e.g., typename T::type::type llvm-svn: 68166
* Some cleanup and renaming. No functionality changeDouglas Gregor2009-03-311-10/+4
| | | | llvm-svn: 68140
OpenPOWER on IntegriCloud