summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* C++11 half of r147023: In C++11, additionally eagerly instantiate:Richard Smith2011-12-211-0/+20
| | | | | | | | - constexpr function template instantiations - variables of reference type - constexpr variables llvm-svn: 147031
* Unweaken vtables as per ↵David Blaikie2011-12-201-0/+21
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146959
* constexpr handling improvements. Produce detailed diagnostics when a 'constexpr'Richard Smith2011-12-191-1/+88
| | | | | | | | | | | | | | | | | | | | | variable is initialized by a non-constant expression, and pass in the variable being declared so that earlier-initialized fields' values can be used. Rearrange VarDecl init evaluation to make this possible, and in so doing fix a long-standing issue in our C++ constant expression handling, where we would mishandle cases like: extern const int a; const int n = a; const int a = 5; int arr[n]; Here, n is not initialized by a constant expression, so can't be used in an ICE, even though the initialization expression would be an ICE if it appeared later in the TU. This requires computing whether the initializer is an ICE eagerly, and saving that information in PCH files. llvm-svn: 146856
* Keep track of all of the import declarations that are parsed orDouglas Gregor2011-12-031-2/+4
| | | | | | | implicitly generated in a translation unit. Modules will need this information to identify the actual imports that occurred. llvm-svn: 145734
* When we treat an #include or #import as a module import, create anDouglas Gregor2011-12-021-3/+1
| | | | | | | implicit ImportDecl in the translation unit to record the presence of the import. llvm-svn: 145727
* Introduce a module import declaration, so that we properly represent, e.g.,Douglas Gregor2011-12-021-0/+79
| | | | | | | | __import_module__ std.vector; in the AST. llvm-svn: 145725
* ParmVarDecls have no linkage. Previously we would report that parametersArgyrios Kyrtzidis2011-12-011-0/+2
| | | | | | | | in type signatures have external linkage. Fixes rdar://10058317. llvm-svn: 145551
* Further tweak -Wurneachable-code and templates by allowing the warning to run onTed Kremenek2011-12-011-1/+14
| | | | | | | | | explicit template specializations (which represent actual functions somebody wrote). Along the way, refactor some other code which similarly cares about whether or not they are looking at a template instantiation. llvm-svn: 145547
* Constant expression evaluation: support for evaluation of structs and unions ofRichard Smith2011-11-101-14/+10
| | | | | | | literal types, as well as derived-to-base casts for lvalues and derived-to-virtual-base casts. llvm-svn: 144265
* There's no good reason to track temporaries in ExprWithCleanups,John McCall2011-11-101-15/+0
| | | | | | | but it is sometimes useful to track blocks. Do so. Also optimize the storage of these expressions. llvm-svn: 144263
* From Vassil Vassilev: add checks for removing Decls for more use cases.Axel Naumann2011-11-081-1/+1
| | | | llvm-svn: 144094
* Change operator<< for raw_ostream and NamedDecl to take a reference instead ↵Benjamin Kramer2011-10-141-5/+5
| | | | | | | | of a pointer. Passing a pointer was a bad idea as it collides with the overload for void*. llvm-svn: 141971
* PR11062: Make C99 inlining work properly for names with associated builtin ↵Eli Friedman2011-10-111-1/+6
| | | | | | libcalls. llvm-svn: 141723
* Constant expression evaluation refactoring:Richard Smith2011-10-101-0/+6
| | | | | | | | | | | - Remodel Expr::EvaluateAsInt to behave like the other EvaluateAs* functions, and add Expr::EvaluateKnownConstInt to capture the current fold-or-assert behaviour. - Factor out evaluation of bitfield bit widths. - Fix a few places which would evaluate an expression twice: once to determine whether it is a constant expression, then again to get the value. llvm-svn: 141561
* In DeclContext::LoadLexicalDeclsFromExternalStorage don't clear outArgyrios Kyrtzidis2011-10-071-1/+2
| | | | | | | | | | | | | | | | the fields if they are already loaded, just ignore them when we are building the chain in BuildDeclChain. This fixes an lldb issue where fields were removed and not getting re-added because lldb is based on ASTImporter adding decls to DeclContext and fields were already added before by the ASTImporter. We should really simplify the interaction between DeclContext <-> lldb going forward.. rdar://10246067 llvm-svn: 141418
* Rename TagDecl::isDefinition -> isCompleteDefinitionJohn McCall2011-10-071-6/+6
| | | | | | | for better self-documenting code, since the semantics are subtly different from getDefinition(). llvm-svn: 141355
* Use a sidetable in ASTContext for ParmVarDecls whose index exceeds the 8 ↵Ted Kremenek2011-10-061-0/+9
| | | | | | bits reserved for that value in VarDecl. Fixes PR 10538. llvm-svn: 141273
* Removing a bunch of dead returns/breaks after llvm_unreachables.David Blaikie2011-09-231-1/+0
| | | | llvm-svn: 140407
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-2/+2
| | | | llvm-svn: 140367
* Don't use TemplateArgumentListInfo inside AST nodes because it may leak.Argyrios Kyrtzidis2011-09-221-1/+1
| | | | | | Use ASTTemplateArgumentListInfo instead. llvm-svn: 140331
* ArrayRef-ifying Function/BlockDecl's setParamsDavid Blaikie2011-09-211-13/+12
| | | | llvm-svn: 140268
* Remove redundant break statements, and replace asserts with llvm_unreachablePeter Collingbourne2011-09-201-7/+7
| | | | | | Per John's review comments for r140068. llvm-svn: 140142
* OpenCL: introduce support for function scope __local variablesPeter Collingbourne2011-09-191-6/+7
| | | | llvm-svn: 140068
* Extend the ASTContext constructor to delay the initialization ofDouglas Gregor2011-09-021-1/+1
| | | | | | | | builtin types (When requested). This is another step toward making ASTUnit build the ASTContext as needed when loading an AST file, rather than doing so after the fact. No actual functionality change (yet). llvm-svn: 138985
* Fix else style. No functionality change intended.Chad Rosier2011-08-171-4/+2
| | | | llvm-svn: 137896
* Track in the AST whether a function is constexpr.Richard Smith2011-08-151-2/+4
| | | | llvm-svn: 137653
* Implement function template specialization at class scope extension in ↵Francois Pichet2011-08-141-1/+13
| | | | | | | | | | | | | | | | | Microsoft mode. A new AST node is introduced: ClassScopeFunctionSpecialization. This node holds a FunctionDecl that is not yet specialized; then during the class template instantiation the ClassScopeFunctionSpecialization will spawn the actual function specialization. Example: template <class T> class A { public: template <class U> void f(U p) { } template <> void f(int p) { } // <== class scope specialization }; This extension is necessary to parse MSVC standard C++ headers, MFC and ATL code. BTW, with this feature in, clang can parse (-fsyntax-only) all the MSVC 2010 standard header files without any error. llvm-svn: 137573
* Fixed FieldDecl source range.Abramo Bagnara2011-08-051-2/+2
| | | | llvm-svn: 136963
* Not sure why we bother updating FunctionDecl's EndRangeLoc in ↵Argyrios Kyrtzidis2011-07-301-5/+0
| | | | | | | | FunctionDecl::setParams. EndRangeLoc should always be set to at least the ending paren or brace. llvm-svn: 136573
* [libclang] Annotation of parameters that got default args from a previous ↵Argyrios Kyrtzidis2011-07-301-0/+10
| | | | | | | | | declarations was broken because the end location of the parameter was the end location of the default arg, resulting in a source range that could begin in one file and end in another. llvm-svn: 136572
* 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
* Don't crash when codegen'ing an empty redecl of a function in C99 mode, whenNick Lewycky2011-07-181-3/+4
| | | | | | neither was inline. Fixes bug introduced in r135377. llvm-svn: 135380
* In C99, emit an inline function when encountering an extern redeclaration.Nick Lewycky2011-07-181-0/+26
| | | | | | Fixes PR10233! llvm-svn: 135377
* Augment the interface of ExternalASTSource::FindExternalLexicalDecls()Douglas Gregor2011-07-151-3/+8
| | | | | | | | | | | to allow clients to specify that they've already (correctly) loaded declarations, and that no further action is needed. Also, make sure that we clear the "has external lexical declarations" bit before calling FindExternalLexicalDecls(), to avoid infinite recursion. llvm-svn: 135306
* r134634 causes a failure on MultiSource/Benchmarks/Olden/bh with TEST=nightly,Cameron Zwarich2011-07-071-26/+0
| | | | | | so roll it out. llvm-svn: 134638
* A redeclaration of an inline method in C99 mode should trigger emission of thatNick Lewycky2011-07-071-0/+26
| | | | | | function. Fixes PR10233! llvm-svn: 134634
* Don't factor in visibility for templates and template argumentsJohn McCall2011-06-271-24/+44
| | | | | | for explicit specializations with their own explicit visibility. llvm-svn: 133958
* A few tweaks to MaterializeTemporaryExpr suggested by John.Douglas Gregor2011-06-211-2/+1
| | | | llvm-svn: 133528
* Introduce a new AST node describing reference binding to temporaries.Douglas Gregor2011-06-211-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | MaterializeTemporaryExpr captures a reference binding to a temporary value, making explicit that the temporary value (a prvalue) needs to be materialized into memory so that its address can be used. The intended AST invariant here is that a reference will always bind to a glvalue, and MaterializeTemporaryExpr will be used to convert prvalues into glvalues for that binding to happen. For example, given const int& r = 1.0; The initializer of "r" will be a MaterializeTemporaryExpr whose subexpression is an implicit conversion from the double literal "1.0" to an integer value. IR generation benefits most from this new node, since it was previously guessing (badly) when to materialize temporaries for the purposes of reference binding. There are likely more refactoring and cleanups we could perform there, but the introduction of MaterializeTemporaryExpr fixes PR9565, a case where IR generation would effectively bind a const reference directly to a bitfield in a struct. Addresses <rdar://problem/9552231>. llvm-svn: 133521
* Move computation of __private_extern__ visibilty toFariborz Jahanian2011-06-161-0/+8
| | | | | | getLVForNamespaceScopeDecl(). // rdar://9609649 llvm-svn: 133182
* Introduce a utility routine for checking whether a block's capturesJohn McCall2011-06-151-0/+10
| | | | | | include a specific variable. llvm-svn: 133102
* Implement support for C++11 in-class initialization of non-static data members.Richard Smith2011-06-111-3/+11
| | | | llvm-svn: 132878
* Implement -fgnu89-inline. Fixes PR10041.Rafael Espindola2011-06-021-1/+1
| | | | llvm-svn: 132460
* Implement explicit specialization of explicitly-defaulted constructors.Alexis Hunt2011-05-231-1/+1
| | | | | | | | The general out-of-line case (including explicit instantiation mostly works except that the definition is being lost somewhere between the AST and CodeGen, so the definition is never emitted. llvm-svn: 131933
* main() exists in hosted, not freestanding implementations. Fixes theAlexis Hunt2011-05-151-1/+1
| | | | | | build. llvm-svn: 131390
* Add a method for checking whether a function is one of the reserved globalJohn McCall2011-05-151-4/+28
| | | | | | | | placement allocation or deallocation functions. These functions cannot be replaced by the user and are exempt from the normal requirements on allocation functions (e.g. that they must return unaliased memory). llvm-svn: 131386
* When emitting the destructor for a class with a vtable, if we can determineAnders Carlsson2011-05-141-0/+14
| | | | | | | | | | that the destructor body is trivial and that all member variables also have either trivial destructors or trivial destructor bodies, we don't need to initialize the vtable pointers since no virtual member functions will be called on the destructor. Fixes PR9181. llvm-svn: 131368
* Modify some deleted function methods to better reflect reality:Alexis Hunt2011-05-061-1/+12
| | | | | | | | | | | | | | | | | | | | - New isDefined() function checks for deletedness - isThisDeclarationADefinition checks for deletedness - New doesThisDeclarationHaveABody() does what isThisDeclarationADefinition() used to do - The IsDeleted bit is not propagated across redeclarations - isDeleted() now checks the canoncial declaration - New isDeletedAsWritten() does what it says on the tin. - isUserProvided() now correct (thanks Richard!) This fixes the bug that we weren't catching void foo() = delete; void foo() {} as being a redefinition. llvm-svn: 131013
* Finish off rules for z-length bitfields in ms_structFariborz Jahanian2011-05-031-2/+1
| | | | | | structs. // rdar://8823265 llvm-svn: 130783
* More rule enforcement of zero bitfields for ms_struct.Fariborz Jahanian2011-05-021-1/+2
| | | | llvm-svn: 130696
OpenPOWER on IntegriCloud