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

1908 Коммитов

Автор SHA1 Сообщение Дата
Richard Smith 8b533d97e0 If the range in a for range statement doesn't have a viable begin/end function,
but can be dereferenced to form an expression which does have viable begin/end
functions, then typo-correct the range, even if something else goes wrong with
the statement (such as inaccessible begin/end or the wrong type of loop
variable).

In order to ensure we recover correctly and produce any followup diagnostics in
this case, redo semantic analysis on the for-range statement outside of the
diagnostic trap, after issuing the typo-correction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164323 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-20 21:52:32 +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
Fariborz Jahanian 03ebd3b4af objective-C: improve on warnings about misplacement of method
argument names. // rdar://12263549


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164077 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-17 23:09:59 +00:00
Fariborz Jahanian 0860235984 objective-C: issue warning when there is no whitespace
between objc method parameter name and colon.
// rdar://12263549


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164047 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-17 19:15:26 +00:00
Dmitri Gribenko f56faa0193 Use LLVM_DELETED_FUNCTION in place of 'DO NOT IMPLEMENT' comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163983 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-15 20:20:27 +00:00
Richard Smith b3cd3c0c8a Fix some dead stores which the static analyzer warned about. No functionality
change (the problematic cases in ParseDecl.cpp are currently impossible).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163920 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-14 18:27:01 +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
Dmitri Gribenko e23fb90712 Fix a couple of Doxygen issues pointed out by -Wdocumentation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163722 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-12 17:01:48 +00:00
Ted Kremenek b648cf02f1 Revert "objective-C: warn under a flag if missing argument"
We plan on discussing this more, but we shouldn't have it in the compiler
in an incomplete state.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163720 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-12 16:50:35 +00:00
Ted Kremenek e62b1295ec Revert "objective-C: warn if selector has nothing but bare"
We plan on discussing this more.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163719 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-12 16:50:30 +00:00
Fariborz Jahanian 10d65cd8c8 objective-C: warn if selector has nothing but bare
':' in its name. // rdar://8366823


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163650 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-11 21:27:45 +00:00
Fariborz Jahanian 92faee71f4 objective-C: warn under a flag if missing argument
name results in unintended selector name. 
// rdar://12263549


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163634 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-11 17:24:26 +00:00
Douglas Gregor 04992c7d8e Remove unused macro definition
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163598 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-11 06:33:46 +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
Douglas Gregor d295970adc Extend the "__is_pod" hack, which demotes various type trait keywords
(__is_pod, __is_signed, etc.) to normal identifiers if they are
encountered in certain places in the grammar where we know that prior
versions of libstdc++ or libc++ use them, to still allow the use of
these keywords as type traits. Fixes <rdar://problem/9836262> and PR10184.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162937 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-30 20:04:43 +00:00
Chad Rosier df5faf5e7a [ms-inline asm] As part of a larger refactoring, rename AsmStmt to GCCAsmStmt.
No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162632 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-25 00:11:56 +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
Dmitri Gribenko 1ddbd89bb3 Fix a few -Wdocumentation warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162506 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 00:01:24 +00:00
Benjamin Kramer 5354e77e60 Now that ASTMultiPtr is nothing more than a array reference, make it a MutableArrayRef.
This required changing all get() calls to data() and using the simpler constructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162501 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-23 23:38:35 +00:00
Benjamin Kramer 4e28d9e2ba Remove ASTOwningVector, it doesn't own anything and provides no value over SmallVector.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162492 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-23 22:51:59 +00:00
Benjamin Kramer 3fe198bf0d Rip out remnants of move semantic emulation and smart pointers in Sema.
These were nops for quite a while and only lead to confusion. ASTMultiPtr
now behaves like a proper dumb array reference.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162475 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-23 21:35:17 +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
Dmitri Gribenko 70517ca5c0 Fix a bunch of -Wdocumentation warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162452 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-23 17:58:28 +00:00
David Blaikie 377da4c6b7 Use LLVM_BUILTIN_TRAP instead of lame volatile int traps.
(from a todo mentioned in r159469 & originally suggested by Chandler Carruth)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162302 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-21 18:56:49 +00:00
Sam Panzer e1715b66a8 Better diagnostics for range-based for loops with bad range types.
The old error message stating that 'begin' was an undeclared identifier
is replaced with a new message explaining that the error is in the range
expression, along with which of the begin() and end() functions was
problematic if relevant.

Additionally, if the range was a pointer type or defines operator*,
attempt to dereference the range, and offer a FixIt if the modified range
works.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162248 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-21 00:52:01 +00:00
DeLesley Hutchins d30fb9e246 Thread-safety analysis: fix scoping issues related to 'this', including an
ICE in friend functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162229 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-20 21:32:18 +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
Dmitri Gribenko 0d5a069f66 Add support for "type safety" attributes that allow checking that 'void *'
function arguments and arguments for variadic functions are of a particular
type which is determined by some other argument to the same function call.

Usecases include:
* MPI library implementations, where these attributes enable checking that
  buffer type matches the passed MPI_Datatype;
* for HDF5 library there is a similar usecase as MPI;
* checking types of variadic functions' arguments for functions like
  fcntl() and ioctl().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162067 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-17 00:08:38 +00:00
Sam Panzer bc20bbb0bf Removed unused LParenLoc parameter to ActOnCXXForRangeStmt
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162048 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-16 21:47:25 +00:00
DeLesley Hutchins 95526a480f Thread safety analysis: prevent a compiler error in cases where a
late-parsed attribute is attached to an invalid declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161997 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-15 22:41:04 +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 7bd092b054 [ms-inline asm] Add the left brace source location and improve the pretty
printer.  Patch by Enea Zaffanella <zaffanella@cs.unipr.it>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161958 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-15 16:53:30 +00:00
Chad Rosier 92570bd159 [ms-inline asm] Remove the last bits of LineEnds.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161904 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-14 23:14:45 +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
Fariborz Jahanian e6b3fea007 Removed an unused function I added a while back.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161714 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10 22:28:13 +00:00
Fariborz Jahanian 9e5df31255 objective-C++: dalyed parsing of ctors with member
initializer list defined inside an objc class
implementation. wip


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161699 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10 21:15:06 +00:00
Fariborz Jahanian dbd6945b7f objective-C++: delay parsing of ctor with try block
with member initializer list defined inside
an objc implementation block. wip.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161692 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10 20:34:17 +00:00
Fariborz Jahanian 2eb362b50f objective-C++: delayed parsing of member function with
function-try-block occuring in objc's implementation
block. wip.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161675 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10 18:10:56 +00:00
Fariborz Jahanian be1d4ecb68 objective-C++: Delayed parsing of most common
member functions defined inside an objc class
implementation. wip.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161667 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10 15:54:40 +00:00
Fariborz Jahanian 6940972c33 objective-C: refactoring of objc's delayed parsing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161620 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-09 21:12:39 +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
Fariborz Jahanian c9b970996b objective-C: minor refactoring in method
definition parsing logic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161593 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-09 17:15:00 +00:00
Eli Friedman dcdff46dd8 Minor simplification for r161534.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161544 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08 23:53:27 +00:00
Fariborz Jahanian 8c6cb46294 objective-C: refactor/simplify parsing of delayed
method/c-funcs defined in objc class implementation.
No intended functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161540 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08 23:41:08 +00:00
Eli Friedman 817a8866b9 Fix r161534 so it actually builds.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161539 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08 23:35:12 +00:00
Richard Smith de01b7a6b4 PR13558: Fix typo 'compatiblity'. Thinking of the children. Apparently.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161537 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08 23:32:13 +00:00
Eli Friedman f66a0dda54 Handle deprecation diagnostics correctly for C struct fields and Objective-C properties/ivars. <rdar://problem/6642337>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161534 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08 23:04:35 +00:00
Chad Rosier 62f22b8780 [ms-inline asm] Refactor the logic to generate the AsmString into Sema. No
functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161518 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08 19:48:07 +00:00
Chad Rosier 79efe24e12 [ms-inline asm] Stmt destructors are never called, so allocate the AsmToks using
the ASTContext BumpPtr.  Also use the preferred llvm::ArrayRef interface.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161373 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 00:29:06 +00:00
Chad Rosier 8f726de554 [ms-inline asm] Pass Tokens to Sema and store them in the AST. No functional
change intended.  No test case as there's no real way to test at this time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161342 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-06 20:03:45 +00:00
Douglas Gregor d48ab06b17 Tweak code-completion heuristics deciding between a lambda
code-completion and an Objective-C message send, based on Jordan's
feedback.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161049 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-31 15:27:48 +00:00
Douglas Gregor 437fbc51c2 When we encounter a code-completion token while parsing an ill-formed
lambda-introducer in Objective-C++11, fall back to treating the tokens
as an Objective-C message send to provide those (more likely)
completions. Fixes <rdar://problem/11980263>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161015 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-31 00:50:07 +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
Peter Collingbourne ec98f2fe45 Fix an assertion failure when code completing an auto variable's initialiser.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160857 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-27 12:56:09 +00:00
NAKAMURA Takumi 11abf2ad01 clang/lib: [CMake] Update tblgen'd dependencies.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160851 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-27 06:18:33 +00:00
NAKAMURA Takumi 866abce3b9 clang/lib: [CMake] Reformat, alphabetize lists.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160850 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-27 06:18:12 +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
Richard Smith 5969a5f1b7 Do not warn about a function decl / direct init ambiguity if the function has a trailing return type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160646 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-23 21:41:30 +00:00
Sylvestre Ledru bed28ac1d1 Fix a typo (the the => the)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160622 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-23 08:59:39 +00:00
Richard Smith eab9d6f906 Add diagnostics for comma at end of enum and for extra semicolon at namespace
scope to -Wc++11-extensions. Move extra semicolon after member function
definition diagnostic out of -pedantic, since C++ allows a single semicolon
there. Keep it in -Wextra-semi, though, since it's still questionable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160618 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-23 05:45:25 +00:00
Francois Pichet b67e7fc607 Allow the parser to recover gracefully if a typename is used to introduce a decltype type.
In Microsoft mode, we emit a warning instead of an error.

This fixes a couple of errors when parsing the MSVC 11 RC headers with clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160613 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-22 15:10:57 +00:00
Fariborz Jahanian 090d1bd613 Fixes an ObjC++ parse crash caused by delayed parsing
of c-functions nested in namespace in method implementations
by turning off its delayed parsing until a proper solution is 
figured out. pr13418


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160552 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 17:19:54 +00:00
Benjamin Kramer 69b5e952c5 Move helper class into an anonymous namespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160172 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-13 13:25:11 +00:00
Chad Rosier b660446bcf 80-column violations and whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160017 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-10 21:35:27 +00:00
Fariborz Jahanian 6749ae1dbc objective-c: provide fixit hint for @autoreleasepool
and similar other keywords. // rdar://10723084


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159956 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-09 20:00:35 +00:00
Jordan Rose 94f29f4bf5 Better parser recovery in Objective-C containers.
Previously it was possible to get an infinite-loop-on-invalid with a namespace
decl within @interface. Since 'namespace' is normally a safe place to retry
top-level parsing, we just didn't consume the token.

This adds a flag that tracks whether we have temporarily left Objective-C
scope to parse a C-like declaration, and uses that to better recover from
parse problems by stopping at possible method declarations and at @end. To
fix the original problem, we do /not/ stop at 'namespace' when in an
Objective-C @interface or @protocol context (but still do in @implementation).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159941 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-09 16:54:53 +00:00
Fariborz Jahanian 8a10d9fcb5 Added a new memberfor Parser, to be used soon
for doing delayed parsing of c++ method defined in
objc class implementations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159792 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 00:42:20 +00:00
Dmitri Gribenko 8d3ba23f2d Implement AST classes for comments, a real parser for Doxygen comments and a
very simple semantic analysis that just builds the AST; minor changes for lexer
to pick up source locations I didn't think about before.

Comments AST is modelled along the ideas of HTML AST: block and inline content.

* Block content is a paragraph or a command that has a paragraph as an argument
  or verbatim command.
* Inline content is placed within some block.  Inline content includes plain
  text, inline commands and HTML as tag soup.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159790 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 00:28:32 +00:00
Fariborz Jahanian 39700f81c5 objective-c++ parsing. Turn off delayed parsing
of out-of-line c++ method definition which happens
to be inside an objc class implementation
until I can figure out how to do it. This is to fix 
a broken project.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159772 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-05 19:34:20 +00:00
Benjamin Kramer 478851c3ed Drop the ASTContext.h include from Stmt.h and fix up transitive users.
This required moving the ctors for IntegerLiteral and FloatingLiteral out of
line which shouldn't change anything as they are usually called through Create
methods that are already out of line.

ASTContext::Deallocate has been a nop for a long time, drop it from ASTVector
and make it independent from ASTContext.h

Pass the StorageAllocator directly to AccessedEntity so it doesn't need to
have a definition of ASTContext around.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159718 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-04 17:04:04 +00:00
Fariborz Jahanian b0ed95c273 Obj-C++11 parser: handle a fall out of delayed
c-function parsing when a declaration with
C++0x braced-init-list is inside an @implementation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159693 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-03 23:22:13 +00:00
Fariborz Jahanian 3b5f9dc024 Obj-C++11 parser: fix broken parsing of c-function
defined in class implementations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159691 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-03 22:54:28 +00:00
Fariborz Jahanian cda1041710 Obj-C++11 parser: turn off buffering of
c-function defined in objc class
implementation for now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159690 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-03 22:29:23 +00:00
Fariborz Jahanian a1eec4bd19 objective-c: Refactor parse/sema portion of
objective-c's fast enumeration statement,
for more work to come.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159689 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-03 22:00:52 +00:00
Fariborz Jahanian 6c89eafc90 objective-c: just as we have done for method definitions,
c-functions declared in implementation should have their 
parsing delayed until the end so, they can access forward
declared private methods. // rdar://10387088


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159626 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-02 23:37:09 +00:00
Richard Smith 139be7007e A ':' after an enum-specifier at class scope is a bitfield, not a typo for a ';'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159549 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-02 19:14:01 +00:00
Jordan Rose f70a88612a Add support for the C11 _Alignof keyword.
This behaves like the existing GNU __alignof and C++11 alignof keywords;
most of the patch is simply adding the third token spelling to various places.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159494 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-30 21:33:57 +00:00
David Blaikie e75d9cfbf4 Use -frewrite-includes for crash reports.
In future changes we should:
* use __builtin_trap rather than derefing 'random' volatile pointers.
* avoid dumping temporary files into /tmp when running tests, instead
  preferring a location that is properly cleaned up by lit.

Review by Chandler Carruth.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159469 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-29 22:03:56 +00:00
Douglas Gregor 0963017dcb Support the use of "=delete" and "=default" with delayed template
parsing. Fixes <rdar://problem/11700604>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159380 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-28 21:43:01 +00:00
Chad Rosier 8decdee5fd Whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159235 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-26 22:30:43 +00:00
Richard Smith c9f3517007 Extend the "expected ';' after struct" logic to also apply to enums, and to
struct and enum forward-declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159164 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-25 21:37:02 +00:00
John McCall 1e12b3d777 Recognize GNU attributes after 'enum class'. Fixes the libc++ build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159089 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-23 22:30:04 +00:00
Sean Hunt 2edf0a2520 Clean up a large number of C++11 attribute parse issues, including parsing
attributes in more places where we didn't and catching a lot more issues.

This implements nearly every aspect of C++11 attribute parsing, except for:
 - Attributes are permitted on explicit instantiations inside the declarator
   (but not preceding the decl-spec)
 - Attributes are permitted on friend declarations of functions.
 - Multiple instances of the same attribute in an attribute-list (e.g.
   [[noreturn, noreturn]], not [[noreturn]] [[noreturn]] which is conforming)
   are allowed.
The first two are marked as expected-FIXME in the test file and the latter
is probably a defect and is currently untested.

Thanks to Richard Smith for providing the lion's share of the testcases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159072 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-23 05:07:58 +00:00
Nico Weber 28ad063b27 Support L__FUNCTION__ in microsoft mode, PR11789
Heavily based on a patch from
Aaron Wishnick <aaron.s.wishnick@gmail.com>.

I'll clean up the duplicated function in CodeGen as
a follow-up, later today or tomorrow.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159060 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-23 02:07:59 +00:00
Kaelyn Uhrain c1fb542656 Perform typo correction for base class specifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159046 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-22 23:37:05 +00:00
Fariborz Jahanian 56242baaae objective-c: deprecated C-like parameters in Objective-C
method declarations.
// rdar://11578353.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158929 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-21 18:43:08 +00:00
Chandler Carruth b0d8671f95 Remove a goofy CMake hack and use the standard CMake facilities to
express library-level dependencies within Clang.

This is no more verbose really, and plays nicer with the rest of the
CMake facilities. It should also have no change in functionality.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158888 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-21 01:30:21 +00:00
Dmitri Gribenko 056e2c3005 Unbreak GCC build: GCC doesn't like clang::Parser::CommentHandler and class clang::CommentHandler to have same name.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158780 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-20 01:06:08 +00:00
Dmitri Gribenko aa0cd85838 Structured comment parsing, first step.
* Retain comments in the AST
* Serialize/deserialize comments
* Find comments attached to a certain Decl
* Expose raw comment text and SourceRange via libclang


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158771 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-20 00:34:58 +00:00
Sean Hunt 8e083e71d4 Reapply r158700 and fixup patches, minus one hunk that slipped through and
caused a crash in an obscure case. On the plus side, it caused me to catch
another bug by inspection.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158767 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-19 23:57:03 +00:00
Aaron Ballman fc685ace38 Reapplying the changes from r158717 as they were rolled back to avoid merge conflicts from a separate problematic patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158750 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-19 22:09:27 +00:00
Jakob Stoklund Olesen 3532936f4f Revert r158700 and dependent patches r158716, r158717, and r158731.
The original r158700 caused crashes in the gcc test suite,
g++.abi/vtable3a.C among others. It also caused failures in the libc++
test suite.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158749 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-19 21:48:43 +00:00
James Dennett 38b0603314 Documentation cleanup: fixing file headers to use Doxygen \file markup while
also being sufficiently conformant to LLVM's coding standards.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158739 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-19 21:02:26 +00:00
Meador Inge 9416d42468 Revert predefined decl tracking.
r158085 added some logic to track predefined declarations.  The main reason we
had predefined declarations in the input was because the __builtin_va_list
declarations were injected into the preprocessor input.  As of r158592 we 
explicitly build the __builtin_va_list declarations.  Therefore the predefined
decl tracking is no longer needed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158732 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-19 18:17:30 +00:00
Aaron Ballman ed35fd1c6d Improves parsing and semantic analysis for MS __declspec attributes. This includes support for the align (which fixes PR12631).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158717 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-19 13:49:26 +00:00