aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaTemplateVariadic.cpp
AgeCommit message (Collapse)AuthorFilesLines
2014-12-30Don't crash on an invalid trailing return type on a function before a '...'Nico Weber1-5/+5
clang tries to produce a helpful diagnostic for the traiilng '...', but the code that r216778 added for this doesn't expect an invalid trailing return type. Add code to explicitly handle this. Having explicit code for this but not for other things looks a bit strange, but trailing return types are special in that they have a separate existence bit in addition to the type (see r158348). llvm-svn: 224974
2014-11-19Update for LLVM API change to make Small(Ptr)Set::insert return ↵David Blaikie1-1/+1
pair<iterator, bool> as per the C++ standard's associative container concept. llvm-svn: 222335
2014-11-08[c++1z] N4295: fold-expressions.Richard Smith1-0/+105
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
2014-10-27Pass around CorrectionCandidateCallbacks as unique_ptrs soKaelyn Takata1-4/+4
TypoCorrectionConsumer can keep the callback around as long as needed. llvm-svn: 220693
2014-08-29Fix for PR20660, where unexpanded parameter pack in function parameter ↵Larisse Voufo1-7/+31
clause causes clang to crash. llvm-svn: 216778
2014-08-11Reject varargs '...' in function prototype if there are more parameters afterRichard Smith1-0/+14
it. Diagnose with recovery if it appears after a function parameter that was obviously supposed to be a parameter pack. Otherwise, warn if it immediately follows a function parameter pack, because the user most likely didn't intend to write a parameter pack followed by a C-style varargs ellipsis. This warning can be syntactically disabled by using ", ..." instead of "...". llvm-svn: 215408
2014-05-29Refactoring. Remove Owned method from Sema.Nikola Smiljanic1-2/+2
llvm-svn: 209812
2014-05-26[C++11] Use 'nullptr'. Sema edition.Craig Topper1-5/+5
llvm-svn: 209613
2014-04-23Initial implementation of -modules-earch-all option, for searching for ↵John Thompson1-1/+1
symbols in non-imported modules. llvm-svn: 206977
2014-03-12[C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper1-1/+1
class. llvm-svn: 203640
2014-03-02[C++11] Replace llvm::tie with std::tie.Benjamin Kramer1-5/+5
llvm-svn: 202639
2014-01-07Sort all the #include lines with LLVM's utils/sort_includes.py whichChandler Carruth1-1/+1
encodes the canonical rules for LLVM's style. I noticed this had drifted quite a bit when cleaning up LLVM, so wanted to clean up Clang as well. llvm-svn: 198686
2013-12-18Remove OpenCL-specific type keywords and specifiersAlp Toker1-8/+0
This commit kills off custom type specifier and keyword handling of OpenCL C data types. Although the OpenCL spec describes them as keywords, we can handle them more elegantly as predefined types. This should provide better error correction and code completion as well as simplifying the implementation. The primary intention is however to simplify the C/C++ parser and save some packed bits on AST structures that had been extended in r170432 just for OpenCL. llvm-svn: 197578
2013-08-17Refactor all diagnosing of TypoCorrections through a common function, inRichard Smith1-8/+4
preparation for teaching this function how to diagnose a correction that includes importing a module. llvm-svn: 188602
2013-06-20Fix one place I missed that was memcpy'ing TypeLocs in a way that messesEli Friedman1-0/+60
up alignment. Fixes utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp from the libc++ testsuite. llvm-svn: 184397
2013-06-07Re-commit r183466 with a fix to make the TypeLoc casting machinery workEli Friedman1-10/+7
correctly in the presence of qualified types. (I had to change the unittest because it was trying to cast a QualifiedTypeLoc to TemplateSpecializationTypeLoc.) llvm-svn: 183563
2013-06-07Reverts r183466: "Perform dynamic alignment computations..."Manuel Klimek1-7/+10
This introduces bugs in TemplateSpecializationTypeLoc's angle bracket locations. Regression test follows in a subsequent commit. llvm-svn: 183513
2013-06-07Perform dynamic alignment computations so that the data in TypeLocs isEli Friedman1-10/+7
correctly aligned. Not performing such computations led to misaligned loads, which crash on some platforms and are generally bad on other platforms. The implementation of TypeLocBuilder::pushImpl is rather messy; code using TypeLocBuilder accidentally assumes that partial TypeLocs are laid out like a complete TypeLoc. As a followup, I intend to work on fixing the TypeLocBuilder API to avoid exposing partial TypeLocs; this should substantially simplify the implemementation. Fixes PR16144. llvm-svn: 183466
2013-05-16First pass of semantic analysis for init-captures: check the initializer, buildRichard Smith1-2/+6
a FieldDecl from it, and propagate both into the closure type and the LambdaExpr. You can't do much useful with them yet -- you can't use them within the body of the lambda, because we don't have a representation for "the this of the lambda, not the this of the enclosing context". We also don't have support or a representation for a nested capture of an init-capture yet, which was intended to work despite not being allowed by the current standard wording. llvm-svn: 181985
2013-04-26Implement C++1y decltype(auto).Richard Smith1-0/+1
llvm-svn: 180610
2013-02-21Use None rather than Optional<T>() where possible.David Blaikie1-5/+4
llvm-svn: 175705
2013-02-20Include llvm::Optional in clang/Basic/LLVM.hDavid Blaikie1-21/+18
Post-commit CR feedback from Jordan Rose regarding r175594. llvm-svn: 175679
2013-02-18Replace TypeLoc llvm::cast support to be well-defined.David Blaikie1-1/+2
The TypeLoc hierarchy used the llvm::cast machinery to perform undefined behavior by casting pointers/references to TypeLoc objects to derived types and then using the derived copy constructors (or even returning pointers to derived types that actually point to the original TypeLoc object). Some context is in this thread: http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056804.html Though it's spread over a few months which can be hard to read in the mail archive. llvm-svn: 175462
2013-02-07Add OpenCL samplers as Clang builtin types and check sampler related ↵Guy Benyei1-0/+1
restrictions. llvm-svn: 174601
2013-02-02This patch makes "&Cls::purevfn" not an odr use. This isn't what the standardNick Lewycky1-1/+1
says, but that's a defect (to be filed). "Cls::purevfn()" is still an odr use. Also fixes a bug that caused us to not mark the function referenced just because we didn't want to mark it odr used. llvm-svn: 174242
2013-01-20Implement OpenCL event_t as Clang builtin type, including event_t related ↵Guy Benyei1-0/+1
OpenCL restrictions (OpenCL 1.2 spec 6.9) llvm-svn: 172973
2012-12-18Re-commit r170428 changes with Linux style file endings.Guy Benyei1-0/+6
Add OpenCL images as clang builtin types. llvm-svn: 170432
2012-12-18Revert changes from r170428, as I accidentally changed the line endings of ↵Guy Benyei1-6/+0
these files to Windows style. llvm-svn: 170431
2012-12-18Add OpenCL images as clang builtin types.Guy Benyei1-0/+6
llvm-svn: 170428
2012-12-04Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth1-3/+3
uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
2012-08-31Improved MSVC __interface support by adding first class support for it, ↵Joao Matos1-0/+1
instead of aliasing to "struct" which had some incorrect behaviour. Patch by David Robins. llvm-svn: 163013
2012-07-25PR12057: Allow variadic template pack expansions to cross lambda boundaries.Richard Smith1-25/+64
Rather than adding a ContainsUnexpandedParameterPack bit to essentially every AST node, we tunnel the bit directly up to the surrounding lambda expression when we reach a context where an unexpanded pack can not normally appear. Thus any statement or declaration within a lambda can now potentially contain an unexpanded parameter pack. llvm-svn: 160705
2012-07-18PR13386: When matching up parameters between a function template declarationRichard Smith1-7/+17
and a function template instantiation, if there's a parameter pack in the declaration and one at the same place in the instantiation, don't assume that the pack wasn't expanded -- it may have expanded to nothing. Instead, go ahead and check whether the parameter pack was expandable. We can do this as a side-effect of the work we'd need to do anyway, to find how many parameters were produced. llvm-svn: 160416
2012-04-04For PR11916: Add support for g++'s __int128 keyword. Unlike __int128_t, this isRichard Smith1-0/+1
a type specifier and can be combined with unsigned. This allows libstdc++4.7 to be used with clang in c++98 mode. Several other changes are still required for libstdc++4.7 to work with clang in c++11 mode. llvm-svn: 153999
2012-03-11Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie1-2/+2
(Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
2012-03-10Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr toJohn McCall1-9/+0
track whether the referenced declaration comes from an enclosing local context. I'm amenable to suggestions about the exact meaning of this bit. llvm-svn: 152491
2012-03-06Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,Ted Kremenek1-0/+16
NSNumber, and boolean literals. This includes both Sema and Codegen support. Included is also support for new Objective-C container subscripting. My apologies for the large patch. It was very difficult to break apart. The patch introduces changes to the driver as well to cause clang to link in additional runtime support when needed to support the new language features. Docs are forthcoming to document the implementation and behavior of these features. llvm-svn: 152137
2012-03-01Fix the isReferenced bit on parameters in a couple of edge cases. PR12153.Eli Friedman1-0/+2
llvm-svn: 151837
2012-02-22ArrayRef-icize the function arguments.Bill Wendling1-1/+1
llvm-svn: 151151
2012-01-31Make the callback object to Sema::CorrectTypo mandatory.Kaelyn Uhrain1-1/+1
llvm-svn: 149451
2012-01-20More dead code removal (using -Wunreachable-code)David Blaikie1-3/+0
llvm-svn: 148577
2012-01-13Convert SemaTemplate*.cpp to pass a callback object to CorrectTypo.Kaelyn Uhrain1-13/+24
The change to SemaTemplateVariadic.cpp improves the typo correction results in certain situations, while the change to SemaTemplate.cpp does not change existing behavior. llvm-svn: 148155
2011-10-25Check for unexpanded parameter packs in the name that guards aDouglas Gregor1-13/+34
Microsoft __if_exists/__if_not_exists statement. Also note that we weren't traversing DeclarationNameInfo *at all* within the RecursiveASTVisitor, which would be rather fatal for variadic templates. llvm-svn: 142906
2011-10-14Provide half floating point support as a storage only type.Anton Korobeynikov1-0/+1
Lack of half FP was a regression compared to llvm-gcc. llvm-svn: 142016
2011-10-06Support for C1x _Atomic specifier (see testcase). This is primarily being ↵Eli Friedman1-1/+2
committed at the moment to help support C++0x <atomic>, but it should be a solid base for implementing the full specification of C1x _Atomic. Thanks to Jeffrey Yasskin for the thorough review! llvm-svn: 141330
2011-09-22ArrayRef-ifying the UnexpandedParameterPacks passed to ↵David Blaikie1-9/+10
Sema::CheckParameterPacksForExpansion llvm-svn: 140290
2011-07-23remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner1-16/+16
LLVM.h imports them into the clang namespace. llvm-svn: 135852
2011-06-28Add support for C++ namespace-aware typo correction, e.g., correctingDouglas Gregor1-7/+9
vector<int> to std::vector<int> Patch by Kaelyn Uhrain, with minor tweaks + PCH support from me. Fixes PR5776/<rdar://problem/8652971>. Thanks Kaelyn! llvm-svn: 134007
2011-05-24Implement a new type node, UnaryTransformType, designed to represent aAlexis Hunt1-1/+1
type that turns one type into another. This is used as the basis to implement __underlying_type properly - with TypeSourceInfo and proper behavior in the face of templates. llvm-svn: 132017
2011-05-19Implement __underlying_type for libc++.Alexis Hunt1-1/+2
llvm-svn: 131633