summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser
Commit message (Collapse)AuthorAgeFilesLines
...
* OpenCL: disallow '#pragma OPENCL EXTENSION all : enable', per OpenCL 1.1 9.1Peter Collingbourne2011-10-061-0/+3
| | | | llvm-svn: 141270
* Make -fobjc-nonfragile-abi the -cc1 default, since it's theJohn McCall2011-10-021-2/+2
| | | | | | | | | | | | | | | | | | | increasingly prevailing case to the point that new features like ARC don't even support the fragile ABI anymore. This required a little bit of reshuffling with exceptions because a check was assuming that ObjCNonFragileABI was only being set in ObjC mode, and that's actually a bit obnoxious to do. Most, though, it involved a perl script to translate a ton of test cases. Mostly no functionality change for driver users, although there are corner cases with disabling language-specific exceptions that we should handle more correctly now. llvm-svn: 140957
* Hey, maybe we shouldn't silently ignore decl attributesJohn McCall2011-10-011-2/+2
| | | | | | on declarators written as types. llvm-svn: 140931
* Fix a bug in the token caching for inline constructors in C++11, and improve ↵Sebastian Redl2011-09-302-0/+19
| | | | | | error recovery in both dialects. This should fix the GCC test suite failures as well. llvm-svn: 140847
* Some fixes for MS-style asm parsing: specifically, add some error checking, ↵Eli Friedman2011-09-301-0/+25
| | | | | | and handle asm comments using semicolons correctly. (The comments are actually surprisingly tricky.) llvm-svn: 140837
* PR11000: Fix crash on invalid.Richard Smith2011-09-291-0/+9
| | | | llvm-svn: 140802
* Add support for alignment-specifiers in C1X and C++11, removePeter Collingbourne2011-09-292-3/+10
| | | | | | | support for the C++0x draft [[align]] attribute and add the C1X standard header file stdalign.h llvm-svn: 140796
* Add support for parsing an attribute-specifier-seq containing multiplePeter Collingbourne2011-09-291-0/+1
| | | | | | attribute-specifiers llvm-svn: 140794
* Add support for parsing the optional attribute-specifier-seq at thePeter Collingbourne2011-09-291-0/+2
| | | | | | end of a decl-specifier-seq llvm-svn: 140793
* Fix a crash-on-invalid.Matt Beaumont-Gay2011-09-231-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The token stream was not getting properly reset when leaving ParseLexedMethodDef in some error cases. In the testcase, that caused later accesses to the token stream to touch memory which had been freed as we finished parsing the class definition. Major hat-tip to AddressSanitizer for helping pinpoint the use-after-free, including the allocation and deallocation points: ==21510== ERROR: AddressSanitizer heap-use-after-free on address 0x7feb3de87848 at pc 0x249f4e2 bp 0x7fff15a89df0 sp 0x7fff15a89ce0 READ of size 1 at 0x7feb3de87848 thread T0 #0 0x249f4e2 clang::TokenLexer::Lex() #1 0x1c834a0 clang::Parser::ConsumeToken() #2 0x1c7dc0f clang::Parser::ParseDeclarationOrFunctionDefinition() #3 0x1c7e16b clang::Parser::ParseDeclarationOrFunctionDefinition() <snip> 0x7feb3de87848 is located 1992 bytes inside of 3816-byte region [0x7feb3de87080,0x7feb3de87f68) freed by thread T0 here: #0 0x3a22c19 free #1 0x1d136a1 clang::Parser::LexedMethod::~LexedMethod() #2 0x1cef528 clang::Parser::DeallocateParsedClasses() #3 0x1cef676 clang::Parser::PopParsingClass() #4 0x1cea094 clang::Parser::ParseCXXMemberSpecification() #5 0x1ce7ae5 clang::Parser::ParseClassSpecifier() #6 0x1cfe588 clang::Parser::ParseDeclarationSpecifiers() #7 0x1c7dbe8 clang::Parser::ParseDeclarationOrFunctionDefinition() #8 0x1c7e16b clang::Parser::ParseDeclarationOrFunctionDefinition() <snip> previously allocated by thread T0 here: #0 0x3a2302d realloc #1 0x39d7c97 llvm::SmallVectorBase::grow_pod() #2 0x1ac588e llvm::SmallVectorImpl<>::push_back() #3 0x1d12d8b clang::Parser::ConsumeAndStoreUntil() #4 0x1c9c24d clang::Parser::ConsumeAndStoreUntil() #5 0x1d12c1e clang::Parser::ConsumeAndStoreUntil() #6 0x1c9c24d clang::Parser::ConsumeAndStoreUntil() #7 0x1d10042 clang::Parser::ParseCXXInlineMethodDef() #8 0x1cec51a clang::Parser::ParseCXXClassMemberDeclaration() #9 0x1ce9de5 clang::Parser::ParseCXXMemberSpecification() #10 0x1ce7ae5 clang::Parser::ParseClassSpecifier() #11 0x1cfe588 clang::Parser::ParseDeclarationSpecifiers() #12 0x1c7dbe8 clang::Parser::ParseDeclarationOrFunctionDefinition() #13 0x1c7e16b clang::Parser::ParseDeclarationOrFunctionDefinition() <snip> llvm-svn: 140427
* [microsoft] Fix a bug in -fdelayed-template-parsing mode where we were not ↵Francois Pichet2011-09-221-2/+21
| | | | | | | | | | reentering the delayed function context correctly. The problem was that all template params were reintroduced inside the same scope. So if we had a situation where we had 2 template params with the same name at different scope then clang would generate an error about ambiguous name. The solution is to create a new ParseScope(Scope::TemplateParamScope) for each template scope that we want to reenter. (from the outmost to the innermost scope) This fixes some errors when parsing MFC code with clang. llvm-svn: 140344
* Fix a problem in digraph handling where "[:" might be treated as "<::" andRichard Trieu2011-09-201-1/+8
| | | | | | | erronously trigger the digraph correction fix-it. Include a new test to catch this in the future. llvm-svn: 140175
* Changes to the name lookup have caused a regression in the digraph fix-it hint.Richard Trieu2011-09-191-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For instance: template <class T> void E() {}; class F {}; void test() { ::E<::F>(); E<::F>(); } Gives the following error messages: error: found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'? ::E<::F>(); ^~~ < :: error: expected expression E<::F>(); ^ error: expected ']' note: to match this '[' E<::F>(); This patch adds the digraph fix-it check right before the name lookup, moves the shared checking code to a new function, and adds new tests to catch future regressions. llvm-svn: 140039
* Allow C99 hexfloats in C++0x mode. This change resolves the standardsDouglas Gregor2011-08-301-2/+3
| | | | | | | | | collision between C99 hexfloats and C++0x user-defined literals by giving C99 hexfloats precedence. Also, warning about user-defined literals that conflict with hexfloats and those that have names that are reserved by the implementation. Fixes <rdar://problem/9940194>. llvm-svn: 138839
* Add support for Microsoft __ptr32 keyword. Francois Pichet2011-08-251-0/+6
| | | | | | Patch by Chris Cudmore! llvm-svn: 138533
* Remove the last FIXMEs on -Wunused-comparison since it got moved toChandler Carruth2011-08-181-1/+1
| | | | | | | entirely use the existing -Wunused-value infrastructure. This also fixes a few missed cases for -Wunused in general. llvm-svn: 137916
* Parsing of C++0x lambda expressions, from John Freeman with help fromDouglas Gregor2011-08-045-1/+60
| | | | | | David Blaikie! llvm-svn: 136876
* This patch makes the string/character literal tests run in C,Douglas Gregor2011-07-291-1/+6
| | | | | | C++98/03, and C++0x mode, from Craig Topper! llvm-svn: 136443
* Add support for C++0x unicode string and character literals, from Craig Topper!Douglas Gregor2011-07-271-3/+34
| | | | llvm-svn: 136210
* PR10392: "#pragma GCC visibility" must not expand macros in itsJoerg Sonnenberger2011-07-201-0/+19
| | | | | | arguments. llvm-svn: 135552
* Change __debugbreak signature to void __debugbreak(void); MSVC compatibility.Francois Pichet2011-07-101-1/+1
| | | | llvm-svn: 134869
* Make the Preprocessor more memory efficient and improve macro instantiation ↵Argyrios Kyrtzidis2011-07-071-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostics. When a macro instantiation occurs, reserve a SLocEntry chunk with length the full length of the macro definition source. Set the spelling location of this chunk to point to the start of the macro definition and any tokens that are lexed directly from the macro definition will get a location from this chunk with the appropriate offset. For any tokens that come from argument expansion, '##' paste operator, etc. have their instantiation location point at the appropriate place in the instantiated macro definition (the argument identifier and the '##' token respectively). This improves macro instantiation diagnostics: Before: t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int') int y = M(/); ^~~~ t.c:5:11: note: instantiated from: int y = M(/); ^ After: t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int') int y = M(/); ^~~~ t.c:3:20: note: instantiated from: \#define M(op) (foo op 3); ~~~ ^ ~ t.c:5:11: note: instantiated from: int y = M(/); ^ The memory savings for a candidate boost library that abuses the preprocessor are: - 32% less SLocEntries (37M -> 25M) - 30% reduction in PCH file size (900M -> 635M) - 50% reduction in memory usage for the SLocEntry table (1.6G -> 800M) llvm-svn: 134587
* For code such as:Richard Trieu2011-07-011-0/+15
| | | | | | | | | | | | | | | | | | | | | | | int f(int x) { if (int foo = f(bar)) {} return 0; } Clang produces the following error messages: paren_imbalance.cc:2:19: error: use of undeclared identifier 'bar' if (int foo = f(bar)) {} ^ paren_imbalance.cc:2:26: error: expected ')' if (int foo = f(bar)) {} ^ paren_imbalance.cc:2:6: note: to match this '(' if (int foo = f(bar)) {} ^ The second error is incorrect. This patch will stop Clang from producing an error on parenthesis imbalance during error recovery when there isn't one. llvm-svn: 134258
* Allow Lexer::getLocForEndOfToken to return the location just passed the ↵Argyrios Kyrtzidis2011-06-241-0/+5
| | | | | | | | | | macro instantiation if the location given points at the last token of the macro instantiation. Fixes rdar://9045701. llvm-svn: 133804
* Improve the diagnostics generated for switch statements missing expressionsDavid Majnemer2011-06-131-0/+14
| | | | | | | - Move the diagnostic to the case statement instead of at the end of the switch - Add a fix-it hint as to how to fix the compilation error llvm-svn: 132903
* Implement support for C++11 in-class initialization of non-static data members.Richard Smith2011-06-111-0/+15
| | | | llvm-svn: 132878
* Modify a diagnostic introduced in r132612 to emit QualTypes directlyPeter Collingbourne2011-06-081-2/+2
| | | | | | | This fixes a memory error on FreeBSD (and is the right thing to do in any case). llvm-svn: 132750
* Add support for builtin astype:Tanya Lattner2011-06-041-0/+20
| | | | | | | __builtin_astype(): Used to reinterpreted as another data type of the same size using for both scalar and vector data types. Added test case. llvm-svn: 132612
* Add a fix-it and better error recovery for improperly nested namespaces. ↵Richard Trieu2011-05-261-0/+24
| | | | | | This will give a better error message for cases such as "namespace foo::bar::baz {}" and a suggested fix-it of "namespace foo { namespace bar { namespace baz {} } }" llvm-svn: 132138
* 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
* Implement a few basic tests for defaulted and deleted functions.Alexis Hunt2011-05-132-0/+26
| | | | | | | More comprehensive testing once copy {constructors,assignment operators} can be defaulted. llvm-svn: 131275
* 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
* Tweak the diagnostics for the C++0x extensions to friend types to noteDouglas Gregor2011-05-101-3/+3
| | | | | | | | that they are C++0x extensions, and put them in the appropriate group. We already support most of the semantics. Addresses <rdar://problem/9407525>. llvm-svn: 131153
* 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
* Remove some more hard CR-LF lines. These were particularly weird as they wereChandler Carruth2011-04-252-5/+5
| | | | | | | only a few lines of the file. Also set their properties to have explicitly native eol sytle. llvm-svn: 130124
* Remove hard coded dos line endings, let subversion translate them onChandler Carruth2011-04-251-42/+42
| | | | | | | | update. Despite the diff, nothing but line endings changed here. llvm-svn: 130121
* 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
* Correctly emit a diagnostic for multiple templated function definitions in ↵Francois Pichet2011-04-221-3/+14
| | | | | | -flate-template-parsing mode. llvm-svn: 130030
* Add -fdelayed-template-parsing option. Using this option all templated ↵Francois Pichet2011-04-221-0/+31
| | | | | | | | | function definitions are parsed at the end of the translation unit only if it is required by an actual instantiation. As such all the symbols of the TU are available during name lookup. Using this flag is necessary for compatibility with Microsoft template code. This also provides some parsing speed improvement. llvm-svn: 130022
* Fixes an instance method meta-data generation bug inFariborz Jahanian2011-04-221-1/+1
| | | | | | | | | | | ObjC NeXt runtime where method pointer registered in metadata belongs to an unrelated method. Ast part of this fix, I turned at @end missing warning (for class implementations) into an error as we can never be sure that meta-data being generated is correct. // rdar://9072317 llvm-svn: 130019
* Add a fixit suggest for missing case keywords inside a switch scope. For ↵Richard Trieu2011-04-211-0/+124
| | | | | | | | | | | instance, in the following code, 'case ' will be suggested before the '1:' switch (x) { 1: return 0; default: return 1; } llvm-svn: 129943
* Avoid superfluous warning after an error is detcted and reported.Fariborz Jahanian2011-04-191-2/+2
| | | | | | // rdar://9132143 llvm-svn: 129822
* C1X: implement generic selectionsPeter Collingbourne2011-04-151-0/+10
| | | | | | | As an extension, generic selection support has been added for all supported languages. The syntax is the same as for C1X. llvm-svn: 129554
OpenPOWER on IntegriCloud