summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/DeclSpec.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix a layering oddity by passing Sema to DeclSpec::Finish instead of ↵Craig Topper2015-11-151-47/+40
| | | | | | DiagnosticsEngine and Preprocessor. Everything the preprocessor was being used for can be acquired from Sema. llvm-svn: 253158
* Move diagnostics from Parse to Sema to remove Sema's dependency on ↵Craig Topper2015-11-141-1/+0
| | | | | | ParserDiagnostic.h diagnostics. llvm-svn: 253143
* Fix indentation. NFCCraig Topper2015-11-141-6/+6
| | | | llvm-svn: 253142
* Merge some similar diagnostics using %select.Craig Topper2015-11-141-4/+2
| | | | llvm-svn: 253136
* Add support for GCC's '__auto_type' extension, per the GCC manual:Richard Smith2015-11-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | https://gcc.gnu.org/onlinedocs/gcc/Typeof.html Differences from the GCC extension: * __auto_type is also permitted in C++ (but only in places where it could appear in C), allowing its use in headers that might be shared across C and C++, or used from C++98 * __auto_type can be combined with a declarator, as with C++ auto (for instance, "__auto_type *p") * multiple variables can be declared in a single __auto_type declaration, with the C++ semantics (the deduced type must be the same in each case) This patch also adds a missing restriction on applying typeof to a bit-field, which GCC has historically rejected in C (due to lack of clarity as to whether the operand should be promoted). The same restriction also applies to __auto_type in C (in both GCC and Clang). This also fixes PR25449. Patch by Nicholas Allegra! llvm-svn: 252690
* Replace double-negated !SourceLocation.isInvalid() with ↵Yaron Keren2015-10-031-1/+1
| | | | | | SourceLocation.isValid(). llvm-svn: 249228
* PR24595: Ignore calling convention modifiers for structors in MS ABI.Andrey Bokhanko2015-09-141-0/+5
| | | | | | | | | | MS compiler ignores calling convention modifiers for structors. This patch makes clang do the same (for MS ABI). This fixes PR24595 and makes vswriter.h header (from Windows SDK 8.1) compilable. Differential Revision: http://reviews.llvm.org/D12402 llvm-svn: 247619
* Modify DeclaratorChuck::getFunction to be passed an Exception Specification ↵Nathan Wilson2015-08-261-2/+3
| | | | | | | | | | | | | | | | | SourceRange Summary: - Store the exception specification range's begin and end SourceLocation in DeclaratorChuck::FunctionTypeInfo. These SourceLocations can be used in a FixItHint Range. - Add diagnostic; function concept having an exception specification. Reviewers: hubert.reinterpretcast, fraggamuffin, faisalv, aaron.ballman, rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D11789 llvm-svn: 246005
* Add support for System z vector language extensionsUlrich Weigand2015-07-301-6/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The z13 vector facility has an associated language extension, closely modeled on AltiVec/VSX. The main differences are: - vector long, vector float and vector pixel are not supported - vector long long and vector double are supported (like VSX) - comparison operators return a vector rather than a scalar integer - shift operators behave like the OpenCL shift operators - vector bool is only supported as argument to certain operators; some operators allow mixing a bool with a non-bool vector This patch adds clang support for the extension. It is closely modelled on the AltiVec support. Similarly to the -faltivec option, there's a new -fzvector option to enable the extensions (as well as an -mzvector alias for compatibility with GCC). There's also a separate LangOpt. The extension as implemented here is intended to be compatible with the -mzvector extension recently implemented by GCC. Based on a patch by Richard Sandiford. Differential Revision: http://reviews.llvm.org/D11001 llvm-svn: 243642
* C++ support for Objective-C lightweight generics.Douglas Gregor2015-07-071-25/+0
| | | | | | | | | | | | | | | | | | | Teach C++'s tentative parsing to handle specializations of Objective-C class types (e.g., NSArray<NSString *>) as well as Objective-C protocol qualifiers (id<NSCopying>) by extending type-annotation tokens to handle this case. As part of this, remove Objective-C protocol qualifiers from the declaration specifiers, which never really made sense: instead, provide Sema entry points to make them part of the type annotation token. Among other things, this properly diagnoses bogus types such as "<NSCopying> id" which should have been written as "id <NSCopying>". Implements template instantiation support for, e.g., NSArray<T>* in C++. Note that parameterized classes are not templates in the C++ sense, so that cannot (for example) be used as a template argument for a template template parameter. Part of rdar://problem/6294649. llvm-svn: 241545
* Handle Objective-C type arguments.Douglas Gregor2015-07-071-0/+11
| | | | | | | | | | | | | | | | | | | | | Objective-C type arguments can be provided in angle brackets following an Objective-C interface type. Syntactically, this is the same position as one would provide protocol qualifiers (e.g., id<NSCopying>), so parse both together and let Sema sort out the ambiguous cases. This applies both when parsing types and when parsing the superclass of an Objective-C class, which can now be a specialized type (e.g., NSMutableArray<T> inherits from NSArray<T>). Check Objective-C type arguments against the type parameters of the corresponding class. Verify the length of the type argument list and that each type argument satisfies the corresponding bound. Specializations of parameterized Objective-C classes are represented in the type system as distinct types. Both specialized types (e.g., NSArray<NSString *> *) and unspecialized types (NSArray *) are represented, separately. llvm-svn: 241542
* [CONCEPTS] Parsing of concept keywordHubert Tong2015-06-301-0/+12
| | | | | | | | | | | | | | | | | | Summary: This change adds parsing for the concept keyword in a declaration and tracks the location. Diagnostic testing added for invalid use of concept keyword. Reviewers: faisalv, fraggamuffin, rsmith, hubert.reinterpretcast Reviewed By: rsmith, hubert.reinterpretcast Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D10528 Patch by Nathan Wilson! llvm-svn: 241060
* Add check for kind of UnqualifiedId in Declarator::isStaticMember()Petar Jovanovic2015-03-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Method CXXMethodDecl::isStaticOverloadedOperator expects Operator field from the struct OperatorFunctionId, which is a member of the union in the class UnqualifiedId. If the kind of UnqualifiedId is not checked, there is no guarantee that the value that this method receives will be correct, because it can be the value of another union member and not OperatorFunctionId. This bug manifests itself when running make check-all on mips64 BE. This fix resolves the following regression tests: Clang :: CXX/special/class.dtor/p9.cpp Clang :: CodeGenCXX/2006-09-12-OpaqueStructCrash.cpp Clang :: CodeGenCXX/ctor-dtor-alias.cpp Clang :: CodeGenCXX/debug-info-windows-dtor.cpp Clang :: CodeGenCXX/dllexport-members.cpp Clang :: CodeGenCXX/dllexport.cpp Patch by Violeta Vukobrat. Differential Revision: http://reviews.llvm.org/D8437 llvm-svn: 233508
* Diagnose declspecs occuring after virt-specifier-seq and generate fixit hintsEhsan Akhgari2015-03-251-0/+3
| | | | | | | | | | | | Summary: This fixes PR22075. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6828 llvm-svn: 233160
* Revert "Diagnose declspecs occuring after virt-specifier-seq and generate ↵Ehsan Akhgari2015-03-241-3/+0
| | | | | | | | fixit hints" This reverts commit 2131e63e2fdff7c831ab3bfe31facf2e3ebab03d. llvm-svn: 233074
* Diagnose declspecs occuring after virt-specifier-seq and generate fixit hintsEhsan Akhgari2015-03-241-0/+3
| | | | | | | | | | | | Summary: This fixes PR22075. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6828 llvm-svn: 233069
* Add builtins for the 64-bit vector integer arithmetic instructions added in ↵Kit Barton2015-03-111-1/+3
| | | | | | | | | | POWER8. These are the Clang-related changes for the instructions added to LLVM in http://reviews.llvm.org/D7959. Phabricator review: http://reviews.llvm.org/D8041 llvm-svn: 231931
* [PowerPC]Activate "vector bool long long" (and alternate spellings) as a ↵Bill Seurer2015-03-031-2/+7
| | | | | | | | | | | | valid type for Altivec support for Power. There are two test case updates for very basic testing. While I was editing cxx-altivec.cpp I also updated it to better match some other changes in altivec.c. Note: "vector bool long" was not also added because its use is considered deprecated. http://reviews.llvm.org/D7235 llvm-svn: 231118
* [OpenCL] Generic address space has been added in OpenCL v2.0.Anastasia Stulova2014-11-261-2/+2
| | | | | | | | | | To support it in the frontend, the following has been added: - generic address space type attribute; - documentation for the OpenCL address space attributes; - parsing of __generic(generic) keyword; - test code for the parser and diagnostics. llvm-svn: 222831
* PR21437, final part of DR1330: delay-parsing of exception-specifications. ThisRichard Smith2014-11-131-0/+8
| | | | | | | is a re-commit of Doug's r154844 (modernized and updated to fit into current Clang). llvm-svn: 221918
* [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
* Add RestrictQualifierLoc to DeclaratorChunk::FunctionTypeInfoHal Finkel2014-10-201-0/+3
| | | | | | | | | | | | | | Clang supports __restrict__ as a function qualifier, but DeclaratorChunk::FunctionTypeInfo lacked a field to track the qualifier's source location (as we do with volatile, etc.). This was the subject of a FIXME in GetFullTypeForDeclarator (in SemaType.cpp). This should also prove useful as we add more warnings regarding questionable uses of the restrict qualifier. There is no significant functional change (except for an improved source range associated with the err_invalid_qualified_function_type diagnostic fixit generated by GetFullTypeForDeclarator). llvm-svn: 220215
* -ms-extensions: Implement __super scope specifier (PR13236).Nikola Smiljanic2014-09-261-0/+12
| | | | | | | | | We build a NestedNameSpecifier that records the CXXRecordDecl in which __super appeared. Name lookup is performed in all base classes of the recorded CXXRecordDecl. Use of __super is allowed only inside class and member function scope. llvm-svn: 218484
* Move __vector long deprecation checking into DeclSpec::FinishHal Finkel2014-08-241-6/+3
| | | | | | | | | | | | __vector long is deprecated, but __vector long long is not. As a result, we cannot check for __vector long (to issue the deprecation warning) as we parse the type because we need to know how many 'long's we have first. DeclSpec::Finish seems like a more-appropriate place to perform the check (which places it with several other similar Altivec vector checks). Fixes PR20720. llvm-svn: 216342
* [C++11] Use 'nullptr'.Craig Topper2014-06-091-6/+6
| | | | llvm-svn: 210448
* Sema: Implement DR477David Majnemer2014-04-301-2/+29
| | | | | | | | | | | | Summary: Friend declarations shouldn't mention explicit or virtual. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3562 llvm-svn: 207682
* argument -> parameter terminology fixes for FunctionTypeInfoAlp Toker2014-02-261-14/+14
| | | | | | This is a continuation of r199686. llvm-svn: 202307
* Fix for PR9812: warn about bool instead of _Bool.Erik Verbruggen2014-01-151-33/+45
| | | | llvm-svn: 199311
* Downgrade bogus ExtWarn on duplicate 'friend' specifier to a Warning, and add aRichard Smith2014-01-101-2/+13
| | | | | | Warning for a duplicate 'constexpr' specifier. llvm-svn: 198956
* Remove OpenCL-specific type keywords and specifiersAlp Toker2013-12-181-16/+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
* PR9547: If we're parsing a simple-declaration that contains a tag definition,Richard Smith2013-11-191-0/+6
| | | | | | | | and we see an ill-formed declarator that would probably be well-formed if the tag definition were just missing a semicolon, use that as the diagnostic instead of producing some other mysterious error. llvm-svn: 195163
* Warn on duplicate function specifierSerge Pavlov2013-11-131-12/+56
| | | | | | | | | This patch fixes PR8264. Duplicate qualifiers already are diagnozed, now the same diagnostics is issued for duplicate function specifiers. Differential Revision: http://llvm-reviews.chandlerc.com/D2025 llvm-svn: 194559
* [-fms-extensions] Permit 'override' in C++98 and 'sealed' as a synonym for ↵David Majnemer2013-10-181-0/+2
| | | | | | | | | | | | | | 'final' Summary: Some MS headers use these features. Reviewers: rnk, rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1948 llvm-svn: 192936
* [ms-cxxabi] Fix the calling convention for operator new in recordsReid Kleckner2013-10-081-0/+8
| | | | | | | | | | | | | | | | | | Summary: Operator new, new[], delete, and delete[] are all implicitly static when declared inside a record. CXXMethodDecl already knows this, but we need to account for that before we pick the calling convention for the function type. Fixes PR17371. Reviewers: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1761 llvm-svn: 192150
* "bool" should be a context-sensitive keyword in Altivec mode.Bill Schmidt2013-07-031-0/+14
| | | | | | | | | | | | | | | | | PR16456 reported that Clang implements a hybrid between AltiVec's "Keyword and Predefine Method" and its "Context Sensitive Keyword Method," where "bool" is always a keyword, but "vector" and "pixel" are context-sensitive keywords. This isn't permitted by the AltiVec spec. For consistency with gcc, this patch implements the Context Sensitive Keyword Method for bool, and stops treating true and false as keywords in Altivec mode. The patch removes KEYALTIVEC as a trigger for defining these keywords in include/clang/Basic/TokenKinds.def, and adds logic for "vector bool" that mirrors the existing logic for "vector pixel." The test case is taken from the bug report. llvm-svn: 185580
* Don't mark a type specifier as "owned" if there is no declaration to own.Douglas Gregor2013-05-141-1/+1
| | | | | | | This simplifies error recovery elsewhere, eliminating the crash in <rdar://problem/13853540>. llvm-svn: 181846
* Fix PR15845: apparently MSVC does not support implicit int in C++ mode.Richard Smith2013-04-301-2/+1
| | | | llvm-svn: 180822
* Silence a silly sign compare warning from GCC.Benjamin Kramer2013-04-271-1/+1
| | | | llvm-svn: 180673
* Implement C++1y decltype(auto).Richard Smith2013-04-261-2/+41
| | | | llvm-svn: 180610
* Parsing support for thread_local and _Thread_local. We give them the sameRichard Smith2013-04-121-16/+64
| | | | | | semantics as __thread for now. llvm-svn: 179424
* Add 178663 back.Rafael Espindola2013-04-031-11/+1
| | | | | | | | | | | http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb went back green before it processed the reverted 178663, so it could not have been the culprit. Revert "Revert 178663." This reverts commit 4f8a3eb2ce5d4ba422483439e20c8cbb4d953a41. llvm-svn: 178682
* Revert 178663.Rafael Espindola2013-04-031-1/+11
| | | | | | | | | | Looks like it broke http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb Revert "Don't compute a patched/semantic storage class." This reverts commit 8f187f62cb0487d31bc4afdfcd47e11fe9a51d05. llvm-svn: 178681
* Don't compute a patched/semantic storage class.Rafael Espindola2013-04-031-11/+1
| | | | | | | | | | | For variables and functions clang used to store two storage classes. The one "as written" in the code and a patched one, which, for example, propagates static to the following decls. This apparently is from the days clang lacked linkage computation. It is now redundant and this patch removes it. llvm-svn: 178663
* Support C11 _Atomic type qualifier. This is more-or-less just syntactic ↵Richard Smith2013-03-281-5/+11
| | | | | | sugar for the _Atomic type specifier. llvm-svn: 178210
* Add OpenCL samplers as Clang builtin types and check sampler related ↵Guy Benyei2013-02-071-0/+2
| | | | | | restrictions. llvm-svn: 174601
* Implement OpenCL event_t as Clang builtin type, including event_t related ↵Guy Benyei2013-01-201-0/+2
| | | | | | OpenCL restrictions (OpenCL 1.2 spec 6.9) llvm-svn: 172973
* Parsing support for C11's _Noreturn keyword. No semantics yet.Richard Smith2013-01-171-1/+9
| | | | llvm-svn: 172761
* Fix Cast CodeDavid Greene2013-01-151-2/+3
| | | | | | | Eliminate a cast and resulting cast-qual warning by using a temporary as the target of memcpy. llvm-svn: 172557
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-2/+2
| | | | llvm-svn: 171367
* Add comments back that were accidentally removed in r170933.Chad Rosier2012-12-211-0/+2
| | | | llvm-svn: 170938
OpenPOWER on IntegriCloud