]> granicus.if.org Git - clang/log
clang
16 years agoFix http://llvm.org/bugs/show_bug.cgi?id=2103.
Steve Naroff [Fri, 29 Feb 2008 23:30:25 +0000 (23:30 +0000)]
Fix http://llvm.org/bugs/show_bug.cgi?id=2103.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47775 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd checks for function calls via a function pointer that is NULL, Undefined,
Ted Kremenek [Fri, 29 Feb 2008 23:14:48 +0000 (23:14 +0000)]
Add checks for function calls via a function pointer that is NULL, Undefined,
or otherwise a constant integer value that doesn't evaluate to an address.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47774 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMinor CFG optimization: don't create separate block-level expressions for DeclStmt...
Ted Kremenek [Fri, 29 Feb 2008 22:32:24 +0000 (22:32 +0000)]
Minor CFG optimization: don't create separate block-level expressions for DeclStmt initializers when the initializer is a literal.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47771 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoWhen AST-dumping ObjCMessageExpr, output the selector.
Ted Kremenek [Fri, 29 Feb 2008 22:04:05 +0000 (22:04 +0000)]
When AST-dumping ObjCMessageExpr, output the selector.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47769 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix http://llvm.org/bugs/show_bug.cgi?id=2106.
Steve Naroff [Fri, 29 Feb 2008 21:48:07 +0000 (21:48 +0000)]
Fix http://llvm.org/bugs/show_bug.cgi?id=2106.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47768 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix a crash where PI.TypeInfo has not been filled in case of missing ObjCInterfaceDecl.
Gabor Greif [Fri, 29 Feb 2008 20:35:55 +0000 (20:35 +0000)]
Fix a crash where PI.TypeInfo has not been filled in case of missing ObjCInterfaceDecl.

Happens with Xcode 2.4.1 headers on test
Parser/objc-foreach-error-1.m

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47767 91177308-0d34-0410-b5e6-96231b3b80d8

16 years ago"Refinement" of hack to bound loop-traversals: visit any block at a maximum of 3...
Ted Kremenek [Fri, 29 Feb 2008 20:27:50 +0000 (20:27 +0000)]
"Refinement" of hack to bound loop-traversals: visit any block at a maximum of 3 times along a given path.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47766 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agotestcase for attr deprecated, by Nuno Lopes.
Chris Lattner [Fri, 29 Feb 2008 18:11:31 +0000 (18:11 +0000)]
testcase for attr deprecated, by Nuno Lopes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47757 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agomake include guards more unique.
Chris Lattner [Fri, 29 Feb 2008 17:10:38 +0000 (17:10 +0000)]
make include guards more unique.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47754 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd support for attribute(deprecated), patch by Nuno Lopes!
Chris Lattner [Fri, 29 Feb 2008 16:48:43 +0000 (16:48 +0000)]
Add support for attribute(deprecated), patch by Nuno Lopes!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47753 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded simple hack to reduce redundant warnings from the checker:
Ted Kremenek [Thu, 28 Feb 2008 20:38:16 +0000 (20:38 +0000)]
Added simple hack to reduce redundant warnings from the checker:

Cache the location of the error.  Don't emit the same
warning for the same error type that occurs at the same program
location but along a different path.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47727 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded checking for undefined results of '<<' and '>>' (shifting by too many bits...
Ted Kremenek [Thu, 28 Feb 2008 20:32:03 +0000 (20:32 +0000)]
Added checking for undefined results of '<<' and '>>' (shifting by too many bits, etc.)
This current implementation only works when both operands are concrete values; later we will add support for symbolic values.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47726 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoImplementation of the first clang-native header, stdbool.h. Comments
Eli Friedman [Thu, 28 Feb 2008 19:45:29 +0000 (19:45 +0000)]
Implementation of the first clang-native header, stdbool.h. Comments
welcome.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47724 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdated clang webpage to hint at "make update". Also
Gabor Greif [Thu, 28 Feb 2008 14:59:26 +0000 (14:59 +0000)]
Updated clang webpage to hint at "make update". Also
changed "very early" to "early" when talking about
the state of clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47718 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMerged ValueState and ValueStateImpl into just ValueState, with GRExprEngine::StateTy...
Ted Kremenek [Thu, 28 Feb 2008 10:21:43 +0000 (10:21 +0000)]
Merged ValueState and ValueStateImpl into just ValueState, with GRExprEngine::StateTy just becoming ValueState*.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47714 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRenamed "Uninitialized" -> "Undefined" in path-sensitive value tracking engine.
Ted Kremenek [Thu, 28 Feb 2008 09:25:22 +0000 (09:25 +0000)]
Renamed "Uninitialized" -> "Undefined" in path-sensitive value tracking engine.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47713 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded parsing of attributes for functions.
Ted Kremenek [Wed, 27 Feb 2008 22:18:07 +0000 (22:18 +0000)]
Added parsing of attributes for functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47693 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixed use of an uninitialized variable.
Ted Kremenek [Wed, 27 Feb 2008 20:47:56 +0000 (20:47 +0000)]
Fixed use of an uninitialized variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47691 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoEnd paths when calling a function marked "noreturn."
Ted Kremenek [Wed, 27 Feb 2008 20:43:44 +0000 (20:43 +0000)]
End paths when calling a function marked "noreturn."

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47690 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded support for attribute "noreturn."
Ted Kremenek [Wed, 27 Feb 2008 20:43:06 +0000 (20:43 +0000)]
Added support for attribute "noreturn."

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47689 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSmall tweaks to the transfer function for DeclStmt: do not mark external global
Ted Kremenek [Wed, 27 Feb 2008 19:21:33 +0000 (19:21 +0000)]
Small tweaks to the transfer function for DeclStmt: do not mark external global
variables as uninitialized, and only "initialize" static function variables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47683 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDisable internalize. Unfortunately, the configure scripts are not ready for some...
Lauro Ramos Venancio [Wed, 27 Feb 2008 18:46:32 +0000 (18:46 +0000)]
Disable internalize. Unfortunately, the configure scripts are not ready for some link time optimizations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47682 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemoved VarDecl::hasStaticStorage() (redundant with hasGlobalStorage())
Ted Kremenek [Wed, 27 Feb 2008 18:39:48 +0000 (18:39 +0000)]
Removed VarDecl::hasStaticStorage() (redundant with hasGlobalStorage())
Removed VarDecl::hasAutoStorage() (only used by hasLocalStorage())

Merged logic from VarDecl::hasAutoStorage() into VarDecl::hasLocalStorage(),
and expanded (fixed) the logic of hasLocalStorage() to handle Extern and PrivateExtern.

Renamed Expr::hasStaticStorage() to Expr::hasGlobalStorage().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47681 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded string "[CHECKER]" to the output diagnostics produced by the GRSimpleVals analysis.
Ted Kremenek [Wed, 27 Feb 2008 17:56:16 +0000 (17:56 +0000)]
Added string "[CHECKER]" to the output diagnostics produced by the GRSimpleVals analysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47678 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixed edge-case in CFG construction where goto jumps would not always get
Ted Kremenek [Wed, 27 Feb 2008 17:33:02 +0000 (17:33 +0000)]
Fixed edge-case in CFG construction where goto jumps would not always get
properly back-patched.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47675 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoA, q and Z are valid LLVM inline asm constraints.
Lauro Ramos Venancio [Wed, 27 Feb 2008 16:53:36 +0000 (16:53 +0000)]
A, q and Z are valid LLVM inline asm constraints.
Fix regression in Applications/ClamAV/clamscan.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47673 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoBug fix in CFG construction: Properly register the loop head as the implicit
Ted Kremenek [Wed, 27 Feb 2008 07:20:00 +0000 (07:20 +0000)]
Bug fix in CFG construction: Properly register the loop head as the implicit
successor of blocks created above it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47666 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSmall fix to VisitLVal: this method can be called on Block-Level expressions.
Ted Kremenek [Wed, 27 Feb 2008 07:04:16 +0000 (07:04 +0000)]
Small fix to VisitLVal: this method can be called on Block-Level expressions.
In such cases, handle them just like Visit().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47665 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoWhen analyzing a function, eagerly create symbolic values for all
Ted Kremenek [Wed, 27 Feb 2008 06:47:26 +0000 (06:47 +0000)]
When analyzing a function, eagerly create symbolic values for all
globals/parameters at the beginning of the analysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47664 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoHeader file cleanups: reduce number of includes; move ValueState.h into include direc...
Ted Kremenek [Wed, 27 Feb 2008 06:07:00 +0000 (06:07 +0000)]
Header file cleanups: reduce number of includes; move ValueState.h into include directory tree.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47661 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSimilar bug fix to r47650; when processing CallExprs if we did not generate an
Ted Kremenek [Wed, 27 Feb 2008 00:46:25 +0000 (00:46 +0000)]
Similar bug fix to r47650; when processing CallExprs if we did not generate an
ExplodedNode for the Callee subexpression we would not evaluate the CallExpr
transfer function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47651 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixed bug in the core transfer function logic for CallExprs where we would
Ted Kremenek [Wed, 27 Feb 2008 00:44:11 +0000 (00:44 +0000)]
Fixed bug in the core transfer function logic for CallExprs where we would
sometimes skip evaluating all the arguments when some arguments would not
create new ExplodedNodes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47650 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixed CFG construction bug that occurred when a condition for a loop spanned
Ted Kremenek [Wed, 27 Feb 2008 00:28:17 +0000 (00:28 +0000)]
Fixed CFG construction bug that occurred when a condition for a loop spanned
multiple basic blocks (which can happen when they contain '&&', '||', '?'). The
bug was that the loop backedge when to the last block in the loop condition, not
the first.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47649 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agofix an interaction between -isystem . and isysroot.
Chris Lattner [Tue, 26 Feb 2008 23:46:22 +0000 (23:46 +0000)]
fix an interaction between -isystem . and isysroot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47646 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix bug when processing '?' operator: invalidate the old "Uninitialized" value of...
Ted Kremenek [Tue, 26 Feb 2008 23:37:01 +0000 (23:37 +0000)]
Fix bug when processing '?' operator: invalidate the old "Uninitialized" value of the block-level expression for ?.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47645 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded boilerplate for plug-in transfer function support for CallExprs.
Ted Kremenek [Tue, 26 Feb 2008 23:04:29 +0000 (23:04 +0000)]
Added boilerplate for plug-in transfer function support for CallExprs.
GRSimpleVals performs the following action: invalidate all values passed-by-reference.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47638 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDon't emit divide-by-zero errors when we divide by an unknown (not
Ted Kremenek [Tue, 26 Feb 2008 22:27:51 +0000 (22:27 +0000)]
Don't emit divide-by-zero errors when we divide by an unknown (not
uninitialized) value. At this point we're just too imprecise.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47636 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoChanged VarDecl::hasGlobalStorage() to be the negation of hasLocalStorage().
Ted Kremenek [Tue, 26 Feb 2008 21:57:11 +0000 (21:57 +0000)]
Changed VarDecl::hasGlobalStorage() to be the negation of hasLocalStorage().
Before it was the negation of hasAutoStorage(), which is incorrect.
"Register" storage for Decls do not indicate global variables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47630 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoImplement codegen for the following static var init.
Lauro Ramos Venancio [Tue, 26 Feb 2008 21:41:45 +0000 (21:41 +0000)]
Implement codegen for the following static var init.

void g() {
  static char a[10];
  static char *b = a;
}

Now we can compile wget!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47627 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemoved static analysis-specific diagnostics from DiagnosticKinds.def.
Ted Kremenek [Tue, 26 Feb 2008 21:31:18 +0000 (21:31 +0000)]
Removed static analysis-specific diagnostics from DiagnosticKinds.def.
Use custom diagnostics for static analysis checkers.  Added warnings
for dereferencing uninitialized values and divide-by-zeroes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47626 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemoved hack with toggling the signedness flag of the APSInt stored
Ted Kremenek [Tue, 26 Feb 2008 21:04:29 +0000 (21:04 +0000)]
Removed hack with toggling the signedness flag of the APSInt stored
in an EnumConstantDecl.  This was made possible because of a recent fix
in the parser:

http://llvm.org/viewvc/llvm-project?rev=47581&view=rev

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47624 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSmall fixes to shore up overhauling of transfer function logic for '&&' and '||.
Ted Kremenek [Tue, 26 Feb 2008 19:40:44 +0000 (19:40 +0000)]
Small fixes to shore up overhauling of transfer function logic for '&&' and '||.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47620 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix a bug in ConvertAsmString function.
Lauro Ramos Venancio [Tue, 26 Feb 2008 19:19:58 +0000 (19:19 +0000)]
Fix a bug in ConvertAsmString function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47618 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agooptimization: no longer create ExplodedNodes for IntegerLiteral and
Ted Kremenek [Tue, 26 Feb 2008 19:17:09 +0000 (19:17 +0000)]
optimization: no longer create ExplodedNodes for IntegerLiteral and
CharacterLiteral expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47617 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMajor cleanup of the transfer function logic for '&&', '||', and '?'. We
Ted Kremenek [Tue, 26 Feb 2008 19:05:15 +0000 (19:05 +0000)]
Major cleanup of the transfer function logic for '&&', '||', and '?'.  We
now store in the state essentially which branch we took.  This removes
a bunch of bogus assumptions (and likely bugs), reduces the complexity of
the implementation, and facilitates more optimizations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47613 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoConvert x86 target specific inline asm constraints to LLVM.
Lauro Ramos Venancio [Tue, 26 Feb 2008 18:33:46 +0000 (18:33 +0000)]
Convert x86 target specific inline asm constraints to LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47609 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixed inverted condition.
Ted Kremenek [Tue, 26 Feb 2008 03:44:25 +0000 (03:44 +0000)]
Fixed inverted condition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47590 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDo include ParenExpr in the CFG; only include their subexpression.
Ted Kremenek [Tue, 26 Feb 2008 02:37:08 +0000 (02:37 +0000)]
Do include ParenExpr in the CFG; only include their subexpression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47588 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded lazy "symbolication" of parameter variables and global variables.
Ted Kremenek [Tue, 26 Feb 2008 02:15:56 +0000 (02:15 +0000)]
Added lazy "symbolication" of parameter variables and global variables.
Added recording of divide-by-zero and divide-by-uninitialized nodes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47586 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoadd parsing, ast building and pretty printing support for C++ throw expressions.
Chris Lattner [Tue, 26 Feb 2008 00:51:44 +0000 (00:51 +0000)]
add parsing, ast building and pretty printing support for C++ throw expressions.
Patch by Mike Stump!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47582 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix PR2092 by making sure the sign of the enum value follows the
Chris Lattner [Tue, 26 Feb 2008 00:33:57 +0000 (00:33 +0000)]
Fix PR2092 by making sure the sign of the enum value follows the
sign of its type in the early exit case.  No testcase, because this
doesn't manifest as a failure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47581 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agofix const correctness.
Chris Lattner [Tue, 26 Feb 2008 00:32:36 +0000 (00:32 +0000)]
fix const correctness.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47580 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixed bug in CFG construction when a CompoundStmt ended with a NullStmt.
Ted Kremenek [Tue, 26 Feb 2008 00:22:58 +0000 (00:22 +0000)]
Fixed bug in CFG construction when a CompoundStmt ended with a NullStmt.
This caused the whole body to get dropped from the CFG.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47579 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded FIXME.
Ted Kremenek [Tue, 26 Feb 2008 00:20:52 +0000 (00:20 +0000)]
Added FIXME.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47578 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMinor bug fix in LiveVariables: don't "kill" decls referenced by a DeclStmt
Ted Kremenek [Mon, 25 Feb 2008 22:28:54 +0000 (22:28 +0000)]
Minor bug fix in LiveVariables: don't "kill" decls referenced by a DeclStmt
that aren't VarDecls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47572 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix a little typo... per cfe-dev, this was apparently causing test
Eli Friedman [Mon, 25 Feb 2008 22:11:40 +0000 (22:11 +0000)]
Fix a little typo... per cfe-dev, this was apparently causing test
failures on OS X in some cases.  (Thank you valgrind.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47568 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoclarify comment, this is undefined behavior in any case, even if it only
Chris Lattner [Mon, 25 Feb 2008 21:38:21 +0000 (21:38 +0000)]
clarify comment, this is undefined behavior in any case, even if it only
bits VC++ right now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47565 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agodoxygenify some comments.
Ted Kremenek [Mon, 25 Feb 2008 21:33:32 +0000 (21:33 +0000)]
doxygenify some comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47564 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoBetter handling of calls to functions via function pointers.
Ted Kremenek [Mon, 25 Feb 2008 21:16:03 +0000 (21:16 +0000)]
Better handling of calls to functions via function pointers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47562 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoconvert tabs to spaces, patch by Mike Stump!
Chris Lattner [Mon, 25 Feb 2008 21:04:36 +0000 (21:04 +0000)]
convert tabs to spaces, patch by Mike Stump!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47560 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRevert an incorrect part of my previuos patch.
Lauro Ramos Venancio [Mon, 25 Feb 2008 19:08:51 +0000 (19:08 +0000)]
Revert an incorrect part of my previuos patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47553 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix PR2086.
Lauro Ramos Venancio [Mon, 25 Feb 2008 19:03:15 +0000 (19:03 +0000)]
Fix PR2086.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47551 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixed bug in RemoveDeadBindings when performing the mark-and-sweep over the
Ted Kremenek [Mon, 25 Feb 2008 18:56:23 +0000 (18:56 +0000)]
Fixed bug in RemoveDeadBindings when performing the mark-and-sweep over the
symbolic store: VarDecl's inserted into the sweep may not always bind to
anything; handle this special case just like bindings to uninitialized values.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47550 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoExpanded transfer function support for divide-by-zero checking to include
Ted Kremenek [Mon, 25 Feb 2008 18:42:54 +0000 (18:42 +0000)]
Expanded transfer function support for divide-by-zero checking to include
"remainder-by-zero" checking (operator '%').

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47549 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded hack to transfer function logic to handle the case where a DeclRefExpr
Ted Kremenek [Mon, 25 Feb 2008 18:34:45 +0000 (18:34 +0000)]
Added hack to transfer function logic to handle the case where a DeclRefExpr
wrapping an EnumConstantDecl evaluates to an integer type that has a different
signedness than the APSInt stored in the EnumConstantDecl. Will file a Bugzilla
report.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47548 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded transfer function support for checking for divide-by-zero errors.
Ted Kremenek [Mon, 25 Feb 2008 17:51:31 +0000 (17:51 +0000)]
Added transfer function support for checking for divide-by-zero errors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47547 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoenable digraphs for C94, thanks to Neil for pointing this out.
Chris Lattner [Mon, 25 Feb 2008 04:01:39 +0000 (04:01 +0000)]
enable digraphs for C94, thanks to Neil for pointing this out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47543 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix PR2090, a typo in digraph processing.
Chris Lattner [Sun, 24 Feb 2008 19:05:57 +0000 (19:05 +0000)]
Fix PR2090, a typo in digraph processing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47540 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdate comment.
Chris Lattner [Sun, 24 Feb 2008 19:04:33 +0000 (19:04 +0000)]
Update comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47539 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMove the initialization of SEL/objc_selector from Sema::Sema() to Sema::ActOnTranslat...
Steve Naroff [Sun, 24 Feb 2008 16:25:02 +0000 (16:25 +0000)]
Move the initialization of SEL/objc_selector from Sema::Sema() to Sema::ActOnTranslationUnitScope() and make sure the type/struct get inserted into the translation unit scope.

Bug submitted by David Chisnall (thanks!).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47538 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTwo more Windows-related fixes:
Ted Kremenek [Sun, 24 Feb 2008 03:55:14 +0000 (03:55 +0000)]
Two more Windows-related fixes:

- More enum signeness bitfield fixes (MSVC treats enums as signed).

- Fixed in Lex/HeaderSearch.cpp an unsafe copy between two
  HeaderSearch::PerFileInfo entries in a common vector. The copy involved two
  calls to getFileInfo() within the assignment; these calls could have
  side-effects that enlarged the internal vector, and with MSVC this would
  invalidate one of the values in the assignment.

Patch by Argiris Kirtzidis!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47536 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoIn FileManager: use full paths to unique files and directories on Windows,
Ted Kremenek [Sun, 24 Feb 2008 03:15:25 +0000 (03:15 +0000)]
In FileManager: use full paths to unique files and directories on Windows,
since inodes are bogus abstraction on that platform.

Patch by Argiris Kirtzidis!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47535 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMinor code cleanup.
Eli Friedman [Sat, 23 Feb 2008 07:32:49 +0000 (07:32 +0000)]
Minor code cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47530 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoChange encoding of TokenKind in IdentifierTable to be of type "unsigned"
Ted Kremenek [Sat, 23 Feb 2008 01:05:54 +0000 (01:05 +0000)]
Change encoding of TokenKind in IdentifierTable to be of type "unsigned"
instead of TokenKind because of signedness issues with MSVC and enums.

Patch from Argiris Kirtzidis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47515 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPatch from Argiris Kirtzidis:
Ted Kremenek [Sat, 23 Feb 2008 00:52:04 +0000 (00:52 +0000)]
Patch from Argiris Kirtzidis:

The patch fixes some debug assertions that the msvcrt throws:

1)
-    if (isprint(value) && value < 256) {
+    if (value < 256 && isprint(value)) {

isprint() does an assertion check of its own for value < 256; check value before calling it to prevent it.

2)
-    Stmt->Names.push_back(std::string(&data[0], data.size()));
+    if (data.size() == 0)
+      Stmt->Names.push_back(std::string());
+    else
+      Stmt->Names.push_back(std::string(&data[0], data.size()));

If data.size() == 0 then data[0] throws "out of range" assertion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47512 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixed horrid bug in LiveVariables analysis where we were only merging at
Ted Kremenek [Fri, 22 Feb 2008 23:17:20 +0000 (23:17 +0000)]
Fixed horrid bug in LiveVariables analysis where we were only merging at
confluence points the liveness information for variables (Decls) and NOT
block-level expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47506 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoModified clang driver option -dump-live-variables to (optionally) use the
Ted Kremenek [Fri, 22 Feb 2008 20:13:09 +0000 (20:13 +0000)]
Modified clang driver option -dump-live-variables to (optionally) use the
--analyze-function option to analyze specific functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47498 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoclang driver options --dump-cfg and --view-cfg now (optionally) use the
Ted Kremenek [Fri, 22 Feb 2008 20:00:31 +0000 (20:00 +0000)]
clang driver options --dump-cfg and --view-cfg now (optionally) use the
--analyze-function option to dump/view the CFGs of specific functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47497 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoWhen running the GRSimpleVals analysis, skip functions that do not
Ted Kremenek [Fri, 22 Feb 2008 19:10:58 +0000 (19:10 +0000)]
When running the GRSimpleVals analysis, skip functions that do not
appear in a file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47491 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPunt on unifying symbolic lvalues. This won't be needed for many checkers.
Ted Kremenek [Fri, 22 Feb 2008 18:41:59 +0000 (18:41 +0000)]
Punt on unifying symbolic lvalues.  This won't be needed for many checkers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47489 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded "assumption" logic for lval::FuncVal and lval::GotoLabel, and simplified
Ted Kremenek [Fri, 22 Feb 2008 00:54:56 +0000 (00:54 +0000)]
Added "assumption" logic for lval::FuncVal and lval::GotoLabel, and simplified
assumption logic for lval::DeclVal.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47466 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoBug fix: For transfer function for unary "!", compare the subexpression value
Ted Kremenek [Fri, 22 Feb 2008 00:42:36 +0000 (00:42 +0000)]
Bug fix: For transfer function for unary "!", compare the subexpression value
against '0' of the same bit-width.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47465 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoBug fix in liveness: Only compute liveness information for VarDecls.
Ted Kremenek [Fri, 22 Feb 2008 00:34:10 +0000 (00:34 +0000)]
Bug fix in liveness: Only compute liveness information for VarDecls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47464 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoReturn "Unknown" when using the value of a function pointer whose value
Ted Kremenek [Thu, 21 Feb 2008 23:17:39 +0000 (23:17 +0000)]
Return "Unknown" when using the value of a function pointer whose value
is symbolic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47463 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRegression fix: Handle binary operators where both the left and right
Ted Kremenek [Thu, 21 Feb 2008 22:08:33 +0000 (22:08 +0000)]
Regression fix: Handle binary operators where both the left and right
operands are symbolic lvalues.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47459 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded transfer function support for dispatching to functions we don't know
Ted Kremenek [Thu, 21 Feb 2008 19:46:04 +0000 (19:46 +0000)]
Added transfer function support for dispatching to functions we don't know
about.  The default logic is to invalidate the values of all values
passed-by-reference.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47456 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoadd a test case
Nate Begeman [Thu, 21 Feb 2008 19:44:16 +0000 (19:44 +0000)]
add a test case

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47455 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoHandle __attribute__((annotate("string")))
Nate Begeman [Thu, 21 Feb 2008 19:30:49 +0000 (19:30 +0000)]
Handle __attribute__((annotate("string")))

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47451 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemoveDeadBindings should now check for UninitalizedVal, as it is a now
Ted Kremenek [Thu, 21 Feb 2008 19:30:14 +0000 (19:30 +0000)]
RemoveDeadBindings should now check for UninitalizedVal, as it is a now
an error to cast it to LVal.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47450 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRegression fix: Handle pointer arithmetic in unary ++/--.
Ted Kremenek [Thu, 21 Feb 2008 19:29:23 +0000 (19:29 +0000)]
Regression fix: Handle pointer arithmetic in unary ++/--.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47449 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemoved bogus assertions regard LValues binding to UnknownVal; they can
Ted Kremenek [Thu, 21 Feb 2008 19:15:37 +0000 (19:15 +0000)]
Removed bogus assertions regard LValues binding to UnknownVal; they can
do so implicitly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47447 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove incorrect casts from UnknownVal to NonLVal.
Ted Kremenek [Thu, 21 Feb 2008 19:10:12 +0000 (19:10 +0000)]
Remove incorrect casts from UnknownVal to NonLVal.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47446 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFIX: Promote the correct operand.
Ted Kremenek [Thu, 21 Feb 2008 18:46:24 +0000 (18:46 +0000)]
FIX: Promote the correct operand.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47445 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSimplified and generalized transfer function logic for casts, allowing
Ted Kremenek [Thu, 21 Feb 2008 18:43:30 +0000 (18:43 +0000)]
Simplified and generalized transfer function logic for casts, allowing
the transfer function to be invoked without an Expr* for the Cast operation.

Added implicit promotions to the transfer function logic for compound
assignments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47444 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded transfer function support for sizeof(void)
Ted Kremenek [Thu, 21 Feb 2008 18:15:29 +0000 (18:15 +0000)]
Added transfer function support for sizeof(void)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47443 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSome const initializer tests for stuff I just committed.
Eli Friedman [Thu, 21 Feb 2008 18:07:36 +0000 (18:07 +0000)]
Some const initializer tests for stuff I just committed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47442 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMajor cleanup of path-sensitive analysis engine and the current analysis
Ted Kremenek [Thu, 21 Feb 2008 18:02:17 +0000 (18:02 +0000)]
Major cleanup of path-sensitive analysis engine and the current analysis
based on constant. prop. and limited symbolics.

- Renamed class: RValue -> RVal, LValue -> LVal, etc.
- Minor method renamings and interface cleanups.
- Tightened the RVal "type system" so that UninitializedVal and UnknownVal
  cannot be cast to LVal or NonLVal.  This forces these corner cases values
  to be explicitly handled early before being dispatched to plug-in transfer
  function logic.
- Major cleanup in the transfer function logic for binary and unary operators.
  Still fixing some regressions, but we now explicitly handle Uninitialized
  and Unknown values in a more rigorous way.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47441 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoClean up constant implicit cast emission; fixes a few edge cases
Eli Friedman [Thu, 21 Feb 2008 17:57:49 +0000 (17:57 +0000)]
Clean up constant implicit cast emission; fixes a few edge cases
invlolving implicit casts that cause both a decay to pointer type and a
type conversion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47440 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix brace-enclosed string initializers for char arrays. From pr2079,
Eli Friedman [Thu, 21 Feb 2008 17:45:41 +0000 (17:45 +0000)]
Fix brace-enclosed string initializers for char arrays. From pr2079,
ahtough I had the fix in my tree previously.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47439 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoChange variable name to Tq (from TQ)
Gabor Greif [Thu, 21 Feb 2008 17:40:55 +0000 (17:40 +0000)]
Change variable name to Tq (from TQ)
because silly gcc 3.4.6 barfs on this
construct.
Type.h defines an "enum TQ", which makes
the parser to err.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47438 91177308-0d34-0410-b5e6-96231b3b80d8