summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [c++1z] Support [[deprecated]] attributes on namespaces. Note that it only ↵Aaron Ballman2014-11-141-2/+11
| | | | | | applies to situations where the namespace is mentioned. Thus, use on anonymous namespaces is diagnosed. llvm-svn: 222054
* Remove some redundant virtual specifiers on overriden functions.David Blaikie2014-11-141-9/+9
| | | | llvm-svn: 222024
* PR21437, final part of DR1330: delay-parsing of exception-specifications. ThisRichard Smith2014-11-131-0/+46
| | | | | | | is a re-commit of Doug's r154844 (modernized and updated to fit into current Clang). llvm-svn: 221918
* Mark TypeDecls used in member initializers as referenced.Nico Weber2014-11-121-0/+1
| | | | | | | | | | | | | | | | | | Without this, -Wunused-local-typedef would incorrectly warn on the two typedefs in this program: void foo() { struct A {}; struct B : public A { typedef A INHERITED; B() : INHERITED() {} typedef B SELF; B(int) : SELF() {} }; } llvm-svn: 221765
* clang-format a few lines, fixes one 80col violation. nfc.Nico Weber2014-11-121-6/+5
| | | | llvm-svn: 221764
* Instantiate exception specifications when instantiating function types (otherRichard Smith2014-11-121-15/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | than the type of a function declaration). We previously didn't instantiate these at all! This also covers the pathological case where the only mention of a parameter pack is within the exception specification; this gives us a second way (other than alias templates) to reach the horrible state where a type contains an unexpanded pack, but its canonical type does not. This is a re-commit of r219977: r219977 was reverted in r220038 because it hit a wrong-code bug in GCC 4.7.2. (That's gcc.gnu.org/PR56135, and affects any implicit lambda-capture of 'this' within a template.) r219977 was a re-commit of r217995, r218011, and r218053: r217995 was reverted in r218058 because it hit a rejects-valid bug in MSVC. (Incorrect overload resolution in the presence of using-declarations.) It was re-committed in r219977 with a workaround for the MSVC rejects-valid. r218011 was a workaround for an MSVC parser bug. (Incorrect desugaring of unbraced range-based for loop). llvm-svn: 221750
* Further restrict issuance of 'override' warning if methodFariborz Jahanian2014-11-031-5/+7
| | | | | | is argument to a macro which is defined in system header. llvm-svn: 221172
* Don't allow dllimport/export on classes with internal linkage (PR21399)Hans Wennborg2014-11-031-0/+6
| | | | | | | | | | | Trying to import or export such classes doesn't make sense, and Clang would assert trying to export vtables for them. This is consistent with how we treat functions with internal linkage, but it is stricter than MSVC so we may have to back down if it breaks real code. llvm-svn: 221160
* Don't dllimport inline functions when targeting MinGW (PR21366)Hans Wennborg2014-11-031-9/+18
| | | | | | | | | | | | It turns out that MinGW never dllimports of exports inline functions. This means that code compiled with Clang would fail to link with MinGW-compiled libraries since we might try to import functions that are not imported. To fix this, make Clang never dllimport inline functions when targeting MinGW. llvm-svn: 221154
* Fix a bug where -Wuninitialized would skip arguments to a function call.Richard Trieu2014-11-011-0/+2
| | | | llvm-svn: 221030
* Have -Wuninitialized catch uninitalized use in overloaded operator arguments.Richard Trieu2014-10-311-0/+11
| | | | llvm-svn: 221000
* C++-11 [qoi]. Do not warn on missing 'verride' on use ofFariborz Jahanian2014-10-311-0/+6
| | | | | | | macros in user code when macros themselves are defined in a system header. rdar://18295240 llvm-svn: 220992
* c++11 patch to issue warning on missing 'override' on Fariborz Jahanian2014-10-271-1/+29
| | | | | | | overriding methods. Patch review by Richard Smith. rdar://18295240 llvm-svn: 220703
* Pass around CorrectionCandidateCallbacks as unique_ptrs soKaelyn Takata2014-10-271-13/+14
| | | | | | TypoCorrectionConsumer can keep the callback around as long as needed. llvm-svn: 220693
* Fix style issue from r220363. No functional change.Richard Trieu2014-10-221-1/+1
| | | | llvm-svn: 220370
* Disable the uninitialized field warning in uninstantiated classes.Richard Trieu2014-10-221-0/+3
| | | | | | | | If a templated class is not instantiated, then the AST for it could be missing some things that would throw the field checker off. Wait until specialization before emitting these warnings. llvm-svn: 220363
* SemaDeclCXX.cpp: UninitializedFieldVisitor: Avoid member initializers to ↵NAKAMURA Takumi2014-10-171-4/+5
| | | | | | appease msc17. llvm-svn: 220111
* Fix typo in comment.Nick Lewycky2014-10-171-1/+1
| | | | llvm-svn: 220098
* Add support for initializer lists on field initializers for -WuninitializedRichard Trieu2014-10-171-12/+90
| | | | llvm-svn: 220087
* Revert r219977, "Re-commit r217995 and follow-up patches (r217997, r218011, ↵NAKAMURA Takumi2014-10-171-17/+15
| | | | | | | | | | | | | r218053). These were" It broke some builders. I guess it'd be reproducible with --vg. Failing Tests (3): Clang :: CXX/except/except.spec/p1.cpp Clang :: SemaTemplate/instantiate-exception-spec-cxx11.cpp Clang :: SemaTemplate/instantiate-exception-spec.cpp llvm-svn: 220038
* Re-commit r217995 and follow-up patches (r217997, r218011, r218053). These wereRichard Smith2014-10-161-15/+17
| | | | | | | | | | | | | | | reverted in r218058 because they triggered a rejects-valid bug in MSVC. Original commit message from r217995: Instantiate exception specifications when instantiating function types (other than the type of a function declaration). We previously didn't instantiate these at all! This also covers the pathological case where the only mention of a parameter pack is within the exception specification; this gives us a second way (other than alias templates) to reach the horrible state where a type contains an unexpanded pack, but its canonical type does not. llvm-svn: 219977
* Revert r218925 - "Patch to warn if 'override' is missing"Alexander Potapenko2014-10-031-39/+1
| | | | | | | | | | | | | | | | | | | | This CL has caused bootstrap failures on Linux and OSX buildbots running with -Werror. Example report from http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/13183/steps/bootstrap%20clang/logs/stdio: ================================================================ [ 91%] Building CXX object tools/clang/tools/diagtool/CMakeFiles/diagtool.dir/ShowEnabledWarnings.cpp.o In file included from /home/dtoolsbot/build/sanitizer-x86_64-linux/build/llvm/lib/Target/R600/AMDGPUISelDAGToDAG.cpp:20: In file included from /home/dtoolsbot/build/sanitizer-x86_64-linux/build/llvm/lib/Target/R600/SIISelLowering.h:19: /home/dtoolsbot/build/sanitizer-x86_64-linux/build/llvm/lib/Target/R600/SIInstrInfo.h:71:8: error: 'getLdStBaseRegImmOfs' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override] bool getLdStBaseRegImmOfs(MachineInstr *LdSt, ^ /home/dtoolsbot/build/sanitizer-x86_64-linux/build/llvm/include/llvm/Target/TargetInstrInfo.h:815:16: note: overridden virtual function is here virtual bool getLdStBaseRegImmOfs(MachineInstr *LdSt, ^ ================================================================ llvm-svn: 218969
* Patch to warn if 'override' is missingFariborz Jahanian2014-10-021-1/+39
| | | | | | | | | | | | for an overriding method if class has at least one 'override' specified on one of its methods. Reviewed by Doug Gregor. rdar://18295240 (I have already checked in all llvm files with missing 'override' methods and Bob Wilson has fixed a TableGen of FastISel so no warnings are expected from build of llvm after this patch. I have already verified this). llvm-svn: 218925
* c++ error recovery. Build a valid AST when tryingFariborz Jahanian2014-10-011-1/+3
| | | | | | | | | to recover from parse error parsing the default argument. Patch prevents crash after spewing 100s of errors caused by someone who forgot to compile in c++11 mode. So no test. rdar://18508589 llvm-svn: 218780
* Improve -Wuninitialized warnings for fields that are record types.Richard Trieu2014-10-011-31/+59
| | | | | | | Get the record handling code from SelfReferenceChecker into UninitializedFieldVisitor as well as copying the testcases. llvm-svn: 218740
* CUDA: Fix incorrect target inference for implicit members.Eli Bendersky2014-09-291-4/+51
| | | | | | | | | | | | As PR20495 demonstrates, Clang currenlty infers the CUDA target (host/device, etc) for implicit members (constructors, etc.) incorrectly. This causes errors and even assertions in Clang when compiling code (assertions in C++11 mode where implicit move constructors are added into the mix). Fix the problem by inferring the target from the methods the implicit member should call (depending on its base classes and fields). llvm-svn: 218624
* Fix "unsupported friend" diagnostic to also appear for friend functions with ↵Richard Smith2014-09-291-1/+5
| | | | | | dependent scopes. llvm-svn: 218590
* Move calls to ResolveExceptionSpec out of SetDeclDefaulted and into ↵Ben Langmuir2014-09-251-5/+30
| | | | | | | | | DefineImplicit* This fixes an assertion failure in CodeGen where we were not resolving an exception specification. llvm-svn: 218466
* Add increment/decrement operators and compound assignment operators to theRichard Trieu2014-09-251-0/+11
| | | | | | uninitialized checkers that did not have them before. llvm-svn: 218435
* Revert r217995 and follow-ups:Hans Wennborg2014-09-181-17/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r218053: Use exceptions() instead of getNumExceptions()/getExceptionType() to avoid r218011: Work around MSVC parser bug by putting redundant braces around the body of r217997: Skip parens when detecting whether we're instantiating a function declaration. r217995: Instantiate exception specifications when instantiating function types (other The Windows build was broken for 16 hours and no one had any good ideas of how to fix it. Reverting for now to make the builders green. See the cfe-commits thread [1] for more info. This was the build error (from [2]): C:\bb-win7\ninja-clang-i686-msc17-R\llvm-project\clang\lib\Sema\SemaTemplateInstantiate.cpp(1590) : error C2668: '`anonymous-namespace'::TemplateInstantiator::TransformFunctionProtoType' : ambiguous call to overloaded function C:\bb-win7\ninja-clang-i686-msc17-R\llvm-project\clang\lib\Sema\SemaTemplateInstantiate.cpp(1313): could be 'clang::QualType `anonymous-namespace'::TemplateInstantiator::TransformFunctionProtoType<clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>>(clang::TypeLocBuilder &,clang::FunctionProtoTypeLoc,clang::CXXRecordDecl *,unsigned int,Fn)' with [ Fn=clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735> ] c:\bb-win7\ninja-clang-i686-msc17-r\llvm-project\clang\lib\sema\TreeTransform.h(4532): or 'clang::QualType clang::TreeTransform<Derived>::TransformFunctionProtoType<clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>>(clang::TypeLocBuilder &,clang::FunctionProtoTypeLoc,clang::CXXRecordDecl *,unsigned int,Fn)' with [ Derived=`anonymous-namespace'::TemplateInstantiator, Fn=clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735> ] while trying to match the argument list '(clang::TypeLocBuilder, clang::FunctionProtoTypeLoc, clang::CXXRecordDecl *, unsigned int, clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>)' 1. http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140915/115011.html 2. http://bb.pgr.jp/builders/ninja-clang-i686-msc17-R/builds/10515/steps/build_clang_tools_1/logs/stdio llvm-svn: 218058
* Instantiate exception specifications when instantiating function types (otherRichard Smith2014-09-171-15/+17
| | | | | | | | | | than the type of a function declaration). We previously didn't instantiate these at all! This also covers the pathological case where the only mention of a parameter pack is within the exception specification; this gives us a second way (other than alias templates) to reach the horrible state where a type contains an unexpanded pack, but its canonical type does not. llvm-svn: 217995
* Check delegating constructors for using uninitialized fields.Richard Trieu2014-09-121-0/+2
| | | | llvm-svn: 217716
* [modules] Make NamespaceAliasDecl redeclarable, as it should be. This fixesRichard Smith2014-09-031-30/+33
| | | | | | | merging of namespace aliases across modules and improves source fidelity. Incidentally also fixes PR20816. llvm-svn: 217103
* Split off CUDA-specific Sema parts to a new fileEli Bendersky2014-09-031-40/+0
| | | | | | | | | | | In line with SemaOpenMP.cpp, etc. CUDA-specific semantic analysis code goes into a separate file. This is in anticipation of adding extra functionality here in the near future. No change in functionality. Review: http://reviews.llvm.org/D5160 llvm-svn: 217043
* Use llvm::makeArrayRef instead of explicitly calling ArrayRef constructor ↵Craig Topper2014-08-301-2/+1
| | | | | | and mentioning the type. This works now that we have a conversion from ArrayRef<T*> to ArrayRef<const T*>. llvm-svn: 216824
* During cross field uninitialized checking, when processing an assignment,Richard Trieu2014-08-281-29/+43
| | | | | | | | | | | | | | | | | | | | | | don't mark the field as initialized until the next initializer instead of instantly. Since this checker is AST based, statements are processed in tree order instead of following code flow. This can result in different warnings from just reordering the code. Also changed to use one checker per constructor instead of creating a new checker per field. class T { int x, y; // Already warns T(bool b) : x(!b ? (1 + y) : (y = 5)) {} // New warning added here, previously (1 + y) comes after (y = 5) in the AST // preventing the warning. T(bool b) : x(b ? (y = 5) : (1 + y)) {} }; llvm-svn: 216641
* PR20769: Fix confusion when checking whether a prior default argument was inRichard Smith2014-08-271-6/+10
| | | | | | scope when checking for conflicts. llvm-svn: 216628
* More -Wuninitialized updatesRichard Trieu2014-08-271-4/+6
| | | | | | | | | | | Fix r216438 to catch more complicated self-initialized in std::move. For instance, "Foo f = std::move(cond ? OtherFoo : (UNUSED_VALUE, f));" Make sure that BinaryConditionalOperator, ConditionalOperator, BinaryOperator with comma operator, and OpaqueValueExpr perform the correct usage forwarding across the three uninitialized value checkers. llvm-svn: 216627
* Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or ↵Craig Topper2014-08-271-11/+11
| | | | | | just letting them be implicitly created. llvm-svn: 216528
* Passing a variable to std::move now counts as a use for -WuninitializedRichard Trieu2014-08-261-0/+15
| | | | llvm-svn: 216438
* [modules] Track the described template in an alias declaration that is theRichard Smith2014-08-261-0/+1
| | | | | | | pattern of an alias template declaration. Use this to merge alias templates properly when they're members of class template specializations. llvm-svn: 216437
* Don't assert on different DLL attributes in template and explicit ↵Hans Wennborg2014-08-241-11/+23
| | | | | | | | | | | | | | | | | | | | instantiation (PR20137) We would previously assert (a decl cannot have two DLL attributes) on this code: template <typename T> struct __declspec(dllimport) S { T f() { return T(); } }; template struct __declspec(dllexport) S<int>; The problem was that when instantiating, we would take the attribute from the template even if the instantiation itself already had an attribute. Also, don't inherit DLL attributes from the template to its members before instantiation, as the attribute may change. I couldn't figure out what MinGW does here, so I'm leaving that open. At least we're not asserting anymore. llvm-svn: 216340
* MS ABI: Inherit DLL attributes to partial class template specializationsHans Wennborg2014-08-231-0/+13
| | | | llvm-svn: 216333
* checkDLLAttribute: remove a redundant dyn_castHans Wennborg2014-08-231-21/+19
| | | | | | The same dyn_cast was done earlier in the function. No functionality change. llvm-svn: 216326
* MS ABI: Don't always instantiate all members of dllexported class templates ↵Hans Wennborg2014-08-211-1/+11
| | | | | | | | | | | | | | | | (PR20163) Normally we mark all members of exported classes referenced to get them emitted. However, MSVC doesn't do this for class templates that are implicitly specialized or just have an explicit instantiation declaration. For such specializations, the members are emitted when referenced. The exception is the case when the dllexport attribute is propagated from a base class to a base class template that doesn't have an explicit attribute: in this case all methods of the base class template do get instantiated. llvm-svn: 216145
* C++1y is now C++14!Aaron Ballman2014-08-191-9/+9
| | | | | | Changes diagnostic options, language standard options, diagnostic identifiers, diagnostic wording to use c++14 instead of c++1y. It also modifies related test cases to use the updated diagnostic wording. llvm-svn: 215982
* Repace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid ↵Craig Topper2014-08-171-5/+5
| | | | | | needing to mention the size. llvm-svn: 215869
* Improve -Wuninitialized to catch const classes being used in their own copyRichard Trieu2014-08-121-6/+12
| | | | | | constructors. llvm-svn: 215471
* Factor out exception specification information fromRichard Smith2014-07-311-24/+20
| | | | | | | | FunctionProtoType::ExtProtoInfo. Most of the users of these fields don't care about the other ExtProtoInfo bits and just want to talk about the exception specification. llvm-svn: 214450
* Updating a comment related to the implementation of -Woverloaded-virtual, ↵Aaron Ballman2014-07-301-1/+8
| | | | | | | | and adding a FIXME to a test case. (Drive-by removal of trailing whitespace in the test case as well.) No functional changes. llvm-svn: 214362
OpenPOWER on IntegriCloud