aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema
AgeCommit message (Collapse)Author
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-14Attaching comments to redeclarations: fix wrong assumptionsDmitri Gribenko
The reason for the recent fallout for "attaching comments to any redeclaration" change are two false assumptions: (1) a RawComment is attached to a single decl (not true for 'typedef struct X *Y' where we want the comment to be attached to both X and Y); (2) the whole redeclaration chain has only a single comment (obviously false, the user can put a separate comment for each redeclaration). To fix (1) I revert the part of the recent change where a 'Decl*' member was introduced to RawComment. Now ASTContext has a separate DenseMap for mapping 'Decl*' to 'FullComment*'. To fix (2) I just removed the test with this assumption. We might not parse every comment in redecl chain if we already parsed at least one. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161878 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-14Remove and simplify unused checking code.Benjamin Kramer
This is already handled by CheckCallingConvAttr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161865 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-14Fix horribly broken sema of __attribute__((pcs())).Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161863 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-14Make __is_convertible_to handle abstract types correctly. PR13591.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161828 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-14Fix undefined behavior (and wrong code, as far as I can tell) in NEON builtinRichard Smith
tablegen code, found by -fcatch-undefined-behavior. I would appreciate if someone more familiar with the NEON code could point me in the direction of how to write a test for this. We appear to have essentially no test coverage whatsoever for these builtins. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161827 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-13Factor out computation of whether a typeid's expression is potentiallyRichard Smith
evaluated into a CXXTypeid member function. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161779 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-11Attaching comments to declarations: find comment attached to any redeclarationDmitri Gribenko
Not only look for the comment near the declaration itself, but also walk the redeclaration chain: the previous declaration might have had a documentation comment. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161722 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-10Check access to friend declarations. There's a number of differentJohn McCall
things going on here that were problematic: - We were missing the actual access check, or rather, it was suppressed on account of being a redeclaration lookup. - The access check would naturally happen during delay, which isn't appropriate in this case. - We weren't actually emitting dependent diagnostics associated with class templates, which was unfortunate. - Access was being propagated incorrectly for friend method declarations that couldn't be matched at parse-time. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161652 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10Provide isConst/Volatile on CXXMethodDecl.David Blaikie
This also provides isConst/Volatile/Restrict on FunctionTypes to coalesce the implementation with other callers (& update those other callers). Patch contributed by Sam Panzer (panzer@google.com). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161647 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-09CMake: Add the new dependency from libSema to LLVM's libs.Benjamin Kramer
Should fix the failures seen on some linux builders. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161629 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-08objective-C: refactor/simplify parsing of delayedFariborz Jahanian
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-08PR13558: Fix typo 'compatiblity'. Thinking of the children. Apparently.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161537 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08Unify the codepaths for emitting deprecation warnings. The test changes are ↵Eli Friedman
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-08Address code review comments for Wstrncat-size warning (r161440).Anna Zaks
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161527 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-08Implicitly annotate __CFStringMakeConstantString with format_arg(1).Jordan Rose
We handled the builtin version of this function in r157968, but the builtin isn't used when compiling as -fno-constant-cfstrings. This should complete <rdar://problem/6157200>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161525 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08Don't add attributes for "#pragma pack" and friends to tag declarations whichEli Friedman
are not definitions. This follows the behavior of both gcc and earlier versions of clang. Regression from r156531. <rdar://problem/12048621>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161523 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-08Whitespace.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161516 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-08Implement warning for integral null pointer constants other than the literal 0.David Blaikie
This is effectively a warning for code that violates core issue 903 & thus will become standard error in the future, hopefully. It catches strange null pointers such as: '\0', 1 - 1, const int null = 0; etc... There's currently a flaw in this warning (& the warning for 'false' as a null pointer literal as well) where it doesn't trigger on comparisons (ptr == '\0' for example). Fix to come in a future patch. Also, due to this only being a warning, not an error, it triggers quite frequently on gtest code which tests expressions for null-pointer-ness in a SFINAE context (so it wouldn't be a problem if this was an error as in an actual implementation of core issue 903). To workaround this for now, the diagnostic does not fire in unevaluated contexts. Review by Sean Silva and Richard Smith. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161501 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08objc: Include all types when issuing warning underFariborz Jahanian
-Wdirect-ivar-access. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161500 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08Remove unused variables.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161483 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08Implement final piece of DR963 and also DR587:Richard Smith
A conditional operator between glvalues of types cv1 T and cv2 T produces a glvalue if the expressions are of the same value kind and one of cv1 and cv2 is a subset of the other. A conditional operator between two null pointer constants is permitted if one of them is of type std::nullptr_t. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161476 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08Get rid of an early return in Sema::ActOnFields which doesn't make sense ↵Eli Friedman
anymore. Fixes a crash (<rdar://problem/11067144>), and generally seems to improve recovery in other cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161474 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07objc-arc: Make -Wdirect-ivar-access accessible to allFariborz Jahanian
memory models, except when arc is accessing a weak ivar (which is an error). // rdar://6505197 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161458 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07When building a conditional operator where one operand is a throw-expressionRichard Smith
and the other is a glvalue of class type, don't forget to copy-initialize a temporary when performing the lvalue-to-rvalue conversion on the glvalue. Strangely, DefaultLvalueConversions misses this part of the lvalue-to-rvalue conversions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161450 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07-Wunused-private-fields: Don't try to check unresolved initializer expressionsRichard Smith
for side-effects. Instead, check for side-effects after performing initialization. Doing so also removes some strange corner cases and differences between in-class initialization and constructor initialization. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161449 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07objective-c: Exclude -Wdirect-ivar-access for arc.Fariborz Jahanian
Allow direct ivar access in init and dealloc methods in mrr. // rdar://650197 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161426 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07Remove ScanfArgType and bake that logic into ArgType.Hans Wennborg
This is useful for example for %n in printf, which expects a pointer to int with the same logic for checking as %d would have in scanf. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161407 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07Rename analyze_format_string::ArgTypeResult to ArgTypeHans Wennborg
Also remove redundant constructors and unused member functions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161403 91177308-0d34-0410-b5e6-96231b3b80d8