summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix PR 9626 (duplicated self-init warnings under -Wuninitialized) with ↵Ted Kremenek2011-04-041-1/+10
| | | | | | | | | | | | | | numerous CFG and UninitializedValues analysis changes: 1) Change the CFG to include the DeclStmt for conditional variables, instead of using the condition itself as a faux DeclStmt. 2) Update ExprEngine (the static analyzer) to understand (1), so not to regress. 3) Update UninitializedValues.cpp to initialize all tracked variables to Uninitialized at the start of the function/method. 4) Only use the SelfReferenceChecker (SemaDecl.cpp) on global variables, leaving the dataflow analysis to handle other cases. The combination of (1) and (3) allows the dataflow-based -Wuninitialized to find self-init problems when the initializer contained control-flow. llvm-svn: 128858
* Accept __declspec(dllimport) for function defined at class scope in ↵Francois Pichet2011-03-291-1/+3
| | | | | | | | Microsoft mode. This fixes a bunch of errors when compiling MSVC header files with the -DDLL flag. llvm-svn: 128457
* Diagnose uninitialized uses of a variable within its own initializer.Chandler Carruth2011-03-271-1/+44
| | | | | | | | | | | This is basically the same idea as the warning on uninitialized uses of fields within an initializer list. As such, it is on by default and under -Wuninitialized. Original patch by Richard Trieu, with some massaging from me on the wording and grouping of the diagnostics. llvm-svn: 128376
* Don't warn about the 'extern' in 'extern "C"' on a tag decl. This isJohn McCall2011-03-261-2/+7
| | | | | | usually useless, but not always. llvm-svn: 128326
* Get rid of handling of the 'explicit' keyword from class-head. We still ↵Anders Carlsson2011-03-251-5/+3
| | | | | | parse it though, although that will change shortly. llvm-svn: 128277
* Minor fix in the injection of labels, since we want to look at the ↵Douglas Gregor2011-03-241-1/+1
| | | | | | redeclaration context of each declaration in the identifier chain. Should fix Linux self-host llvm-svn: 128210
* Insomniac refactoring: change how the parser allocates attributes so thatJohn McCall2011-03-241-4/+6
| | | | | | | | | AttributeLists do not accumulate over the lifetime of parsing, but are instead reused. Also make the arguments array not require a separate allocation, and make availability attributes store their stuff in augmented memory, too. llvm-svn: 128209
* Warn about unused declaration-specifiers on tag declarations.John McCall2011-03-221-10/+42
| | | | llvm-svn: 128118
* Apply Jonathan Sauer's proposed solution to PR9519. Thanks!John McCall2011-03-221-1/+1
| | | | llvm-svn: 128075
* Defined friend functions are *implicitly* inlined, unless the inline ↵Abramo Bagnara2011-03-181-8/+8
| | | | | | specifier occurs explicitly. llvm-svn: 127877
* Fixed inconsistency when adding TemplateParameterListsInfo.Abramo Bagnara2011-03-181-69/+69
| | | | llvm-svn: 127876
* Fix PR9488: 'auto' type substitution can fail (for instance, if it creates a ↵Richard Smith2011-03-171-3/+5
| | | | | | | | reference-to-void type). Don't crash if it does. Also fix an issue where type source information for the resulting type was being lost. llvm-svn: 127811
* Detect attempts to provide a specialization of a function within aDouglas Gregor2011-03-161-3/+9
| | | | | | dependent scope and produce an error (rather than crashing). Fixes PR8979. llvm-svn: 127749
* When we're inserting a synthesized label declaration for aDouglas Gregor2011-03-161-2/+6
| | | | | | | | | | | | | | | | forward-looking "goto" statement, make sure to insert it *after* the last declaration in the identifier resolver's declaration chain that is either outside of the function/block/method's scope or that is declared in that function/block/method's specific scope. Previously, we could end up inserting the label ahead of declarations in inner scopes, confusing C++ name lookup. Fixes PR9491/<rdar://problem/9140426> and <rdar://problem/9135994>. Note that the crash-on-invalid PR9495 is *not* fixed. That's a separate issue. llvm-svn: 127737
* When synthesizing a label declaration based on a goto statement thatDouglas Gregor2011-03-141-1/+14
| | | | | | | | | cannot yet be resolved, be sure to push the new label declaration into the right place within the identifier chain. Otherwise, name lookup in C++ gets confused when searching for names that are lexically closer than the label. Fixes PR9463. llvm-svn: 127623
* Make deallocation functions implicitly noexcept in C++0x.Sebastian Redl2011-03-141-2/+2
| | | | llvm-svn: 127596
* Propagate the new exception information to FunctionProtoType.Sebastian Redl2011-03-121-4/+6
| | | | | | | | Change the interface to expose the new information and deal with the enormous fallout. Introduce the new ExceptionSpecificationType value EST_DynamicNone to more easily deal with empty throw specifications. Update the tests for noexcept and fix the various bugs uncovered, such as lack of tentative parsing support. llvm-svn: 127537
* Avoid do drop outer template parameter lists on the floor.Abramo Bagnara2011-03-101-4/+4
| | | | llvm-svn: 127404
* Revert r127206 "Detect attempts to provide a specialization of a function withinDaniel Dunbar2011-03-091-8/+3
| | | | | | a...", it appears to cause us to reject various valid codes. llvm-svn: 127373
* Fixed InnerLocStart.Abramo Bagnara2011-03-091-7/+6
| | | | llvm-svn: 127330
* Warn on usage of unavailable objc 'class' inFariborz Jahanian2011-03-081-0/+1
| | | | | | varienty of cases. // rdar://9092208 llvm-svn: 127257
* Teach libclang's token-annotation logic about context-sensitiveDouglas Gregor2011-03-081-2/+4
| | | | | | keywords for Objective-C+ and C++0x. llvm-svn: 127253
* Fixed source range for StaticAssertDecl and LinkageSpecDecl. Fixed source ↵Abramo Bagnara2011-03-081-1/+1
| | | | | | range for declarations using postfix types. llvm-svn: 127251
* Fixed source range for all DeclaratorDecl's.Abramo Bagnara2011-03-081-26/+42
| | | | llvm-svn: 127225
* Detect attempts to provide a specialization of a function within aDouglas Gregor2011-03-081-3/+8
| | | | | | dependent scope and produce an error (rather than crashing). Fixes PR8979. llvm-svn: 127206
* g++ is more permissive regarding flexible arrays.Argyrios Kyrtzidis2011-03-071-5/+12
| | | | | | | | It will accept flexible array in union and also as the sole element of a struct/class. Fixes rdar://9065507. llvm-svn: 127171
* Support explicit template specialization and instantiation for membersDouglas Gregor2011-03-071-10/+19
| | | | | | | | | | | of a C++0x inline namespace within enclosing namespaces, as noted in C++0x [namespace.def]p8. Fixes <rdar://problem/9006349>, a libc++ failure where Clang was rejected an explicit specialization of std::swap (since libc++ puts it into an inline, versioned namespace std::__1). llvm-svn: 127162
* Completed source ranges fixes for all classes inheriting from TypeDecl.Abramo Bagnara2011-03-061-1/+1
| | | | llvm-svn: 127120
* Fixed TypedefDecl and TemplateTypeParameter source range.Abramo Bagnara2011-03-061-0/+1
| | | | llvm-svn: 127119
* Propagate new-style exception spec information to Declarator.Sebastian Redl2011-03-051-2/+2
| | | | llvm-svn: 127111
* When diagnostics are suppressed (e.g., because of code completion), don't ↵Douglas Gregor2011-03-041-1/+2
| | | | | | trigger the ExprTemplates.empty() check at the end of a function body llvm-svn: 127046
* Diagnose destructor templates. Fixes PR7904.Douglas Gregor2011-03-041-1/+8
| | | | llvm-svn: 127042
* Fixed source range for FileScopeAsmDecl. Others source range fixes will follow.Abramo Bagnara2011-03-031-2/+5
| | | | llvm-svn: 126939
* Remove cruftDouglas Gregor2011-03-021-9/+0
| | | | llvm-svn: 126888
* Force CaseStmt to store its child statements in source-code order,Douglas Gregor2011-03-021-0/+9
| | | | | | | which is important for libclang's token-annotation and where's-my-cursor functionality. Fixes <rdar://problem/9004439>. llvm-svn: 126887
* Support a new InheritableAttr subclass, InheritableParamAttr, which isJohn McCall2011-03-021-13/+67
| | | | | | | used for attributes that are okay to inherit when written on a parameter. Dependent on LLVM r126827. llvm-svn: 126828
* Reinstate the introduction of source-location information forDouglas Gregor2011-03-011-8/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | nested-name-speciciers within elaborated type names, e.g., enum clang::NestedNameSpecifier::SpecifierKind Fixes in this iteration include: (1) Compute the type-source range properly for a dependent template specialization type that starts with "template template-id ::", as in a member access expression dep->template f<T>::f() This is a latent bug I triggered with this change (because now we're checking the computed source ranges for dependent template specialization types). But the real problem was... (2) Make sure to set the qualifier range on a dependent template specialization type appropriately. This will go away once we push nested-name-specifier locations into dependent template specialization types, but it was the source of the valgrind errors on the buildbots. llvm-svn: 126765
* Revert r126748, my second attempt at nested-name-specifier sourceDouglas Gregor2011-03-011-28/+8
| | | | | | location information for elaborated types. *sigh* llvm-svn: 126753
* Reinstate r126737, extending the generation of type-source locationDouglas Gregor2011-03-011-8/+28
| | | | | | | | | | | | | | | | | | | | | | | | | information for qualifier type names throughout the parser to address several problems. The commit message from r126737: Push nested-name-specifier source location information into elaborated name types, e.g., "enum clang::NestedNameSpecifier::SpecifierKind". Aside from the normal changes, this also required some tweaks to the parser. Essentially, when we're looking at a type name (via getTypeName()) specifically for the purpose of creating an annotation token, we pass down the flag that asks for full type-source location information to be stored within the returned type. That way, we retain source-location information involving nested-name-specifiers rather than trying to reconstruct that information later, long after it's been lost in the parser. With this change, test/Index/recursive-cxx-member-calls.cpp is showing much improved results again, since that code has lots of nested-name-specifiers. llvm-svn: 126748
* Revert r126737, the most recent nested-name-specifier location change, for ↵Douglas Gregor2011-03-011-25/+7
| | | | | | buildbot breakage. llvm-svn: 126746
* Push nested-name-specifier source location information into elaboratedDouglas Gregor2011-03-011-7/+25
| | | | | | | | | | | | | | | | | | | name types, e.g., "enum clang::NestedNameSpecifier::SpecifierKind". Aside from the normal changes, this also required some tweaks to the parser. Essentially, when we're looking at a type name (via getTypeName()) specifically for the purpose of creating an annotation token, we pass down the flag that asks for full type-source location information to be stored within the returned type. That way, we retain source-location information involving nested-name-specifiers rather than trying to reconstruct that information later, long after it's been lost in the parser. With this change, test/Index/recursive-cxx-member-calls.cpp is showing much improved results again, since that code has lots of nested-name-specifiers. llvm-svn: 126737
* Teach Sema::CheckTypenameType to use nested-name-specifiers withDouglas Gregor2011-02-281-2/+3
| | | | | | | | source-location information. We don't actually preserve this information in any of the resulting TypeLocs (yet), so it doesn't matter. llvm-svn: 126693
* Use NestedNameSpecifierLoc within out-of-line variables, function, andDouglas Gregor2011-02-251-5/+2
| | | | | | | tag definitions. Also, add support for template instantiation of NestedNameSpecifierLocs. llvm-svn: 126470
* Issue AnalysisBasedWarnings as part of calling ↵Ted Kremenek2011-02-231-8/+3
| | | | | | Sema::PopBlockOrFunctionScope(). No real functionality change. llvm-svn: 126287
* Fix PR9276: We were missing the checks for auto deducing to different types ↵Richard Smith2011-02-231-9/+21
| | | | | | in the same declaration group in the template instantiation case. llvm-svn: 126279
* Tweaks to C++0x deduced auto type support:Richard Smith2011-02-211-12/+15
| | | | | | | | * Flag indicating 'we're parsing this auto typed variable's initializer' moved from VarDecl to Sema * Temporary template parameter list for auto deduction is now allocated on the stack. * Deduced 'auto' types are now uniqued. llvm-svn: 126139
* Implement the C++0x deduced 'auto' feature.Richard Smith2011-02-201-45/+133
| | | | | | This fixes PR 8738, 9060 and 9132. llvm-svn: 126069
* Remove the Fix-It for "main must return 'int'", which is not alwaysDouglas Gregor2011-02-191-8/+1
| | | | | | correct and is not worth fixing. Fixes PR8396. llvm-svn: 126035
* Switch labels over to using normal name lookup, instead of their Chris Lattner2011-02-181-5/+14
| | | | | | | own weird little DenseMap. Hey look, we now emit unused label warnings deterministically, amazing. llvm-svn: 125813
* Step #2/N of __label__ support: keep pushing LabelDecl forward,Chris Lattner2011-02-171-4/+10
| | | | | | | | | | making them be template instantiated in a more normal way and make them handle attributes like other decls. This fixes the used/unused label handling stuff, making it use the same infrastructure as other decls. llvm-svn: 125771
OpenPOWER on IntegriCloud