aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaStmt.cpp
AgeCommit message (Collapse)Author
2012-08-16[ms-inline asm] Add a helper function, isMSAsmKeyword().Chad Rosier
These require special handling, which we don't currently handle. This is being put in place to ensure we don't do invalid symbol table lookups or try to parse invalid assembly. The test cases just makes sure the latter isn't happening. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162050 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-16[ms-inline asm] Perform symbol table lookup on variables. The idea is to useChad Rosier
this information to determine valid MC operands. This will also be used for semantic analysis. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162043 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-16[ms-inline asm] Start tracking which tokens are registers and which areChad Rosier
variables, function or label references. The former is a potential clobber. The latter is either an input or an output. Unfortunately, it's difficult to test this patch at the moment, but the added test case will eventually do so. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162026 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-16[ms-inline asm] Add inputs and outputs to AST. No functional change.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162000 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-15[ms-inline asm] Use a set container to remove redundant clobbers.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161991 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-15[ms-inline asm] Address a FIXME by computing the number of asm statements whenChad Rosier
building the AsmString. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161988 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] Don't emit newlines as these are ignored by the AsmParserChad Rosier
anyways. Also, simplify some conditional logic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161977 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-15[ms-inline asm] Capturing loop-scoped (std::string)Reg with a StringRef is bad.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161966 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-15clang/lib/Sema/SemaStmt.cpp: Include MCAsmLexer.h to appease msvc to define ↵NAKAMURA Takumi
llvm::AsmToken. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161927 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-15[ms-inline asm] Have MC start parsing the asms.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161913 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] Simplify more logic by using the Token::hasLeadingSpace() andChad Rosier
Token::isAtStartOfLine() APIs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161898 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-14[ms-inline asm] Address a potential buffer overflow.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161896 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-14[ms-inline asm] Simplify the logic in patchMSAsmString. We no longer need toChad Rosier
track the LineEnds now that single line asm statments aren't merged. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161893 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-13[ms-inline asm] Add a helpful assert.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161796 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-13[ms-inline asm] Address a potential buffer overflow.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161793 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-13[ms-inline asm] Have patchMSAsmStrings() return a vector or AsmStrings.Chad Rosier
The AsmParser expects a single asm instruction, but valid ms-style inline asm statements may contain multiple instructions. This happens with asm blocks __asm { mov ebx, eax mov ecx, ebx } or when multiple asm statements are adjacent to one another __asm mov ebx, eax __asm mov ecx, ebx and __asm mov ebx, eax __asm mov ecx, ebx Currently, asm blocks are not properly handled. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161780 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10[ms-inline asm] PatchMSAsmString() doesn't correctly patch non-simple asmChad Rosier
statements. Therefore, we can't pass the PatchedAsmString to the AsmParser and expect things to work. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161701 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10[ms-inline asm] Fix a memory leak introduced in r161686.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161698 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10[ms-inline asm] Add clobbers to AST representation.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161686 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10[ms-inline asm] Use asserts as these calls are now guarded by identical checks.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161676 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10Whitespace.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161673 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-09[ms-inline asm] Fix comment.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161622 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-09[ms-inline asm] Use StringRef here, per Jordan's suggestion.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161619 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-09[ms-inline asm] Simplify logic for empty asm statements.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161615 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-09[ms-inline asm] Instantiate the various parts to the AsmParser.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161614 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-09[ms-inline asm] Initialize targets and assembly printers/parsers.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161595 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08[ms-inline asm] Use more idiomatic logic. Thanks, Bill.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161526 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08[ms-inline asm] Make sure IsSimple is correctly handled.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161522 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08Remove extraneous comment.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161521 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08[ms-inline asm] Add a very simple test case. Basically, we're only testing forChad Rosier
crashers at the moment (and coincidentally this case was causing a crash). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161520 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-08[ms-inline asm] Add support for detecting simple ms-style inline asm. SimpleChad Rosier
asm statements are those that don't reference variable names, function names, and labels. Add logic to generate a patched AsmString that will eventually be consumed by the AsmParser. No functional change at this point, so unfortunately no test case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161508 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08Add the IsSimple/IsVolatile parameters to the MSAsmStmt constructor.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161503 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-27Consolidate ObjC lookupPrivateMethod methods from Sema and DeclObjC.Anna Zaks
Also, fix a subtle bug, which occurred due to lookupPrivateMethod defined in DeclObjC.h not looking up the method inside parent's categories. Note, the code assumes that Class's parent object has the same methods as what's in the Root class of a the hierarchy, which is a heuristic that might not hold for hierarchies which do not descend from NSObject. Would be great to fix this in the future. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160885 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-17Issue warning when assigning out-of-range integer values to enums.Fariborz Jahanian
Due to performance cost, this is an opt-in option placed under -Wassign-enum. // rdar://11824807 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160382 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-11Don't try to do RVO on block variables that refer to an enclosing local.Nico Weber
Fixes PR13314, clang crashing on blocks refering to an enclosing local when the enclosing function returns void. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160089 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-09Inline storage of attributes in AttributedStmt.Alexander Kornienko
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159925 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06objective-c++11: extend c++11 range-based loop to iterateFariborz Jahanian
over objective-c container collection. // rdar://9293227 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159847 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
2012-07-02In blocks, only pretend that enum constants have enum type if necessary.Jordan Rose
In C, enum constants have the type of the enum's underlying integer type, rather than the type of the enum. (This is not true in C++.) Thus, when a block's return type is inferred from an enum constant, it is incompatible with expressions that return the enum type. In r158899, I told block returns to pretend that enum constants have enum type, like in C++. Doug Gregor pointed out that this can break existing code. Now, we don't check the types of return statements until the end of the block. This lets us go back and add implicit casts in blocks with mixed enum constants and enum-typed expressions. <rdar://problem/11662489> (again) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159591 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-21Pretend that enum constants have enum type when inferring a block return type.Jordan Rose
In C, enum constants have the type of the enum's underlying integer type, rather than the type of the enum. (This is not true in C++.) This leads to odd warnings when returning enum constants directly in blocks with inferred return types. The easiest way out of this is to pretend that, like C++, enum constants have enum type when being returned from a block. <rdar://problem/11662489> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158899 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-20Whitespace.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158837 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-20[ms-style asm] Change the fatal error to an extension warning. Apparently, thisChad Rosier
error was asserting on anything that included Windows.h. MS-style inline asm is still dropped, but at least now we're not completely silent about it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158833 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-11Etch out the code path for MS-style inline assembly.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158325 91177308-0d34-0410-b5e6-96231b3b80d8