- Aug 17, 2007
-
-
Anders Carlsson authored
llvm-svn: 41136
-
- Aug 16, 2007
-
-
Steve Naroff authored
Fixed Sema::CheckEqualityOperands() and Sema::CheckRelationalOperands() to deal more thoughtfully with incompatible pointers. This includes: - Emit a diagnostic when two pointers aren't compatible! - Promote one of the pointers/integers so we maintain the invariant expected by the code generator (i.e. that the left/right types match). - Upgrade the pointer/integer comparison diagnostic to include the types. llvm-svn: 41127
-
Ted Kremenek authored
"A[4]" are equivalent to "4[A]", and that a test that the expression returned by "getBase()" has a pointer type is required to resolve which subexpression is the "true" base expression of the array index. llvm-svn: 41113
-
- Aug 15, 2007
-
-
Ted Kremenek authored
canonicalized queries of a variable's storage: hasAutoStorage - Does a variable have (implicit) auto storage? hasStaticStorage - Does a variable have (implicit) static storage? hasLocalStorage - Is the variable a non-static local variable? hasGlobalStorage - Is the variable a global variable or a static local variable? Additional comments documenting these functions are included in the source. llvm-svn: 41092
-
- Aug 14, 2007
-
-
Ted Kremenek authored
llvm-svn: 41079
-
Ted Kremenek authored
family of functions. Previous functionality only included checking to see if the format string was a string literal. Now we check parse the format string (if it is a literal) and perform the following checks: (1) Warn if: number conversions (e.g. "%d") != number data arguments. (2) Warn about missing format strings (e.g., "printf()"). (3) Warn if the format string is not a string literal. (4) Warn about the use se of '%n' conversion. This conversion is discouraged for security reasons. (5) Warn about malformed conversions. For example '%;', '%v'; these are not valid. (6) Warn about empty format strings; e.g. printf(""). Although these can be optimized away by the compiler, they can be indicative of broken programmer logic. We may need to add additional support to see when such cases occur within macro expansion to avoid false positives. (7) Warn if the string literal is wide; e.g. L"%d". (8) Warn if we detect a '\0' character WITHIN the format string. Test cases are included. llvm-svn: 41076
-
Ted Kremenek authored
getStrData() are not null-terminated, and the lengths of these strings should be determined using getByteLength(). llvm-svn: 41055
-
- Aug 11, 2007
-
-
Chris Lattner authored
llvm-svn: 41015
-
Chris Lattner authored
aggregate value and scalar expression computation are very different, this gets them away from each other. This causes a temporary regression on some complex number examples. llvm-svn: 41014
-
- Aug 10, 2007
-
-
Chris Lattner authored
llvm-svn: 41011
-
Ted Kremenek authored
by CheckPrintfArguments to determine if a given printf function accepts a va_arg argument. llvm-svn: 41008
-
Ted Kremenek authored
KnownFunctionIDs. This allows us to test for a printf-like function that accepts a va_arg argument using a range comparison. llvm-svn: 41006
-
Chris Lattner authored
llvm-svn: 41004
-
Chris Lattner authored
"I've coded up some support in clang to flag warnings for non-constant format strings used in calls to printf-like functions (all the functions listed in "man fprintf"). Non-constant format strings are a source of many security exploits in C/C++ programs, and I believe are currently detected by gcc using the flag -Wformat-nonliteral." llvm-svn: 41003
-
Chris Lattner authored
llvm-svn: 41002
-
Chris Lattner authored
preprocessor state, causing bogus diagnostics when the file is parsed for real. This implements Misc/diag-checker.c. Thanks to Ted for noticing this. llvm-svn: 41000
-
Steve Naroff authored
Make sure the arithmetic conversion are done for relation and equality operators. This fixes the following... eypedef short S; int test(S X, long long Y) { return X < Y; } Before... (CompoundStmt 0x2905d00 (ReturnStmt 0x2905cf0 (BinaryOperator 0x2905cd0 'int' '<' (ImplicitCastExpr 0x2905cc0 'int' (DeclRefExpr 0x2905c80 'S':'short' Decl='X' 0x2905c20)) (DeclRefExpr 0x2905ca0 'long long' Decl='Y' 0x2905c50)))) After... (CompoundStmt 0x2b05c30 (ReturnStmt 0x2b05c20 (BinaryOperator 0x2b05c00 'int' '<' (ImplicitCastExpr 0x2b05bf0 'long long' (DeclRefExpr 0x2b05bb0 'S':'short' Decl='X' 0x2b05b50)) (DeclRefExpr 0x2b05bd0 'long long' Decl='Y' 0x2b05b80)))) llvm-svn: 40999
-
Chris Lattner authored
llvm-svn: 40996
-
Chris Lattner authored
llvm-svn: 40995
-
Chris Lattner authored
llvm-svn: 40994
-
Chris Lattner authored
codegen for: _Complex double bar(int); void test(_Complex double*); void test2(int c) { _Complex double X; X = bar(1); test(&X); } llvm-svn: 40993
-
Chris Lattner authored
bitcast. llvm-svn: 40992
-
- Aug 09, 2007
-
-
Chris Lattner authored
llvm-svn: 40969
-
Chris Lattner authored
llvm-svn: 40968
-
Chris Lattner authored
llvm-svn: 40967
-
Chris Lattner authored
llvm-svn: 40966
-
Chris Lattner authored
llvm-svn: 40964
-
Chris Lattner authored
llvm-svn: 40963
-
Chris Lattner authored
llvm-svn: 40962
-
Chris Lattner authored
llvm-svn: 40959
-
Chris Lattner authored
This allows us to dump: typedef short S; int test(S X, long long Y) { return X < ((100)); } as: typedef short S; int test(S X, long long Y) (CompoundStmt 0x2905d40 (ReturnStmt 0x2905d30 (BinaryOperator 0x2905d10 'int' '<' (ImplicitCastExpr 0x2905d00 'int' (DeclRefExpr 0x2905c80 'S':'short' Decl='X' 0x2905c20)) (ParenExpr 0x2905ce0 'int' (ParenExpr 0x2905cc0 'int' (IntegerLiteral 0x2905ca0 'int' 100)))))) llvm-svn: 40956
-
Chris Lattner authored
the AST in a structural, non-pretty, form useful for understanding the AST. It isn't quite done yet, but is already somewhat useful. For this example: int test(short X, long long Y) { return X < ((100)); } we get (with -parse-ast-dump): int test(short X, long long Y) (CompoundStmt 0x2905ce0 (ReturnStmt 0x2905cd0 (BinaryOperator 0x2905cb0 '<' (ImplicitCastExpr 0x2905ca0 (DeclRefExpr 0x2905c20 Decl='X' 0x2905bb0)) (ParenExpr 0x2905c80 (ParenExpr 0x2905c60 (IntegerLiteral 0x2905c40 100)))))) llvm-svn: 40954
-
Steve Naroff authored
llvm-svn: 40951
-
- Aug 08, 2007
-
-
Chris Lattner authored
EmitUsualArithmeticConversions. llvm-svn: 40931
-
Steve Naroff authored
it is used by "tgmath.h" (so we need to support it). It might also come in handy when developing the overloaded function macros for OpenCU. Next check-in will make this an integer constant expression... llvm-svn: 40930
-
Chris Lattner authored
EmitExprWithUsualUnaryConversions. llvm-svn: 40929
-
Steve Naroff authored
Move the function/array conversion for ParmVarDecl's from Sema::ParseIdentifierExpr() to Sema::ParseParamDeclarator(). After discussing this with Chris, we decided this approach has more immediate benefit (though we loose some information in the AST). The comment below should describe more (if interested). llvm-svn: 40907
-
- Aug 07, 2007
-
-
Chris Lattner authored
llvm-svn: 40901
-
- Aug 05, 2007
-
-
Steve Naroff authored
Remove a space from "typeof" printing. It was causing the following error... [dylan:clang/test/Parser] admin% ../../../../Debug/bin/clang -parse-ast-check typeof.c Warnings expected but not seen: Line 21: incompatible types assigning 'typeof(*pi) const' to 'int *' Warnings seen but not expected: Line 21: incompatible types assigning 'typeof(*pi) const' to 'int *' Also corrected a typo from my previous commit. llvm-svn: 40832
-
Steve Naroff authored
Make sure the good old "function/array conversion" is done to function parameters. This resulted in the following error... [dylan:clang/test/Parser] admin% cat parmvardecl_conversion.c // RUN: clang -parse-ast-check %s void f (int p[]) { p++; } [dylan:clang/test/Parser] admin% clang -parse-ast-check parmvardecl_conversion.c Errors seen but not expected: Line 3: cannot modify value of type 'int []' With this fix, the test case above succeeds. llvm-svn: 40831
-