summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix this code to follow the coding style regarding anonymous namespaces andRichard Smith2014-11-121-93/+58
| | | | | | | static functions. Make a bunch of file-local functions static. Remove one unused static function revealed by this. llvm-svn: 221745
* Have LookupMemberExprInRecord only call CorrectTypoDelayed, dropping theKaelyn Takata2014-11-112-68/+45
| | | | | | | | | code for calling CorrectTypo. Includes a needed fix for non-C++ code to not choke on TypoExprs (which also resolves a TODO from r220698). llvm-svn: 221736
* Create two helpers for running the typo-correction tree transform.Kaelyn Takata2014-11-111-16/+28
| | | | | | | | | | | | | One takes an Expr* and the other is a simple wrapper that takes an ExprResult instead, and handles checking whether the ExprResult is invalid. Additionally, allow an optional callback that is run on the full result of the tree transform, for filtering potential corrections based on the characteristics of the resulting expression once all of the typos have been replaced. llvm-svn: 221735
* Replace MemberTypoDiags and MemberExprTypoRecovery with lambdas.Kaelyn Takata2014-11-111-83/+39
| | | | llvm-svn: 221734
* Make LookupResult be copyable to avoid decomposing an existing one andKaelyn Takata2014-11-111-6/+6
| | | | | | initializing a new one every time a copy is needed. llvm-svn: 221724
* Explicitly exclude keywords from the member validator.Kaelyn Takata2014-11-111-10/+9
| | | | | | Also simply and remove dead code from MemberExprTypoRecovery. llvm-svn: 221723
* Fix some formatting prior to refactoring the code.Kaelyn Takata2014-11-111-21/+23
| | | | llvm-svn: 221722
* Revert r221702 until I address Richard Trieu'sFariborz Jahanian2014-11-112-16/+1
| | | | | | comments. llvm-svn: 221714
* Patch to warn when logical evaluation of operand evalutes to a true value;Fariborz Jahanian2014-11-112-1/+16
| | | | | | | That this is a c-only patch. c++ already has this warning. This addresses rdar://18716393 llvm-svn: 221702
* First half of CWG1962: decltype(__func__) should not be a reference type,Richard Smith2014-11-111-0/+2
| | | | | | because __func__ is supposed to act like a local static variable. llvm-svn: 221698
* This patch fixes a crash after rebuilding call AST ofFariborz Jahanian2014-11-111-0/+33
| | | | | | | | | | | | | an __unknown_anytype(...). In this case, we rebuild the vararg function type specially to convert the call expression to something that IRGen can handle. However, FunctionDecl as rebuilt in RebuildUnknownAnyExpr::resolveDecl is bogus and results in crash when accessing its params later on. This patch fixes the crash by rebuilding the FunctionDecl to match its new resolved type. rdar://15297105. (patch reapplied after lldb issue was fixed in r221660). llvm-svn: 221691
* [OPENMP] Codegen for threadprivate variablesAlexey Bataev2014-11-111-0/+5
| | | | | | | | | For all threadprivate variables which have constructor/destructor emit call to void __kmpc_threadprivate_register(ident_t * <Current Location>, void *<Original Global Addr>, kmpc_ctor <Constructor>, kmpc_cctor NULL, kmpc_dtor <Destructor>); In expressions all references to such variables are replaced by calls to void *__kmpc_threadprivate_cached(ident_t *<Current Location>, kmp_int32 <Current Thread Id>, void *<Original Global Addr>, size_t <Size of Data>, void ***<Pointer to autogenerated cache – array of private copies of threadprivate variable>); Test test/OpenMP/threadprivate_codegen.cpp checks that codegen is correct. Also it checks that codegen is correct after serialization/deserialization and one of passes verifies debug info. Differential Revision: http://reviews.llvm.org/D4002 llvm-svn: 221663
* [c++1z] N4295: fold-expressions.Richard Smith2014-11-084-2/+250
| | | | | | | | | | | | | | | | This is a new form of expression of the form: (expr op ... op expr) where one of the exprs is a parameter pack. It expands into (expr1 op (expr2onwards op ... op expr)) (and likewise if the pack is on the right). The non-pack operand can be omitted; in that case, an empty pack gives a fallback value or an error, depending on the operator. llvm-svn: 221573
* [Objective-C Sema]. Issue availability/deprecated warning when Fariborz Jahanian2014-11-071-1/+5
| | | | | | | there is a uinque method found when message is sent to receiver of 'id' type. // rdar://18848183 llvm-svn: 221562
* Revert r221404 which caused lldb to not displayFariborz Jahanian2014-11-071-33/+0
| | | | | | vararg expressions. llvm-svn: 221533
* Fix for exception specification mismatch in explicit instantiation.Alexey Bataev2014-11-061-0/+23
| | | | | | | According to C++ standard if an exception-specification is specified in an explicit instantiation directive, it shall be compatible with the exception-specifications of other declarations of that function. This patch adds checks for this. Differential Revision: http://reviews.llvm.org/D5822 llvm-svn: 221448
* This patch fixes a crash after rebuilding call AST ofFariborz Jahanian2014-11-051-0/+33
| | | | | | | | | | | | | an __unknown_anytype(...). In this case, we rebuild the vararg function type specially to convert the call expression to something that IRGen can handle. However, FunctionDecl as rebuilt in RebuildUnknownAnyExpr::resolveDecl is bogus and results in crash when accessing its params later on. This patch fixes the crash by rebuilding the FunctionDecl to match its new resolved type. rdar://15297105. John McCall, please review post-commit. llvm-svn: 221404
* Move the no-prototype calling conv check after decl mergingReid Kleckner2014-11-031-13/+14
| | | | | | | | | | | Now we don't warn on this code: void __stdcall f(void); void __stdcall f(); My previous commit regressed this functionality because I didn't update the relevant test case which used a definition. llvm-svn: 221188
* Don't diagnose no-prototype callee-cleanup function definitionsReid Kleckner2014-11-031-15/+15
| | | | | | | | | | | | We already have a warning on the call sites of code like this: void f() { } void g() { f(1, 2, 3); } t.c:2:21: warning: too many arguments in call to 'f' We can limit ourselves to diagnosing unprototyped forward declarations of f to cut down on noise. llvm-svn: 221184
* 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
* This patch reverts r220496 which issues warning on comparing Fariborz Jahanian2014-11-031-31/+1
| | | | | | | | parameters with nonnull attribute when comparison is always true/false. Patch causes false positive when parameter is modified in the function. llvm-svn: 221163
* 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-033-9/+36
| | | | | | | | | | | | 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-312-4/+18
| | | | 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
* [PowerPC] Initial VSX intrinsic support, with min/max for vector doubleBill Schmidt2014-10-311-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we have initial support for VSX, we can begin adding intrinsics for programmer access to VSX instructions. This patch performs the necessary enablement in the front end, and tests it by implementing intrinsics for minimum and maximum using the vector double data type. The main change in the front end is to no longer disallow "vector" and "double" in the same declaration (lib/Sema/DeclSpec.cpp), but "vector" and "long double" must still be disallowed. The new intrinsics are accessed via vec_max and vec_min with changes in lib/Headers/altivec.h. Note that for v4f32, we already access corresponding VMX builtins, but with VSX enabled we should use the forms that allow all 64 vector registers. The new built-ins are defined in include/clang/Basic/BuiltinsPPC.def. I've added a new test in test/CodeGen/builtins-ppc-vsx.c that is similar to, but much smaller than, builtins-ppc-altivec.c. This allows us to test VSX IR generation without duplicating CHECK lines for the existing bazillion Altivec tests. Since vector double is now legal when VSX is available, I've modified the error message, and changed where we test for it and for vector long double, since the target machine isn't visible in the old place. This serendipitously removed a not-pertinent warning about 'long' being deprecated when used with 'vector', when "vector long double" is encountered and we just want to issue an error. The existing tests test/Parser/altivec.c and test/Parser/cxx-altivec.cpp have been updated accordingly, and I've added test/Parser/vsx.c to verify that "vector double" is now legitimate with VSX enabled. There is a companion patch for LLVM. llvm-svn: 220989
* Remove StorageClass typedefs from VarDecl and FunctionDecl since ↵Craig Topper2014-10-312-15/+12
| | | | | | StorageClass is in the clang namespace. llvm-svn: 220956
* Follow-up to r216619: use isCXXCLassMember() instead of trying toHans Wennborg2014-10-291-1/+1
| | | | | | | check the context ourselves when selectively allowing late-added dll attributes on unused free functions and variables (PR20746) llvm-svn: 220874
* Improved capturing variable-length array types in CapturedStmt.Alexey Bataev2014-10-293-12/+24
| | | | | | | | An updated implemnentation of VLA types capturing based on previously committed solution for Lambdas. This version captures the whole VLA type instead of particular variables which are part of VLA size expression and allows to use previusly calculated size of VLA type in captured regions. Required for OpenMP. Differential Revision: http://reviews.llvm.org/D5099 llvm-svn: 220850
* Don't capture DeclRefExpr::getNameInfo().getInfo(). It returns reference in ↵NAKAMURA Takumi2014-10-291-1/+1
| | | | | | | | | | | | | | | | | | temporary object. DeclarationNameInfo::getInfo() returns reference, but DeclRefExpr::getNameInfo() returns temporary DeclarationNameInfo(). It triggered a local crash for me. Failing Tests (1): Clang :: SemaTemplate/instantiate-overload-candidates.cpp Assertion failed! Program: bin\clang.EXE File: clang/lib/Basic/SourceManager.cpp, Line 822 Expression: 0 && "Invalid SLocOffset or bad function choice" llvm-svn: 220841
* Objective-C. revert patch for rdar://17554063.Fariborz Jahanian2014-10-282-67/+12
| | | | llvm-svn: 220812
* [Objective-C]. revert r220740,r220727Fariborz Jahanian2014-10-281-16/+5
| | | | llvm-svn: 220802
* Objective-C ARC [qoi]. Issue diagnostic if __bridge castingFariborz Jahanian2014-10-271-5/+16
| | | | | | to C type a collection literal. rdar://18768214 llvm-svn: 220727
* 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
* Wire up LookupMemberExpr to use the new TypoExpr.Kaelyn Takata2014-10-272-11/+150
| | | | | | | | This includes adding the new TypoExpr-based lazy typo correction to LookupMemberExprInRecord as an alternative to the existing eager typo correction. llvm-svn: 220698
* Add a callback for recovering using a typo correction.Kaelyn Takata2014-10-272-12/+20
| | | | | | | Also keep track of the stack of Exprs visited during the tree transform so the callback can be passed the parent of the TypoExpr. llvm-svn: 220697
* Add simple way for a CorrectionCandidateCallback to reject exactKaelyn Takata2014-10-271-47/+50
| | | | | | | | | | | | | | | matches of the typo. Also be more proactive about checking a correction's visibility so that a correction requiring a module import can be distinguished from the original typo even if it looks identical. Otherwise the correction will be excluded and the diagnostic about needing the module import won't be emitted. Note that no change was made to checkCorrectionVisibility other than moving where it is at in SemaLookup.cpp. llvm-svn: 220696
* Start adding the infrastructure for handling TypoExprs.Kaelyn Takata2014-10-273-104/+334
| | | | | | | | | | | | | | | | Part of the infrastructure is a map from a TypoExpr to the Sema-specific state needed to correct it, along with helpers to ease dealing with the state. The the typo count is propagated up the stack of ExpressionEvaluationContextRecords when one is popped off of to avoid accidentally dropping TypoExprs on the floor. For example, the attempted correction of g() in test/CXX/class/class.mem/p5-0x.cpp happens with an ExpressionEvaluationContextRecord that is popped off the stack prior to ActOnFinishFullExpr being called and the tree transform for TypoExprs being run. llvm-svn: 220695
* Have TypoCorrectionConsumer remember the TypoCorrections it returned.Kaelyn Takata2014-10-271-4/+12
| | | | | | | | | | | Two additional methods are provided: one to return the current correction (the last correction returned by getNextCorrection), and one to "reset" the state so that getNextCorrection will return the previous corrections before returning any new corrections. Also ensure that all TypoCorrections have valid source ranges. llvm-svn: 220694
* Pass around CorrectionCandidateCallbacks as unique_ptrs soKaelyn Takata2014-10-2714-134/+140
| | | | | | TypoCorrectionConsumer can keep the callback around as long as needed. llvm-svn: 220693
* Add the initial TypoExpr AST node for delayed typo correction.Kaelyn Takata2014-10-272-0/+7
| | | | llvm-svn: 220692
* Move TypoCorrectionConsumer into a header.Kaelyn Takata2014-10-271-151/+2
| | | | | | | | | This makes it available outside of SemaLookup.cpp, as needed for the forthcoming TypoExpr AST node which will keep a TypoCorrectionConsumer that provides the possible typo corrections for that TypoExpr. llvm-svn: 220691
* Prune CRLF.NAKAMURA Takumi2014-10-271-2/+2
| | | | llvm-svn: 220678
* Add frontend support for __vectorcallReid Kleckner2014-10-243-3/+15
| | | | | | | | | | | | | Wire it through everywhere we have support for fastcall, essentially. This allows us to parse the MSVC "14" CTP headers, but we will miscompile them because LLVM doesn't support __vectorcall yet. Reviewed By: Aaron Ballman Differential Revision: http://reviews.llvm.org/D5808 llvm-svn: 220573
* Report when a function-try-block does not return a value on all control ↵Aaron Ballman2014-10-241-36/+29
| | | | | | paths. Fixed PR14620. llvm-svn: 220557
* patch to issue warning on comparing parameters withFariborz Jahanian2014-10-231-1/+31
| | | | | | | | nonnull attribute when comparison is always true/false. Patch by Steven Wu with few fixes and minor refactoring and adding tests by me. rdar://18712242 llvm-svn: 220496
* Reland r219810 "Fix late template parsing leak with incremental processing"Reid Kleckner2014-10-221-0/+4
| | | | | | | | | | | | | | Original message: Add a second late template parser callback meant to cleanup any resources allocated by late template parsing. Call it from the Sema::ActOnEndOfTranslationUnit method after all pending template instantiations have been completed. Teach Parser::ParseTopLevelDecl to install the cleanup callback when incremental processing is enabled so that Parser::TemplateIds can be freed. Patch by Brad King! llvm-svn: 220400
* 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
OpenPOWER on IntegriCloud