summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser/MicrosoftExtensions.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Ignore the "novtable" declspec when not using the Microsoft C++ ABI.Bob Wilson2015-07-201-1/+1
| | | | | | | | | | | | | | Clang used to silently ignore __declspec(novtable). It is implemented now, but leaving the vtable uninitialized does not work when using the Itanium ABI, where the class layout for complex class hierarchies is stored in the vtable. It might be possible to honor the novtable attribute in some simple cases and either report an error or ignore it in more complex situations, but it’s not clear if that would be worthwhile. There is also value in having a simple and predictable behavior, so this changes clang to simply ignore novtable when not using the Microsoft C++ ABI. llvm-svn: 242730
* Revert "parser: wordsmith diagnostic message" and "parser: diagnose empty ↵David Majnemer2015-07-081-0/+7
| | | | | | | | | | | | attribute blocks" This reverts commit r239846 and r239879. They caused clang's -fms-extensions behavior to incorrectly parse lambdas and includes a testcase to ensure we don't regress again. This issue was found in PR24027. llvm-svn: 241668
* [MS ABI] Correctly associate align attrs before the class-keyDavid Majnemer2015-04-191-0/+9
| | | | | | | | | | | | __declspec(align(...)) is unlike all other attributes in that it is not applied to a variable if it appears before the class-key. If the tag in question isn't part of a variable declaration, it is not ignored. Instead, the alignment attribute is applied to the tag. This fixes PR18024. llvm-svn: 235272
* Sema: __assume with side effects shouldn't result in invalid AST nodesDavid Majnemer2015-02-261-1/+17
| | | | | | | | We'd diagnose an __assume expression which contained a function call. This would result in us wrongly returning ExprError, causing mysterious failures later on. llvm-svn: 230597
* MS ABI: Implement support for 'novtable'David Majnemer2015-02-021-1/+1
| | | | | | | | | | It is common for COM interface classes to be marked as 'novtable' to tell the compiler that constructors and destructors should not reference virtual function tables. This commit implements this feature in clang. llvm-svn: 227796
* [Objective-C]. Modern property getters have side-effects.Fariborz Jahanian2014-12-181-1/+1
| | | | | | | | So, place warning about property getter should not be used for side-effect under its own group so warning can be turned off. rdar://19137815 llvm-svn: 224479
* Parse: MS property members cannot have an in-class initializerDavid Majnemer2014-12-131-0/+1
| | | | | | | | | We would crash trying to treat a property member as a field. These shoudl be forbidden anyway, reject programs which contain them. This fixes PR21840. llvm-svn: 224193
* Parse qualifiers after comma in declarator lists as a Microsoft extensionNico Rieck2014-12-041-0/+8
| | | | | | MSVC parses and ignores these with a warning. llvm-svn: 223413
* c++11 patch to issue warning on missing 'override' on Fariborz Jahanian2014-10-271-2/+2
| | | | | | | overriding methods. Patch review by Richard Smith. rdar://18295240 llvm-svn: 220703
* Revert r218925 - "Patch to warn if 'override' is missing"Alexander Potapenko2014-10-031-2/+2
| | | | | | | | | | | | | | | | | | | | 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-2/+2
| | | | | | | | | | | | 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
* -fms-extensions: Alias _intNN to __intNNReid Kleckner2014-08-221-0/+5
| | | | | | | | | | Fixes build for SPEC 2000 CPU. MSVC disables these aliases under /Za, which enables stricter standards compliance. We don't currently have any way to disable them. Patch by Kevin Smith! llvm-svn: 216270
* Sema: Permit nullptr template args in MSVC compat modeDavid Majnemer2014-08-141-1/+5
| | | | | | This fixes a regression I caused back in r211766. llvm-svn: 215609
* Giving this test a triple to satisfy the build bots.Aaron Ballman2014-07-061-1/+1
| | | | llvm-svn: 212418
* The MicrosoftExtensions.c test file should not rely on -x objective-c++. ↵Aaron Ballman2014-07-061-0/+25
| | | | | | Removed that from the RUN line, fixed obvious C++isms in the code, and moved some C++ tests into MicrosoftExtensions.cpp instead. As a drive-by, changed the line endings for MicrosoftExtensions.c to be LF instead of CRLF. llvm-svn: 212417
* Don't allow dllimport variables in constant initializersHans Wennborg2014-06-251-1/+1
| | | | | | | | | | | | | | | | | This is a follow-up to David's r211677. For the following code, we would end up referring to 'foo' in the initializer for 'arr', and then fail to link, because 'foo' is dllimport and needs to be accessed through the __imp_?foo. __declspec(dllimport) extern const char foo[]; const char* f() { static const char* const arr[] = { foo }; return arr[0]; } Differential Revision: http://reviews.llvm.org/D4299 llvm-svn: 211736
* Split tests for __if_exists out into their own fileReid Kleckner2014-06-251-97/+0
| | | | llvm-svn: 211649
* Preprocessor: make C++ operator names as macro identifiers a compatible ↵Alp Toker2014-05-311-0/+3
| | | | | | | | | | | extension With recent changes, this is now a compatible language extension and can be safely enabled with -ms-extensions instead of requiring the full -ms-compatibility MSVC drop-in mode. As such we can now also emit an extension warning under -Wmicrosoft to help users port their code. llvm-svn: 209978
* Implement the MS extension __identifier properly: take a token and strip it ofRichard Smith2014-03-151-0/+23
| | | | | | its keywordliness. llvm-svn: 203987
* Correct hyphenations in comments and assert messagesAlp Toker2013-12-051-8/+8
| | | | | | | This patch tries to avoid unrelated changes other than fixing a few hyphen-related ambiguities in nearby lines. llvm-svn: 196466
* __declspec(uuid) is only allowed on a class according to MSDN; this makes ↵Aaron Ballman2013-11-241-1/+1
| | | | | | the semantic checking consistent with what the attribute specifies in Attr.td. Also adds a test case. llvm-svn: 195579
* -Wmicrosoft: Don't warn on non-inline pure virtual method definitionsReid Kleckner2013-10-081-0/+9
| | | | | | | | | | | | | | | MSVC and clang with -fms-extensions allow pure virtual methods to be defined inline after the "= 0" tokens. Clang warns on these because it is not standard, but incorrectly warns on out-of-line definitions, which are standard. With this change, clang will only warn on inline definitions of pure virtual methods. Fixes some self-host warnings on out-of-line definitions of pure virtual destructors. llvm-svn: 192244
* AST: Handle multidimensional arrays inside of __uuidof()David Majnemer2013-09-271-0/+4
| | | | | | | | We previously handled one-dimensional arrays but didn't consider the general case. The fix is simple: keep going through subsequent dimensions until we get to the base element. llvm-svn: 191493
* AST: __uuidof should leak through templated typesDavid Majnemer2013-09-071-0/+19
| | | | | | | | | | | | | | | Summary: __uuidof on templated types should exmaine if any of its template parameters have a uuid declspec. If exactly one does, then take it. Otherwise, issue an appropriate error. Reviewers: rsmith, thakis, rnk CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1419 llvm-svn: 190240
* Parser: support Microsoft syntax for 'typename typedef'David Majnemer2013-09-031-1/+9
| | | | | | | | | | | | | | | | | | | | | | Summary: Transform the token sequence for: typename typedef T U; to: typename T typedef U; Raise a diagnostic when this happens but only if we succeeded handling the typename. Reviewers: rsmith, rnk Reviewed By: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1433 llvm-svn: 189867
* Sema: Properly support Microsoft-mode template argumentsDavid Majnemer2013-08-231-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | Summary: There were two things known to be wrong with our implementation of MSVC mode template arguments: - We didn't properly handle __uuidof/CXXUuidofExpr and skipped all type checking completely. - We didn't allow for MSVC's extension of allowing certain constant "foldable" expressions from showing up in template arguments. They allow various casts dereference and address-of operations. We can make it more general as we find further peculiarities but this is the known extent. Reviewers: rsmith, doug.gregor, rjmccall Reviewed By: doug.gregor CC: cfe-commits, rnk Differential Revision: http://llvm-reviews.chandlerc.com/D1444 llvm-svn: 189087
* err_attribute_not_string has been subsumed by err_attribute_argument_type.Aaron Ballman2013-07-301-17/+17
| | | | llvm-svn: 187400
* Basic support for Microsoft property declarations andJohn McCall2013-04-161-0/+29
| | | | | | | | references thereto. Patch by Tong Shen! llvm-svn: 179585
* Normalize line endings of r163013 (part 2).Joao Matos2012-08-311-44/+44
| | | | llvm-svn: 163032
* Improved MSVC __interface support by adding first class support for it, ↵Joao Matos2012-08-311-13/+21
| | | | | | instead of aliasing to "struct" which had some incorrect behaviour. Patch by David Robins. llvm-svn: 163013
* Recognize the MS inheritance attributes and turn them into attributesJohn McCall2012-05-221-0/+6
| | | | | | | | | on the RecordDecl. Persist the MS portability type attributes and ignore them in Sema rather than the parser. Patch by João Matos! llvm-svn: 157288
* Fix line endings.John McCall2012-05-221-23/+18
| | | | llvm-svn: 157287
* Recover properly from a redundant 'typename' before a non-nested name. This isRichard Smith2012-05-141-0/+13
| | | | | | | permitted as a Microsoft extension. Patch by William Wilson! (Plus some minor tweaking by me.) llvm-svn: 156786
* Emulate a MSVC bug where the creation of pointer-to-member to protected ↵Francois Pichet2012-04-171-1/+26
| | | | | | | | member of base class is allowed but only from a static function. This fixes a regression when parsing MFC code with clang. llvm-svn: 154924
* The result of the Microsoft __uuidof operator must be considered a global ↵Francois Pichet2012-04-161-2/+2
| | | | | | | | | | | | | lvalue during constant expression evaluation. Otherwise we would get this error in C++11 mode (because of a recent change): error: non-type template argument of type 'const _GUID *' is not a constant expression For code like: template <const GUID* g = &__uuidof(struct_with_uuid)> class COM_CLASS { }; llvm-svn: 154790
* Implement the Microsoft __if_exists/if_not_exists extension in initializer-list.Francois Pichet2011-12-121-0/+29
| | | | | | | | | | | | | | | Necessary to parse Microsoft ATL code. Example: int array[] = { 0, __if_exists(CLASS::Type) {2, } 3 }; will declare an array of 2 or 3 elements depending on if CLASS::Type exists or not. llvm-svn: 146447
* Change the Microsoft __interface keyword to be an alias for struct (not ↵Francois Pichet2011-12-011-0/+5
| | | | | | class) since members are public by default. llvm-svn: 145580
* Add support for Microsoft __if_exists, __if_not_exists extension at class scope.Francois Pichet2011-05-251-1/+26
| | | | | | | | | | | | | | | | Example: typedef int TYPE; class C { __if_exists(TYPE) { TYPE a; } __if_not_exists(TYPE) { this will never be parsed. } }; llvm-svn: 132052
* In Microsoft mode, allow pure specifier (=0) on inline functions declared at ↵Francois Pichet2011-05-111-0/+5
| | | | | | | | | | | | | class scope. This removes 2 errors when parsing MFC code with clang Example: class A { virtual void f() = 0 { } } llvm-svn: 131175
* Add a __uuidof test where the uuid attribute is on the second declaration. Francois Pichet2011-05-101-7/+17
| | | | | | Also some -fdelayed-template-parsing test refactoring. llvm-svn: 131113
* Temporary preprocessor hack to get around the Microsoft __identifier(x) ↵Francois Pichet2011-05-071-0/+3
| | | | | | | | | | | extension. http://msdn.microsoft.com/en-us/library/hzc8ytsz(v=VS.100).aspx Microsoft doc claims this is a C++/CLI feature but it is really always enabled. This removes 2 error when parsing MFC code with clang. llvm-svn: 131051
* Add support for _if_exists and __if_not_exists at namespace/global scope.Francois Pichet2011-05-071-6/+16
| | | | llvm-svn: 131050
* Add support for Microsoft __if_exists and __if_not_exists construct inside ↵Francois Pichet2011-05-061-0/+33
| | | | | | | | | | | | function definition. Allow to include or exclude code depending on if a symbol exists or not. Just like a #ifdef but for C/C++ symbols. More doc: http://msdn.microsoft.com/en-us/library/x7wy9xh3(v=VS.100).aspx Support at class and namespace scopes will be added later. llvm-svn: 131014
* r130381 follow up: accept __uuidof expression for template argument reference.Francois Pichet2011-04-291-0/+3
| | | | llvm-svn: 130491
* Support &__uuidof(type) as a non type template argument.Francois Pichet2011-04-281-0/+7
| | | | | | | | | | | | | | | This idiom is used everywhere in MFC/COM code and as such this patch removes hundreds of errors when parsing MFC code with clang. Example: template <class T, const GUID* g = &__uuidof(T)> class ComTemplate { }; typedef ComTemplate<struct_with_uuid, &__uuidof(struct_with_uuid)> COM_TYPE; Of course this is just parsing support. Trying to use this in CodeGen will generate: error: cannot yet mangle expression type CXXUuidofExpr llvm-svn: 130381
* Upgrade Microsoft's __int8, __int16, __int32 and __int64 types from builtin ↵Francois Pichet2011-04-281-1/+3
| | | | | | | | | | | | | | defines to real types. Otherwise statements like: __int64 var = __int64(0); would be expanded to: long long var = long long(0); and fail to compile. llvm-svn: 130369
* Add support for Microsoft __interface keyword. An __interface class is ↵Francois Pichet2011-04-271-0/+5
| | | | | | basically a normal class containing just pure virtual functions. No urgency to enforce that restriction in clang for now, so make __interface an "class" alias. llvm-svn: 130290
* Downgrade unnecessary "typename" from error to warning in Microsoft mode. Francois Pichet2011-04-241-0/+12
| | | | | | | | This fixes 1 error when parsing MSVC 2008 headers with clang. Must "return true;" even if it is a warning because the rest of the code path assumes that SS is set to something. The parser will get back on its feet and continue parsing the rest of the declaration correctly so it is not a problem. llvm-svn: 130088
* Improve recovery (error + fix-it) when parsing type dependent template name ↵Francois Pichet2011-03-271-0/+24
| | | | | | | | | | | without the "template" keyword. For example: typename C1<T>:: /*template*/ Iterator<0> pos; Also the error is downgraded to an ExtWarn in Microsoft mode. llvm-svn: 128387
* Allow Microsoft attributes in a constructor's parameter list.Francois Pichet2011-01-311-0/+8
| | | | | | This fixes a few compile errors when parsing <regex> from MSVC 2008 with clang. llvm-svn: 124573
OpenPOWER on IntegriCloud