Граф коммитов

627 Коммитов

Автор SHA1 Сообщение Дата
Guy Benyei b13621d08e Re-commit r170428 changes with Linux style file endings.
Add OpenCL images as clang builtin types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170432 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18 14:38:23 +00:00
Guy Benyei 7f92f2d8d9 Revert changes from r170428, as I accidentally changed the line endings of these files to Windows style.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170431 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18 14:30:41 +00:00
Guy Benyei 736104a761 Add OpenCL images as clang builtin types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170428 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18 12:30:03 +00:00
Nico Weber b707a4762f Don't require a space between the two ">" in "vector<id<protocol>>" in objc++11.
C++11 allowed writing "vector<vector<int>>" without a space between the two ">".
This change allows this for protocols in template lists too in -std=c++11 mode,
and improves the diagnostic in c++98 mode.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170223 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-14 18:22:38 +00:00
Richard Smith 569cdc82c1 PR14549. Don't assert if we see an incomplete decltype specifier at the end of the file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169688 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-09 04:17:57 +00:00
Chad Rosier e23fbf1fca [driver, ms-inline asm] Have -fms-extensions enable the AsmBlocks language
option.  MS-style inline asm can now be enabled by either -fasm-blocks or
-fms-extensions.
rdar://12808010

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169445 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 23:08:09 +00:00
Chad Rosier 15490fd42d [driver, ms-inline asm] MS-Style inline assembly is controlled by the
-fasm-blocks flag, not the -fms-extensions flag.
rdar://12808010

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169422 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 21:08:21 +00:00
Richard Smith 37ec8d589c In C++, if we hit an error in the class-head, don't try to parse the class body.
Our error recovery path may have made the class anonymous, and that has a pretty
disastrous impact on any attempt to parse a class body containing constructors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169374 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 11:34:06 +00:00
Michael Han 52b501cd72 Implement C++11 [dcl.attr.grammar] p4: If an attribute-specifier-seq appertains to a friend declaration, that declaration shall be a definition.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168826 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 23:17:40 +00:00
Michael Han 2e39713a3d Improve diagnostic on C++11 attribute specifiers that appear at wrong syntactic locations around class specifiers.
This change list implemented logic that explicitly detects several combinations of locations where C++11 attribute
specifiers might be incorrectly placed within a class specifier. Previously we emit generic diagnostics like 
"expected identifier" for such cases; now we emit specific diagnostic against the misplaced attributes, this also 
fixed a bug in old code where attributes appear at legitimate locations were incorrectly rejected.

Thanks to Richard Smith for reviewing!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168626 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-26 22:54:45 +00:00
Andy Gibbs 97f8461a2c Made the "expected string literal" diagnostic more expressive
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168267 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-17 19:16:52 +00:00
Richard Smith 6f9a445760 PR9903: Recover from a member functon declared with the 'typedef' specifier by
dropping the specifier, just like we do for non-member functions and function
templates declared 'typedef'. Patch by Brian Brooks!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168108 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 22:54:20 +00:00
Michael Han f64231e9f4 Teach Clang parser to reject C++11 attributes that appertain to declaration specifiers.
We don't support any C++11 attributes that appertain to declaration specifiers so reject 
the attributes in parser until we support them; this also conforms to what g++ 4.8 is doing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167481 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-06 19:34:54 +00:00
Matt Beaumont-Gay d096acc220 Our style for diagnostic messages is to not include a trailing dot.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167379 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-05 05:32:00 +00:00
Lang Hames 3f320aa932 Test case for r167363.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167369 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-04 05:08:08 +00:00
Richard Trieu eacff03a37 Fix test cases I broken when fixing grammar in diagnostic message.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167320 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-02 21:41:42 +00:00
Richard Trieu 919b9557b4 When finding a '(' after '::', emit error with hint to remove '(' and matching
')', if found.  Don't crash.
Fixes PR11852.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167268 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-02 01:08:58 +00:00
Nico Weber e1bb329744 Fix crash on missing namespace name in namespace alias definition -- PR14085.
Patch from Brian Brooks <brooks.brian@gmail.com>!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166893 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-27 23:44:27 +00:00
David Tweed a0d5878b7e Correct test inovocations to use %clang_cc1 rather than direct invocation (so that it can have additional options set when trying to debug issues causing regressions).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166681 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-25 13:56:30 +00:00
Richard Smith 53aec2a277 'constexpr' and 'friend' are both declaration specifiers. Teach the parser this, for better error recovery.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166645 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-25 00:00:53 +00:00
Eli Friedman 9dd686d2be Update regression tests for r166617.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166619 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-24 20:28:18 +00:00
Lang Hames 87234c8383 Fix typo, make test case slightly more reabable. Thanks to Dmitri Gribenko for
the suggestions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166400 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-21 19:56:13 +00:00
Lang Hames 860022ccf7 When used in a compound expression FP_CONTRACT should proceed all explicit
declarations and statements. Emit an error if the FP_CONTRACT is used
later in a compound statement.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166383 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-21 01:10:01 +00:00
Richard Smith aa9a8ce5d3 DR1473: Do not require a space between operator"" and the ud-suffix in a
literal-operator-id.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166373 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-20 08:41:10 +00:00
Andy Gibbs 8e8fb3be5b Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166280 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-19 12:44:48 +00:00
Richard Smith d654f2d722 DR1528: C++11 doesn't allow repeated cv-qualifiers in declarators after all.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166152 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 23:31:46 +00:00
Argyrios Kyrtzidis f4deaef8b8 Handle a "#pragma options align" inside a class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165810 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-12 17:39:59 +00:00
Michael Han 6880f49236 Improve C++11 attribute parsing.
- General C++11 attributes were previously parsed and ignored. Now they are parsed and stored in AST.
- Add support to parse arguments of attributes that in 'gnu' namespace.
- Differentiate unknown attributes and known attributes that can't be applied to statements when emitting diagnostic.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165082 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-03 01:56:22 +00:00
Richard Trieu 568f785a76 Cleaning up the self initialization checker.
-Allow Sema to do more processing on the initial Expr before checking it.
-Remove the special conditions in HandleExpr()
-Move the code so that only one call site is needed.
-Removed the function from Sema and only call it locally.
-Warn on potentially evaluated reference variables, not just casts to r-values.
-Update tests.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164951 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-01 17:39:51 +00:00
Richard Smith 4b0824229b If a comma operator is followed by a token which unambiguously indicates the
start of a statement or the end of a compound-statement, diagnose the comma as
a typo for a semicolon. Patch by Ahmed Bougacha! Additional test cases and
minor refactoring by me.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164085 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-18 00:52:05 +00:00
Richard Smith 3686c71ff9 Recover properly after a parse error in a static_assert declaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163826 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-13 19:12:50 +00:00
Richard Smith 69e4826edc PR13775: When checking for a tag type being shadowed by some other declaration,
don't trample over the caller's LookupResult in the case where the check fails.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163281 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-06 01:37:56 +00:00
Joao Matos 568ba871bb Revert r163083 per chandlerc's request.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163149 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-04 17:49:35 +00:00
Joao Matos 5be92de217 Implemented parsing and AST support for the MS __leave exception statement. Also a minor fix to __except printing in StmtPrinter.cpp. Thanks to Aaron Ballman for review.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163083 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-02 03:45:41 +00:00
Joao Matos 17d35c36fb Normalize line endings of r163013 (part 2).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163032 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-31 22:18:20 +00:00
Joao Matos 6666ed4ed2 Improved MSVC __interface support by adding first class support for it, instead of aliasing to "struct" which had some incorrect behaviour. Patch by David Robins.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163013 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-31 18:45:21 +00:00
Eli Friedman a6c66cedc0 Change the representation of builtin functions in the AST
(__builtin_* etc.) so that it isn't possible to take their address.
Specifically, introduce a new type to represent a reference to a builtin
function, and a new cast kind to convert it to a function pointer in the
operand of a call.  Fixes PR13195.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162962 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-31 00:14:07 +00:00
Richard Smith 3bc22262af PR13652: Don't assume the parameter array on a FunctionTypeLoc for a lambda will
be filled in; they won't if the lambda's declarator has an invalid type. Instead
take the parameters from the declarator directly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162904 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-30 13:13:20 +00:00
Aaron Ballman c828620a03 Splitting the duplicated decl spec extension warning into two: one is an ExtWarn and the other a vanilla warning. This addresses PR13705, where const char const * wouldn't warn unless -pedantic was specified under the right conditions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162793 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-28 20:55:40 +00:00
Chad Rosier 56d7f2348a [ms-inline asm] Change the -fenable-experimental-ms-inline-asm option from a
CodeGen option to a LangOpt option.  In turn, hoist the guard into the parser 
so that we avoid the new (and fairly unstable) Sema/AST/CodeGen logic.  This
should restore the behavior of clang to that prior to r158325.
<rdar://problem/12163681>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162602 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 21:42:51 +00:00
Richard Smith 40b2e19cae When disambiguating an expression-statement from a declaraton-statement, if the
statement starts with an identifier for which name lookup will fail either way,
look at later tokens to disambiguate in order to improve error recovery.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162464 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-23 20:19:14 +00:00
Richard Smith 78fe3e05a9 PR13619: Make sure we're not at EOF before looking at NextToken().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162212 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-20 17:37:52 +00:00
Richard Smith 0576681bac PR41111, PR5925, PR13210: Teach tentative parsing to annotate identifiers and
nested names as id-expressions, using the annot_primary_expr annotation, where
possible. This removes some redundant lookups, and also allows us to
typo-correct within tentative parsing, and to carry on disambiguating past an
identifier which we can determine will fail lookup as both a type and as a
non-type, allowing us to disambiguate more declarations (and thus offer
improved error recovery for such cases).

This also introduces to the parser the notion of a tentatively-declared name,
which is an identifier which we *might* have seen a declaration for in a
tentative parse (but only if we end up disambiguating the tokens as a
declaration). This is necessary to correctly disambiguate cases where a
variable is used within its own initializer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162159 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-18 00:55:03 +00:00
Chad Rosier f37e4218bb [ms-inline asm] MSVC parses multiple __asm statements on a single line as one
statement.  For example,

  if (x)
    __asm out dx, ax  __asm out dx, ax

results in a single inline asm statement (i.e., both "out dx, ax" statements are
predicated on if(x)).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161986 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-15 21:03:27 +00:00
Chad Rosier 21ef7116ef [ms-inline asm] Add a helpful assert.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161890 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-14 19:22:06 +00:00
Richard Smith 950435c15e In 'delete []', the '[]' never starts a lambda. Update a FIXME with a standard reference and add a test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161604 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-09 19:01:51 +00:00
Eli Friedman c3b2308f66 Unify the codepaths for emitting deprecation warnings. The test changes are just to account for us emitting notes more consistently.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161528 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08 21:52:41 +00:00
Richard Smith b9c6261d02 Improvements to vexing-parse warnings. Make the no-parameters case more
accurate by asking the parser whether there was an ambiguity rather than trying
to reverse-engineer it from the DeclSpec. Make the with-parameters case have
better diagnostics by using semantic information to drive the warning,
improving the diagnostics and adding a fixit.

Patch by Nikola Smiljanic. Some minor changes by me to suppress diagnostics for
declarations of the form 'T (*x)(...)', which seem to have a very high false
positive rate, and to reduce indentation in 'warnAboutAmbiguousFunction'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160998 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-30 21:30:52 +00:00
Fariborz Jahanian d30ec7076f objective-c parsing. Don't crash when selector name
is missing in method prototype. // rdar://11939584


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160789 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-26 17:32:28 +00:00
Richard Smith 42926a0655 Pedantic -pedantic correction. Duplicate cv-qualifiers are permitted in C++11
unless they appear in a decl-specifier-seq.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160688 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-24 20:24:58 +00:00