aboutsummaryrefslogtreecommitdiff
path: root/test/Sema
AgeCommit message (Collapse)Author
2012-09-11Comment parsing: handle non-builtin commands correctly. After semanticDmitri Gribenko
analysis registers a command, it becomes a "known" command for the lexer, since it has an ID. Having this freedom of choice to register a command is a good thing since BriefParser does not need this. But the parser should still invoke the correct semantic analysis method (actOnUnknownCommand) in this case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163646 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-08clang/test/Sema/format-strings-scanf.c: Relax a couple of expressions with ↵NAKAMURA Takumi
expected-warning-re to let matched for Win32 targets. - format specifies type 'wchar_t **' (aka 'int **') but the argument has type 'float *' - format specifies type 'wchar_t **' (aka 'unsigned short **') but the argument has type 'float *' git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163468 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-08Format strings: suggest %lld instead of %qd and %Ld with -Wformat-non-iso.Jordan Rose
As a corollary to the previous commit, even when an extension is available, we can still offer a fixit to the standard modifier. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163453 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-08Format strings: %Ld isn't available on Darwin or Windows.Jordan Rose
This seems to be a GNU libc extension; we offer a fixit to %lld on these platforms. <rdar://problem/11518237> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163452 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-06c: make __attribute__((unused)) transitive.Fariborz Jahanian
Don't warn if annotated decl is used inside another unused. // rdar://12233989 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163329 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-05c error recovery. treat an invalid redeclarationFariborz Jahanian
of a c-function for what it is. Otherwise, this func is treated as an overloadable c-function resulting in a crash much later. // rdar://11743706 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163224 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-30Add -Wduplicate-enum warning. Clang will emit this warning when an implicitlyRichard Trieu
initiated enum constant has the same value as another enum constant. For instance: enum test { A, B, C = -1, D, E = 1 }; Clang will warn that: A and D both have value 0 B and E both have value 1 A few exceptions are made to keep the noise down. Enum constants which are initialized to another enum constant, or an enum constant plus or minus 1 will not trigger this warning. Also, anonymous enums are not checked. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162938 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-30Fix a crash in type merging with enum types.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162886 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-29Move the test for PR13720 from Sema/init.c to Sema/thread-specifier.c.Hans Wennborg
Can't use __thread in init.c because it doesn't have a triple. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162836 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-29The address of a TLS var is not compile-time constant (PR13720)Hans Wennborg
This makes Clang produce an error for code such as: __thread int x; int *p = &x; The lvalue of a thread-local variable cannot be evaluated at compile time. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162835 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-28Fix for assertion when solving unresolved templates.Rafael Espindola
Patch by Magee, Josh. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162737 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24Comment diagnostics: for unresolved parameters, do not suggest parameter fixitDmitri Gribenko
with parameter that is documented. Fixes PR13670, <rdar://problem/12155840>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162570 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24Teach CFG that 'if (x & 0)' and 'if (x * 0)' is an unfeasible branch.Ted Kremenek
Fixes <rdar://problem/11005770>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162545 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24Comment semantic analysis: treat function typedefs as functions so that one canDmitri Gribenko
use \param and \returns in documentation. Fixes PR13533. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162507 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-22Comment parsing: parse "<blah" as an HTML tag only if "blah" is a known tagDmitri Gribenko
name. This should reduce the amount of warning false positives about bad HTML in comments when the comment author intended to put a reference to a template. This change will also enable us parse the comment as intended in these cases. Fixes part 1 of PR13374. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162407 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-17c: privide deprecated warning when __private_extern__ storageFariborz Jahanian
specifier is unsed in a declaration; as it may not make the symbol local to linkage unit as intended. Suggest using "hidden" visibility attribute instead. // rdar://7703982 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162138 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-17make this test case 64bit test. It fails due to Fariborz Jahanian
'int' vs. 'long' issue with i386. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162125 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-17c: implement gcc's -Wbad-function-cast which warnsFariborz Jahanian
on unsafe cast of a c-function call. This is a C-only option. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162109 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-17Define __builtin_ffs[ll] with a signed argument instead of unsigned.Benjamin Kramer
GCC documents these as unsigned, but defines them as signed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162106 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-17Add support for "type safety" attributes that allow checking that 'void *'Dmitri Gribenko
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-16Add a missing 'break' to ensure that we reject inline assemblyEric Christopher
constraints we don't recognize. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162064 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-16Attaching comments to declarations: parse the comment in context of theDmitri Gribenko
declaration it was attached to. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162033 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-15Allow 'static' and type qualifiers in K&R parameter type lists.Matt Beaumont-Gay
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161980 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-15Patch to warn about __private_extern__ on tentative definitionsFariborz Jahanian
as it does something unexpected (but gcc compatible). Suggest use of __attribute__((visibility("hidden"))) on declaration instead. // rdar://7703982 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161972 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-15Check for improper use of 'static' and type qualifiers in arrayHans Wennborg
declarators. They are only allowed for function parameters, and then only on the outermost array type derivation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161934 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-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-13c: small refactoring of checking for __attribute__(const))Fariborz Jahanian
per Richard's comment. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161786 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-13c: make __has_attribute(const) work for constFariborz Jahanian
function attribute. // rdar://10253857 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161767 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-13When looking for the comment associated with a declaration, adjust theDouglas Gregor
'templated' declaration for a function or class template to refer to the function or class template itself, to which the documentation will be attached. Fixes PR13593. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161762 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08Handle deprecation diagnostics correctly for C struct fields and Objective-C ↵Eli Friedman
properties/ivars. <rdar://problem/6642337>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161534 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-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-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-07libclang API for comment-to-xml conversion.Dmitri Gribenko
The implementation also includes a Relax NG schema and tests for the schema itself. The schema is used in c-index-test to verify that XML documents we produce are valid. In order to do the validation, we add an optional libxml2 dependency for c-index-test. Credits for CMake part go to Doug Gregor. Credits for Autoconf part go to Eric Christopher. Thanks! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161431 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07Properly check length modfiers for %n in format strings.Hans Wennborg
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161408 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-06Comment diagnostics: warn on duplicate \brief and \return commands.Dmitri Gribenko
Doxygen manual claims that multiple \brief or \returns commands will be merged together, but actual behavior is different (second \brief command becomes a part of a discussion, second \returns becomes a "Returns: blah" paragraph on its own). Anyway, it seems to be a bad idea to use multiple \brief or \returns commands in a single command. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161325 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-06Comment diagnostics: \return in void function: specialize diagnostic text forDmitri Gribenko
ObjC methods. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161324 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-03Comment diagnostics: warn if \returns is used in a non-function comment or ifDmitri Gribenko
the function returns void. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161261 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-02Comments: handle template paramter documentation in alias-declarationDmitri Gribenko
templates. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161215 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-02Attaching comments to declarations: handle using-declaration.Dmitri Gribenko
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161211 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-02test/Sema/tls.c: don't use -verify to check if TLS is supportedHans Wennborg
Use "%clang_cc1" vs "not %clang_cc1" instead. Also use -fsyntax-only. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161165 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-01Comment diagnostics fixit tests: move exected-warning constructs from theDmitri Gribenko
comment being tested. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161144 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-01Comment diagnostics: add tests for \tparam fixits.Dmitri Gribenko
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161142 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-01TLS is not supported on OpenBSDHans Wennborg
This fixes PR13502 and adds a test to keep track of which targets support TLS and which do not. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161124 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-31Comment parsing: add support for \tparam command on all levels.Dmitri Gribenko
The only caveat is renumbering CXCommentKind enum for aesthetic reasons -- this breaks libclang binary compatibility, but should not be a problem since API is so new. This also fixes PR13372 as a side-effect. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161087 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-31-Wformat: better handling of qualifiers on pointer argumentsHans Wennborg
Warn about using pointers to const-qualified types as arguments to scanf. Ignore the volatile qualifier when checking if types match. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161052 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-30Do not warn on correct use of the '%n' format specifier.Matt Beaumont-Gay
While '%n' can be used for evil in an attacker-controlled format string, there isn't any acute danger in using it in a literal format string with an argument of the appropriate type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160984 91177308-0d34-0410-b5e6-96231b3b80d8