summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Don't crash with -Wlarge-by-value-copy and a dependent type. PR11726.Eli Friedman2012-01-091-2/+2
| | | | llvm-svn: 147812
* Always allow redefinition of typedefs when modules are enabled. ThisDouglas Gregor2012-01-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | is important because it's fairly common for headers (especially system headers) to want to provide only those typedefs needed for that particular header, based on some guard macro, e.g., #ifndef _SIZE_T #define _SIZE_T typedef long size_t; #endif which is repeated in a number of headers. The guard macro protects against duplicate definitions. However, this means that only the first occurrence of this pattern actually defines size_t, so the submodule corresponding to this header has the only visible definition. If a user then imports a different submodule from the same module, size_t will be known but not visible, and therefore cannot be used. By allowing redefinition of typedefs, each header that wants to define size_t can do so independently, so it will be available in the corresponding submodules. llvm-svn: 147775
* Made unknown builtin diagnostic remappable.Abramo Bagnara2012-01-091-1/+1
| | | | llvm-svn: 147774
* Fixed TypeofExpr AST and code generation.Abramo Bagnara2012-01-071-19/+0
| | | | llvm-svn: 147730
* Improvements to the uninitialized variable warning: Check if the constructorRafael Espindola2012-01-061-5/+12
| | | | | | | call is elidable or if the constructor is trivial instead of checking if it is user declared. llvm-svn: 147652
* David Blaikie and Chandler would like us to diagnoseRichard Smith2012-01-061-2/+1
| | | | | | | | int f(); in function scopes under -Wvexing-parse, so now we do. llvm-svn: 147649
* Tweak to r147599 for PR10828: Move the check from the parser into sema, and useRichard Smith2012-01-061-0/+19
| | | | | | | the Semantic Powers to only warn on class types (or dependent types), where the constructor or destructor could do something interesting. llvm-svn: 147642
* More lambda work. Tweak the Sema interface slightly. Start adding the ↵Eli Friedman2012-01-051-1/+1
| | | | | | pieces to build the lambda class and its call operator. Create an actual scope for the lambda body. llvm-svn: 147595
* The value of a const weak variable is not an integer constant.John McCall2012-01-051-1/+1
| | | | llvm-svn: 147575
* Test "merging" of typedef types across distinct modules. At present,Douglas Gregor2012-01-031-2/+0
| | | | | | | | | | | | the AST reader doesn't actually perform a merge, because name lookup knows how to merge identical typedefs together. As part of this, teach C/Objective-C name lookup to return multiple results in all cases, rather than first digging through the attributes to see if the value is overloadable. This way, we'll catch ambiguous lookups in C/Objective-C. llvm-svn: 147498
* Introduce a non-uglified syntax for module imports in Objective-C:Douglas Gregor2012-01-031-3/+5
| | | | | | @import identifier [. identifier]* ; llvm-svn: 147452
* Wire up redeclaration chains for Objective-C protocols, so that bothDouglas Gregor2012-01-011-16/+17
| | | | | | | forward declarations and definitions of an Objective-C protocol are represented within a single chain of ObjCProtocolDecls. llvm-svn: 147412
* Use hasSameType.Rafael Espindola2012-01-011-2/+1
| | | | llvm-svn: 147407
* Delay checking of typedefs of dependent types. Fixes PR11630.Rafael Espindola2011-12-261-20/+26
| | | | llvm-svn: 147281
* Fix constexpr handling to allow 'extern constexpr' variable declarations. We noRichard Smith2011-12-251-38/+14
| | | | | | | longer have access to the source locations we need to produce the 'replace constexpr with const' fixits, so they're gone for now. llvm-svn: 147273
* Remove unused variables.Rafael Espindola2011-12-251-1/+0
| | | | llvm-svn: 147260
* C++11 half of r147023: In C++11, additionally eagerly instantiate:Richard Smith2011-12-211-2/+1
| | | | | | | | - constexpr function template instantiations - variables of reference type - constexpr variables llvm-svn: 147031
* When performing name lookup for a redeclaration, ignore moduleDouglas Gregor2011-12-201-41/+1
| | | | | | | | | | | | | | | | | | | | | visibility restrictions. This ensures that all declarations of the same entity end up in the same redeclaration chain, even if some of those declarations aren't visible. While this may seem unfortunate to some---why can't two C modules have different functions named 'f'?---it's an acknowedgment that a module does not introduce a new "namespace" of names. As part of this, stop merging the 'module-private' bit from previous declarations to later declarations, because we want each declaration in a module to stand on its own because this can effect, for example, submodule visibility. Note that this notion of names that are invisible to normal name lookup but are available for redeclaration lookups is how we should implement friend declarations and extern declarations within local function scopes. I'm not tackling that problem now. llvm-svn: 146980
* constexpr handling improvements. Produce detailed diagnostics when a 'constexpr'Richard Smith2011-12-191-9/+31
| | | | | | | | | | | | | | | | | | | | | 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
* Remove a non-gcc-compatible extension that would apply attributes on ↵Eli Friedman2011-12-171-3/+21
| | | | | | declarations without a declarator to structs. Add a warning for ignored attributes. Patch by Michael Han. llvm-svn: 146796
* Move ObjCInterfaceDecl's "EndLoc" into DefinitionData, since it onlyDouglas Gregor2011-12-151-1/+1
| | | | | | | | applies to an actual definition. Plus, clarify the purpose of this field and give the accessor a different name, since getLocEnd() is supposed to be the same as getSourceRange().getEnd(). llvm-svn: 146694
* Refactor and simplify AddInitializerToDecl.Richard Smith2011-12-151-101/+73
| | | | llvm-svn: 146673
* Move & comment the 'decltype in declarator-id' as suggested by Doug Gregor.David Blaikie2011-12-141-10/+14
| | | | llvm-svn: 146576
* Disallow decltype in qualified declarator-ids.David Blaikie2011-12-131-0/+10
| | | | llvm-svn: 146480
* objc-arc: better diagnostic when block is declaredFariborz Jahanian2011-12-121-1/+2
| | | | | | inside a struct/union. llvm-svn: 146444
* Only do typo correction for implicit function decls whenHans Wennborg2011-12-081-26/+26
| | | | | | | | | | they are treated as errors. Doing typo correction when these are just warnings slows down the compilation of source which deliberately uses implicit function declarations. llvm-svn: 146153
* When folding the size of a global scope VLA to a constant, require the arrayRichard Smith2011-12-071-5/+2
| | | | | | | bound to not have side effects(!). Add constant-folding support for expressions of void type, to ensure that we can still fold ((void)0, 1) as an array bound. llvm-svn: 146000
* Suggest typo corrections for implicit function declarations.Hans Wennborg2011-12-061-1/+25
| | | | | | | A mistyped function call becomes an inmplicit function declaration in C. Suggest typo correction when one can be found. llvm-svn: 145930
* Make sure we perform lvalue-to-rvalue conversions for enum initializers. ↵Eli Friedman2011-12-061-0/+3
| | | | | | PR11484. llvm-svn: 145874
* When we treat an #include or #import as a module import, create anDouglas Gregor2011-12-021-1/+2
| | | | | | | 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-3/+18
| | | | | | | | __import_module__ std.vector; in the AST. llvm-svn: 145725
* Introduce the notion of name visibility into modules. For a givenDouglas Gregor2011-12-011-1/+2
| | | | | | | | | | | | | | (sub)module, all of the names may be hidden, just the macro names may be exposed (for example, after the preprocessor has seen the import of the module but the parser has not), or all of the names may be exposed. Importing a module makes its names, and the names in any of its non-explicit submodules, visible to name lookup (transitively). This commit only introduces the notion of name visible and marks modules and submodules as visible when they are imported. The actual name-hiding logic in the AST reader will follow (along with test cases). llvm-svn: 145586
* Promote ModuleMap::Module to a namespace-scope class in the BasicDouglas Gregor2011-11-301-3/+3
| | | | | | | | | library, since modules cut across all of the libraries. Rename serialization::Module to serialization::ModuleFile to side-step the annoying naming conflict. Prune a bunch of ModuleMap.h includes that are no longer needed (most files only needed the Module type). llvm-svn: 145538
* Switch the module-loading interfaces and parser from a simpleDouglas Gregor2011-11-301-5/+2
| | | | | | | top-level module name to a module path (e.g., std.vector). We're still missing a number of pieces for this actually to do something. llvm-svn: 145462
* Reference initialization with initializer lists.Sebastian Redl2011-11-271-1/+1
| | | | | | This supports single-element initializer lists for references according to DR1288, as well as creating temporaries and binding to them for other initializer lists. llvm-svn: 145186
* [libclang] Fix operations (token annotation, getting cursor, etc.) with a ↵Argyrios Kyrtzidis2011-11-231-1/+10
| | | | | | | | | | | | | | | file region inside an objc container that "contains" other file-level declarations. When getting the array of file-level declarations that overlap with a file region, we failed to report that the region overlaps with an objc container, if the container had other file-level declarations declared lexically inside it. Fix this by marking such declarations as "isTopLevelDeclInObjCContainer" in the AST and handling them appropriately. llvm-svn: 145109
* Fix the signature of the getcontext builtin. Patch by Dimitry Andric.Rafael Espindola2011-11-131-0/+8
| | | | llvm-svn: 144505
* There's no good reason to track temporaries in ExprWithCleanups,John McCall2011-11-101-5/+3
| | | | | | | but it is sometimes useful to track blocks. Do so. Also optimize the storage of these expressions. llvm-svn: 144263
* constexpr: static data members declared constexpr are required to have anRichard Smith2011-11-071-26/+17
| | | | | | | | initializer; all other constexpr variables are merely required to be initialized. In particular, a user-provided constexpr default constructor can be used for such initialization. llvm-svn: 144028
* When we notice that a member function is defined with "= delete" or "=Douglas Gregor2011-11-071-5/+21
| | | | | | | | | | | | default", make a note of which is used when creating the initial declaration. Previously, we would wait until later to handle default/delete as a definition, but this is too late: when adding the declaration, we already treated the declaration as "user-provided" when in fact it was merely "user-declared". Fixes PR10861 and PR10442, along with a bunch of FIXMEs. llvm-svn: 144011
* objc: fixed enum type is supported in objc mode.Fariborz Jahanian2011-11-041-0/+1
| | | | | | | Fixes a bug where enumerator type is not this fixed type. // rdar://10381507 llvm-svn: 143724
* When we run into a constructor or destructor that is defined in theDouglas Gregor2011-11-011-3/+13
| | | | | | | | wrong class, make sure to drop it immediately; we don't want that constructor to be available within the DeclContext. Fixes <rdar://problem/9677163>. llvm-svn: 143506
* Rename Expr::Evaluate to Expr::EvaluateAsRValue to make it clear that it willRichard Smith2011-10-291-1/+1
| | | | | | | | implicitly perform an lvalue-to-rvalue conversion if used on an lvalue expression. Also improve the documentation of Expr::Evaluate* to indicate which of them will accept expressions with side-effects. llvm-svn: 143263
* Make the loading of information attached to an IdentifierInfo from anDouglas Gregor2011-10-271-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AST file more lazy, so that we don't eagerly load that information for all known identifiers each time a new AST file is loaded. The eager reloading made some sense in the context of precompiled headers, since very few identifiers were defined before PCH load time. With modules, however, a huge amount of code can get parsed before we see an @import, so laziness becomes important here. The approach taken to make this information lazy is fairly simple: when we load a new AST file, we mark all of the existing identifiers as being out-of-date. Whenever we want to access information that may come from an AST (e.g., whether the identifier has a macro definition, or what top-level declarations have that name), we check the out-of-date bit and, if it's set, ask the AST reader to update the IdentifierInfo from the AST files. The update is a merge, and we now take care to merge declarations before/after imports with declarations from multiple imports. The results of this optimization are fairly dramatic. On a small application that brings in 14 non-trivial modules, this takes modules from being > 3x slower than a "perfect" PCH file down to 30% slower for a full rebuild. A partial rebuild (where the PCH file or modules can be re-used) is down to 7% slower. Making the PCH file just a little imperfect (e.g., adding two smallish modules used by a bunch of .m files that aren't in the PCH file) tips the scales in favor of the modules approach, with 24% faster partial rebuilds. This is just a first step; the lazy scheme could possibly be improved by adding versioning, so we don't search into modules we already searched. Moreover, we'll need similar lazy schemes for all of the other lookup data structures, such as DeclContexts. llvm-svn: 143100
* Make use of the parameter in Sema::ActOnObjCTemporaryExitContainerContext.Argyrios Kyrtzidis2011-10-271-1/+2
| | | | llvm-svn: 143088
* Fix crash on an @interface nested inside @implementation, rdar://10336158Argyrios Kyrtzidis2011-10-271-3/+3
| | | | llvm-svn: 143085
* Compute the promoted integer type of fixed-width enums correctly. Found by ↵Eli Friedman2011-10-261-1/+5
| | | | | | inspection. llvm-svn: 143021
* Attach class template attributes to the templated CXXRecordDecl,Peter Collingbourne2011-10-231-1/+4
| | | | | | | | | instead of silently discarding them. As a side effect, this improves diagnostics for constexpr class templates slightly. llvm-svn: 142755
* objective-c: Diagnose redeclaration of privateFariborz Jahanian2011-10-211-0/+22
| | | | | | ivars in class extensions. // rdar://10309454 llvm-svn: 142664
* When performing name lookup for the previous declaration of a field,Douglas Gregor2011-10-211-8/+17
| | | | | | | | be sure to consider all of the possible lookup results. We were assert()'ing (but behaving correctly) for unresolved values. Fixes PR11134 / <rdar://problem/10290422>. llvm-svn: 142652
OpenPOWER on IntegriCloud