aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseStmt.cpp
AgeCommit message (Collapse)Author
2013-05-03Move parsing of identifiers in MS-style inline assembly intoJohn McCall
the actual parser and support arbitrary id-expressions. We're actually basically set up to do arbitrary expressions here if we wanted to. Assembly operands permit things like A::x to be written regardless of language mode, which forces us to embellish the evaluation context logic somewhat. The logic here under template instantiation is incorrect; we need to preserve the fact that an expression was unevaluated. Of course, template instantiation in general is fishy here because we have no way of delaying semantic analysis in the MC parser. It's all just fishy. I've also fixed the serialization of MS asm statements. This commit depends on an LLVM commit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180976 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-16Parser support for #pragma clang __debug capturedTareq A. Siraj
This patch implements parsing ‘#pragma clang __debug’ as a first step for implementing captured statements. Captured statements are a mechanism for doing outlining in the AST. see http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-January/027540.html. Currently returns StmtEmpty Author: Andy Zhang <andy.zhang@intel.com> Differential Revision: http://llvm-reviews.chandlerc.com/D369 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179614 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-28Support C11 _Atomic type qualifier. This is more-or-less just syntactic ↵Richard Smith
sugar for the _Atomic type specifier. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178210 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-22OpenMP threadprivate directive parsing and semantic analysisAlexey Bataev
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177705 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-22Fix a crash-on-valid where a block capture copy expression wasJohn McCall
picking up cleanups from earlier in the statement. Also fix a crash-on-invalid where a reference to an invalid decl from an enclosing scope was causing an expression to fail to build, but only *after* a cleanup was registered from that statement, causing an assertion downstream. The crash-on-valid is rdar://13459289. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177692 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-22[libclang] Fix a crash with invalid code, while skip function bodies is enabled.Argyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175860 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20Process and handle attributes on conditions and for loop variables. Process andRichard Smith
diagnose attributes on alias declarations, using directives, and attribute declarations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175649 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-15When a statement is dropped from the AST because it was invalid, make sureArgyrios Kyrtzidis
we don't do the scope checks otherwise we are going to hit assertion checks since a label may not have been actually added. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175281 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-29Implement C++11 [dcl.align]p1 and C11 6.7.5/2 rules for alignas and _Alignas.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173779 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-22[ms-inline asm] Remove the -fenable-experimental-ms-inline-asm flag. MS-styleChad Rosier
inline assembly can be enable with -fasm-blocks or -fms-extensions alone. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173186 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-22[ms-inline asm] Remove a warning about ms-style inline assembly not beingChad Rosier
supported. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173177 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-14Refactor to call ActOnFinishFullExpr on every full expression. TeachRichard Smith
ActOnFinishFullExpr that some of its checks only apply to discarded-value expressions. This adds missing checks for unexpanded variadic template parameter packs to a handful of constructs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172485 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-02s/CXX0X/CXX11/g, except for __GNU_EXPERIMENTAL_CXX0X__, and update a few ↵Richard Smith
nearby 'C++0x' comments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171372 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-02s/CPlusPlus0x/CPlusPlus11/gRichard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171367 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-30Simplify. No functionality change.Nico Weber
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171268 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-06Add a bit on FunctionDecl/ObjCMethodDecl to indicate if there was a bodyArgyrios Kyrtzidis
that was skipped by the parser. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169531 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05[driver, ms-inline asm] MS-Style inline assembly is controlled by theChad Rosier
-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-04Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth
uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169237 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-19PR14381: Never skip constexpr function bodies when code-completing. We may needRichard Smith
them in order to parse the rest of the file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168327 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13Simplify function try/catch scope handling.David Blaikie
Based on post-commit review feedback for r167766 by Richard Smith. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167856 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12Fix more try scoping bugs introduced by r167650.David Blaikie
Introduces more clear scoping flags & flag combinations which should hopefully be more understandable. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167766 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-10PR14296: function parameter name collisions in function try/catchDavid Blaikie
C++11 3.3.3/2 "A parameter name shall not be redeclared in the outermost block of the function definition nor in the outermost block of any handler associated with a function-try-block." It's not totally clear to me whether the "FIXME" case is covered by this, but Richard Smith thinks it probably should be. It's just a bit more involved to fix that case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167650 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-03Support interleaving of other pragmas with FP_CONTRACT at the beginning of aLang Hames
compound statement. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167363 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-31If skipping bodies is enabled outside code-completion, just skip the body ↵Argyrios Kyrtzidis
directly without using tentative parsing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167142 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-27Removed an extra blank line.Mahesha S
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166867 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-21When used in a compound expression FP_CONTRACT should proceed all explicitLang Hames
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-09People put pragmas in crazy places; add more handling. PR14046.Eli Friedman
I think our general framework for parser pragmas needs a bit more work, but I'm not planning on working on it at the moment. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165558 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-08Make sure we allow "#pragma options align=mac68k" in function-local ↵Eli Friedman
contexts. <rdar://problem/12453134> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165462 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-04Permanently end the whole "pragma got handled by the parser too early"Eli Friedman
mess by handling all pragmas which the parser touches uniformly. <rdar://problem/12248901>, etc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165195 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-02Add FP_CONTRACT support for clang.Lang Hames
Clang will now honor the FP_CONTRACT pragma and emit LLVM fmuladd intrinsics for expressions of the form A * B + C (when they occur in a single statement). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164989 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-20If the range in a for range statement doesn't have a viable begin/end function,Richard Smith
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-04Revert r163083 per chandlerc's request.Joao Matos
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163149 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-02Implemented parsing and AST support for the MS __leave exception statement. ↵Joao Matos
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-08-25[ms-inline asm] As part of a larger refactoring, rename AsmStmt to GCCAsmStmt.Chad Rosier
No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162632 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24[ms-inline asm] Change the -fenable-experimental-ms-inline-asm option from a Chad Rosier
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-23Now that ASTMultiPtr is nothing more than a array reference, make it a ↵Benjamin Kramer
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-23Remove ASTOwningVector, it doesn't own anything and provides no value over ↵Benjamin Kramer
SmallVector. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162492 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-23Rip out remnants of move semantic emulation and smart pointers in Sema.Benjamin Kramer
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-21Better diagnostics for range-based for loops with bad range types.Sam Panzer
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-18PR41111, PR5925, PR13210: Teach tentative parsing to annotate identifiers andRichard Smith
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-16Removed unused LParenLoc parameter to ActOnCXXForRangeStmtSam Panzer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162048 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-15[ms-inline asm] MSVC parses multiple __asm statements on a single line as oneChad Rosier
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[ms-inline asm] Add the left brace source location and improve the prettyChad Rosier
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-14[ms-inline asm] Remove the last bits of LineEnds.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161904 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-14[ms-inline asm] Add a helpful assert.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161890 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08[ms-inline asm] Refactor the logic to generate the AsmString into Sema. NoChad Rosier
functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161518 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07[ms-inline asm] Stmt destructors are never called, so allocate the AsmToks usingChad Rosier
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-06[ms-inline asm] Pass Tokens to Sema and store them in the AST. No functionalChad Rosier
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-07-1080-column violations and whitespace.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160017 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-03objective-c: Refactor parse/sema portion ofFariborz Jahanian
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