aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/IdentifierTable.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-10-04Add -f[no-]declspec to control recognition of __declspec as a keywordSaleem Abdulrasool1-4/+1
In versions of clang prior to r238238, __declspec was recognized as a keyword in all modes. It was then changed to only be enabled when Microsoft or Borland extensions were enabled (and for CUDA, as a temporary measure). There is a desire to support __declspec in Playstation code, and possibly other environments. This commit adds a command-line switch to allow explicit enabling/disabling of the recognition of __declspec as a keyword. Recognition is enabled by default in Microsoft, Borland, CUDA, and PS4 environments, and disabled in all other environments. Patch by Warren Ristow! llvm-svn: 249279
2015-07-30Add support for System z vector language extensionsUlrich Weigand1-1/+2
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
2015-07-07Implement the Objective-C __kindof type qualifier.Douglas Gregor1-1/+3
The __kindof type qualifier can be applied to Objective-C object (pointer) types to indicate id-like behavior, which includes implicit "downcasting" of __kindof types to subclasses and id-like message-send behavior. __kindof types provide better type bounds for substitutions into unspecified generic types, which preserves more type information. llvm-svn: 241548
2015-07-01[modules] Before checking whether the controlling macro of a header is defined,Richard Smith1-2/+0
update the identifier in case we've imported a definition of the macro (and thus the contents of the header) from a module. Also fold ExternalIdentifierLookup into ExternalPreprocessorSource; it no longer makes sense to keep these separate now that the only user of the former also needs the latter. llvm-svn: 241137
2015-06-24Replace __double_underscored type nullability qualifiers with ↵Douglas Gregor1-4/+5
_Uppercase_underscored Addresses a conflict with glibc's __nonnull macro by renaming the type nullability qualifiers as follows: __nonnull -> _Nonnull __nullable -> _Nullable __null_unspecified -> _Null_unspecified This is the major part of rdar://problem/21530726, but does not yet provide the Darwin-specific behavior for the old names. llvm-svn: 240596
2015-06-22Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko1-1/+1
llvm-svn: 240353
2015-06-22Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko1-1/+1
The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
2015-06-20Suppress bogus gcc -Wreturn-type warnings.Nico Weber1-0/+1
llvm-svn: 240199
2015-06-19Extend type nullability qualifiers for Objective-C.Douglas Gregor1-0/+14
Introduce context-sensitive, non-underscored nullability specifiers (nonnull, nullable, null_unspecified) for Objective-C method return types, method parameter types, and properties. Introduce Objective-C-specific semantics, including computation of the nullability of the result of a message send, merging of nullability information from the @interface of a class into its @implementation, etc . This is the Objective-C part of rdar://problem/18868820. llvm-svn: 240154
2015-06-05[Concepts] lex keywords: concept and requiresHubert Tong1-1/+3
Summary: This patch enables lexing of `concept` and `requires` as keywords. Further changes which add messages for future keyword compat are to follow. Test Plan: Testing of C++14 + Concepts TS mode is added to `test/Lexer/keywords_test.cpp`, which expects that the new keywords are enabled under said mode. Reviewers: faisalv, fraggamuffin, rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D10233 llvm-svn: 239128
2015-05-26__declspec is not a core Clang language extension. Instead, require ↵Aaron Ballman1-0/+6
-fms-extensions or -fborland to enable the language extension. Note: __declspec is also temporarily enabled when compiling for a CUDA target because there are implementation details relying on __declspec(property) support currently. When those details change, __declspec should be disabled for CUDA targets. llvm-svn: 238238
2015-05-14Generalize future keyword compat diagnostics.Richard Smith1-2/+2
This, in preparation for the introduction of more new keywords in the implementation of the C++ language, generalizes the support for future keyword compat diagnostics (e.g., diag::warn_cxx11_keyword) by extending the applicability of the relevant property in IdentifierTable with appropriate renaming. Patch by Hubert Tong! llvm-svn: 237332
2015-05-11Give isCompatibleWithMSVC a better interfaceDavid Majnemer1-1/+1
We now use an enum which maps the marketing name (almost always a year) to the major version number. llvm-svn: 236967
2015-03-18OpenCL: CL2.0 atomic typesAnastasia Stulova1-4/+11
OpenCL C Spec v2.0 Section 6.13.11 - Made c11 _Atomic being not accepted for OpenCL - Implemented CL2.0 atomics by aliasing them to the corresponding c11 atomic types using implicit typedef - Added diagnostics for atomics Khronos extension enabling llvm-svn: 232631
2015-03-18MSVC Compat: Permit char16_t, char32_t and _Atomic when targeting > 2013David Majnemer1-3/+4
We disabled support for _Atomic because the STL had name conflicts, they've been resolved in 2015. Similarly, reenable char16_t and char32_t. llvm-svn: 232611
2014-12-11Emit warning if define or undef reserved identifier or keyword.Serge Pavlov1-2/+27
Recommit of r223114, reverted in r223120. llvm-svn: 224012
2014-12-02Reverted r223114, it caused failure on on clang-native-arm-cortex-a9.Serge Pavlov1-27/+2
llvm-svn: 223120
2014-12-02Emit warning if define or undef reserved identifier or keyword.Serge Pavlov1-2/+27
Summary: This change implements warnings if macro name is identical to a keyword or reserved identifier. The warnings are different depending on the "danger" of the operation. Defining macro that replaces a keyword is on by default. Other cases produce warning that is off by default but can be turned on using option -Wreserved-id-macro. This change fixes PR11488. Reviewers: rnk Reviewed By: rnk Subscribers: rnk, cfe-commits Differential Revision: http://reviews.llvm.org/D6194 llvm-svn: 223114
2014-10-29Use enumerators instead of hardcoded integers when we decide if keyword is ↵Serge Pavlov1-28/+38
enabled. llvm-svn: 220849
2014-09-09Objective-C. Under a special flag, -Wcstring-format-directive,Fariborz Jahanian1-0/+27
off by default, issue a warning if %s directive is used in certain CF/NS formatting APIs, to assist user in deprecating use of such %s in these APIs. rdar://18182443 llvm-svn: 217467
2014-08-22Objective-C. Warn if user has made explicit callFariborz Jahanian1-0/+1
to +initilize as this results in an extra call to this method. rdar://16628028 llvm-svn: 216271
2014-05-10Decouple ExprCXX.h and DeclCXX.h and clean up includes a bit.Benjamin Kramer1-1/+3
Required pulling LambdaExpr::Capture into its own header. No functionality change. llvm-svn: 208470
2014-05-08[C++11] Use 'nullptr'.Craig Topper1-4/+4
llvm-svn: 208280
2014-03-18Fix a typo in r204164 that made *all* keywords available in OpenCL mode.Richard Smith1-1/+1
llvm-svn: 204196
2014-03-18Creating a printing policy for "half":Yunzhong Gao1-0/+2
Since "half" is an OpenCL keyword and clang accepts __fp16 as an extension for other languages, error messages and metadata (and hence debug info) should refer to the half-precision floating point as "__fp16" instead of "half" when compiling for non-OpenCL languages. This patch creates a new printing policy for half in a similar manner to what is done for bool and wchar_t. Differential Revision: http://llvm-reviews.chandlerc.com/D2952 llvm-svn: 204164
2014-03-11[C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper1-1/+1
class. llvm-svn: 203537
2014-01-14Rename language option MicrosoftMode to MSVCCompatAlp Toker1-2/+2
There's been long-standing confusion over the role of these two options. This commit makes the necessary changes to differentiate them clearly, following up from r198936. MicrosoftExt (aka. fms-extensions): Enable largely unobjectionable Microsoft language extensions to ease portability. This mode, also supported by gcc, is used for building software like FreeBSD and Linux kernel extensions that share code with Windows drivers. MSVCCompat (aka. -fms-compatibility, formerly MicrosoftMode): Turn on a special mode supporting 'heinous' extensions for drop-in compatibility with the Microsoft Visual C++ product. Standards-compilant C and C++ code isn't guaranteed to work in this mode. Implies MicrosoftExt. Note that full -fms-compatibility mode is currently enabled by default on the Windows target, which may need tuning to serve as a reasonable default. See cfe-commits for the full discourse, thread 'r198497 - Move MS predefined type_info out of InitializePredefinedMacros' No change in behaviour. llvm-svn: 199209
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
2014-01-03Fixed a FIXME; created a print method for Selectors that accepts a ↵Aaron Ballman1-0/+4
raw_ostream, and started using it in places it made sense. No functional changes intended, just API cleanliness. llvm-svn: 198428
2013-10-10ObjectiveC migrator: For 'default' and 'shared' family ofFariborz Jahanian1-3/+3
methods, infer their self's type as their result type. // rdar://15145218 llvm-svn: 192377
2013-10-07ObjectiveC migrator: A typical implementation ofFariborz Jahanian1-1/+0
'default' methods in Foundation does not infer 'instancetype' for methods' result type. // rdar://15145218 llvm-svn: 192129
2013-09-18ObjectiveC migrator: For consistency, also inferFariborz Jahanian1-0/+2
'instancetype' for known family of methods with related result type; such as 'init' methods. // rdar://14987948 llvm-svn: 190956
2013-08-29ObjectiveC migrator: remove dead code.Fariborz Jahanian1-9/+1
llvm-svn: 189592
2013-08-02ObjectiveC migrator: Add another family of factory Fariborz Jahanian1-0/+5
methods which can be migrated to instancetype. llvm-svn: 187672
2013-08-02ObjectiveC migrator: Fixes public buildbot failures,Fariborz Jahanian1-8/+0
in my previous patch which was reverted in r187657 llvm-svn: 187661
2013-08-02revert patch I added in r187655. It still breaks publicFariborz Jahanian1-0/+8
buildbot. llvm-svn: 187657
2013-08-02ObjectiveC migration. Check-in patch reverted in r187634.Fariborz Jahanian1-8/+0
Also removed check for "NS" prefix for class name. llvm-svn: 187655
2013-08-02Revert "ObjectiveC migrator. Migrate to instancetype return type for mehods ↵Rafael Espindola1-0/+8
with certain prefix selector matching their class names' suffix." This reverts commit r187626. It is breaking the bots. llvm-svn: 187634
2013-08-01ObjectiveC migrator. Migrate to instancetype return typeFariborz Jahanian1-8/+0
for mehods with certain prefix selector matching their class names' suffix. llvm-svn: 187626
2013-07-24Objective-C migrator: some cleanup.Fariborz Jahanian1-0/+3
Expose static type of init/alloc/retain with instance type as well. Ad-hoc cases are coming next. llvm-svn: 187068
2013-07-23ObjC migrator: more knobs toward doingFariborz Jahanian1-1/+1
instancetype migration. llvm-svn: 187000
2013-07-23ObjC migrator: Define family of methodsFariborz Jahanian1-0/+33
which are candidate for migrating to 'instancetype'. wip. llvm-svn: 186981
2013-06-10cleanup (address some more review comments for r183474):Adrian Prantl1-6/+6
- reduce default buffer size to 64, which will still be large enough to hold any property names found in the wild. - get rid of the /*static*/ comments. llvm-svn: 183697
2013-06-07address some comments on r183474:Adrian Prantl1-10/+14
- factor the name construction part out from constructSetterName - rename constructSetterName to the more appropriate constructSetterSelector no functionality change intended. rdar://problem/14035789 llvm-svn: 183582
2013-04-17[Modules] Use global index to improve typo correction performanceArgyrios Kyrtzidis1-1/+1
Typo correction for an unqualified name needs to walk through all of the identifier tables of all modules. When we have a global index, just walk its identifier table only. rdar://13425732 llvm-svn: 179730
2013-02-09Remove some stray uses of <ctype.h> functions.Jordan Rose1-1/+1
These are causing assertions on some MSVC builds. llvm-svn: 174805
2013-02-08Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.Jordan Rose1-4/+3
Nearly all of these changes are one-to-one replacements; the few that aren't have to do with custom identifier validation. llvm-svn: 174768
2013-01-02s/CXX0X/CXX11/g, except for __GNU_EXPERIMENTAL_CXX0X__, and update a few ↵Richard Smith1-3/+3
nearby 'C++0x' comments. llvm-svn: 171372
2013-01-02s/CPlusPlus0x/CPlusPlus11/gRichard Smith1-1/+1
llvm-svn: 171367
2012-12-11Use @import rather than @__experimental_modules_import, since theDouglas Gregor1-1/+1
latter is rather a mess to type. llvm-svn: 169919