summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Compress some bits. Only matters for MSVC, or if we everJohn McCall2011-05-011-1/+1
| | | | | | | devirtualize Decl (because bits can't get laid out in base classes if the base is POD). llvm-svn: 130632
* ms_struct patch for initialization and field access irgen.Fariborz Jahanian2011-04-281-2/+13
| | | | | | // rdar://8823265 - wip. llvm-svn: 130451
* Add -fdelayed-template-parsing option. Using this option all templated ↵Francois Pichet2011-04-221-1/+4
| | | | | | | | | function definitions are parsed at the end of the translation unit only if it is required by an actual instantiation. As such all the symbols of the TU are available during name lookup. Using this flag is necessary for compatibility with Microsoft template code. This also provides some parsing speed improvement. llvm-svn: 130022
* ADT/Triple: Switch to using .isOSDarwin() predicate.Daniel Dunbar2011-04-191-1/+1
| | | | llvm-svn: 129823
* Support for C++11 (non-template) alias declarations.Richard Smith2011-04-151-7/+21
| | | | llvm-svn: 129567
* Chained PCH: Remember when additional specializations are added to a ↵Sebastian Redl2011-04-141-1/+1
| | | | | | function template from a previous PCH. Fixes the only crasher when using massive chains on Clang's Sema component. We still have some incomplete codegen there. llvm-svn: 129516
* On Mac OS X, the presence of an 'availability' attribute for thatDouglas Gregor2011-03-261-54/+70
| | | | | | | | | platform implies default visibility. To achieve these, refactor our lookup of explicit visibility so that we search for both an explicit VisibilityAttr and an appropriate AvailabilityAttr, favoring the VisibilityAttr if it is present. llvm-svn: 128336
* Fix a test case and teach ClearLinkageCache() to clear the linkage ofJohn McCall2011-03-221-1/+3
| | | | | | | a function template decl's pattern, which was suddenly exposed by my last patch. llvm-svn: 128073
* Fixed inconsistency when adding TemplateParameterListsInfo.Abramo Bagnara2011-03-181-10/+46
| | | | llvm-svn: 127876
* Fixed InnerLocStart.Abramo Bagnara2011-03-091-14/+15
| | | | llvm-svn: 127330
* Fixed source range for StaticAssertDecl and LinkageSpecDecl. Fixed source ↵Abramo Bagnara2011-03-081-3/+66
| | | | | | range for declarations using postfix types. llvm-svn: 127251
* Fixed NamespaceDecl source range.Abramo Bagnara2011-03-081-2/+3
| | | | llvm-svn: 127242
* Fixed bitfields source range.Abramo Bagnara2011-03-081-0/+5
| | | | llvm-svn: 127237
* Fixed source range for all DeclaratorDecl's.Abramo Bagnara2011-03-081-20/+19
| | | | llvm-svn: 127225
* Fixed TypedefDecl and TemplateTypeParameter source range.Abramo Bagnara2011-03-061-3/+3
| | | | llvm-svn: 127119
* Fixed LabelDecl source range and cleaned creation code.Abramo Bagnara2011-03-051-3/+9
| | | | llvm-svn: 127094
* Don't consider visibility from template parameter lists if we'reJohn McCall2011-03-041-5/+12
| | | | | | | | | computing for a nested decl with explicit visibility. This is all part of the general philosophy of explicit visibility attributes, where any information that was obviously available at the attribute site should probably be ignored. Fixes PR9371. llvm-svn: 126992
* Fixed source range for LabelDecl.Abramo Bagnara2011-03-031-2/+3
| | | | llvm-svn: 126952
* Fixed source range for FileScopeAsmDecl. Others source range fixes will follow.Abramo Bagnara2011-03-031-3/+4
| | | | llvm-svn: 126939
* Push nested-name-specifier source location information into using directives.Douglas Gregor2011-02-251-2/+4
| | | | llvm-svn: 126489
* Use NestedNameSpecifierLoc within out-of-line variables, function, andDouglas Gregor2011-02-251-13/+7
| | | | | | | tag definitions. Also, add support for template instantiation of NestedNameSpecifierLocs. llvm-svn: 126470
* Update UsingDecl, UnresolvedUsingTypenameDecl, andDouglas Gregor2011-02-251-3/+7
| | | | | | | | | | | | | | 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
* Fix the rest of PR9316 along with some other bugs spotted by inspection.Chandler Carruth2011-02-251-11/+12
| | | | | | | | | | | I tried to add test cases for these, but I can't because variables aren't warned on the way functions are and the codegen layer appears to use different logic for determining that 'a' and 'g' in the test case should receive C mangling. I've included the test so that if we ever switch the codegen layer to use these functions, we won't regress due to latent bugs. llvm-svn: 126453
* Likely fix for PR9316 and other unknown bugs: don't use the anonynmousChandler Carruth2011-02-241-2/+6
| | | | | | | namespace blanket rule for variables and functions declared 'extern "C"'. llvm-svn: 126400
* Give ImplicitParamDecl a public constructor so that it can be allocated onJohn McCall2011-02-221-2/+4
| | | | | | the stack. llvm-svn: 126254
* Revert all of my commits that devirtualized the Decl hierarchy, whichDouglas Gregor2011-02-191-58/+29
| | | | | | | | lead to a serious slowdown (4%) on parsing of Cocoa.h. This memory optimization should be revisited later, when we have time to look at the generated code. llvm-svn: 126033
* Warn about code that uses variables and functions with internal linkageJohn McCall2011-02-191-2/+14
| | | | | | | | | | | | | | without defining them. This should be an error, but I'm paranoid about "uses" that end up not actually requiring a definition. I'll revisit later. Also, teach IR generation to not set internal linkage on variable declarations, just for safety's sake. Doing so produces an invalid module if the variable is not ultimately defined. Also, fix several places in the test suite where we were using internal functions without definitions. llvm-svn: 126016
* Devirtualize TagDecl::completeDefinition().Douglas Gregor2011-02-171-7/+7
| | | | llvm-svn: 125755
* Devirtualize DeclaratorDecl::getInnerLocStart() and TagDecl::getInnerLocStart().Douglas Gregor2011-02-171-7/+25
| | | | llvm-svn: 125754
* Devirtualize NamedDecl::getNameForDiagnostic().Douglas Gregor2011-02-171-13/+24
| | | | llvm-svn: 125751
* Step #1/N of implementing support for __label__: split labels intoChris Lattner2011-02-171-0/+6
| | | | | | | | | | | | | | | | | | | LabelDecl and LabelStmt. There is a 1-1 correspondence between the two, but this simplifies a bunch of code by itself. This is because labels are the only place where we previously had references to random other statements, causing grief for AST serialization and other stuff. This does cause one regression (attr(unused) doesn't silence unused label warnings) which I'll address next. This does fix some minor bugs: 1. "The only valid attribute " diagnostic was capitalized. 2. Various diagnostics printed as ''labelname'' instead of 'labelname' 3. This reduces duplication of label checking between functions and blocks. Review appreciated, particularly for the cindex and template bits. llvm-svn: 125733
* De-virtualize Decl::isOutOfLine().Douglas Gregor2011-02-171-2/+2
| | | | llvm-svn: 125730
* Move the check that gives functions with unique-external types unique-externalJohn McCall2011-02-101-0/+13
| | | | | | | linkage into Decl.cpp. Disable this logic for extern "C" functions, because the operative rule there is weaker. Fixes rdar://problem/8898466 llvm-svn: 125268
* Clear the linkage cache recursively. Fixes PR8926.John McCall2011-02-081-0/+31
| | | | llvm-svn: 125104
* A few more tweaks to the blocks AST representation: John McCall2011-02-071-9/+14
| | | | | | | | | | | | | | | | | - BlockDeclRefExprs always store VarDecls - BDREs no longer store copy expressions - BlockDecls now store a list of captured variables, information about how they're captured, and a copy expression if necessary With that in hand, change IR generation to use the captures data in blocks instead of walking the block independently. Additionally, optimize block layout by emitting fields in descending alignment order, with a heuristic for filling in words when alignment of the end of the block header is insufficient for the most aligned field. llvm-svn: 125005
* An insomniac stab at making block declarations list the variables they closeJohn McCall2011-02-021-2/+15
| | | | | | | on, as well as more reliably limiting invalid references to locals from nested scopes. llvm-svn: 124721
* Fix the computation of alignment for fields of packed+aligned structs.John McCall2011-01-201-0/+19
| | | | | | Part of the fix for PR8413. llvm-svn: 123904
OpenPOWER on IntegriCloud