Ted Kremenek
8e748ab523
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
2008-02-23 01:05:54 +00:00
Ted Kremenek
471733d846
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
2008-02-23 00:52:04 +00:00
Ted Kremenek
d156d536e1
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
2008-02-22 23:17:20 +00:00
Ted Kremenek
bfc10c9612
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
2008-02-22 20:13:09 +00:00
Ted Kremenek
5f39c2dbd4
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
2008-02-22 20:00:31 +00:00
Ted Kremenek
71ac9c45c7
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
2008-02-22 19:10:58 +00:00
Ted Kremenek
f700df2638
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
2008-02-22 18:41:59 +00:00
Ted Kremenek
dc3936b055
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
2008-02-22 00:54:56 +00:00
Ted Kremenek
f7ca6968d5
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
2008-02-22 00:42:36 +00:00
Ted Kremenek
5620631a02
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
2008-02-22 00:34:10 +00:00
Ted Kremenek
9c37417979
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
2008-02-21 23:17:39 +00:00
Ted Kremenek
10c16657ee
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
2008-02-21 22:08:33 +00:00
Ted Kremenek
03da0d7eaa
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
2008-02-21 19:46:04 +00:00
Nate Begeman
86e07b6c25
add a test case
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47455 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 19:44:16 +00:00
Nate Begeman
c398f0b5ef
Handle __attribute__((annotate("string")))
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47451 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 19:30:49 +00:00
Ted Kremenek
c3055ab39a
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
2008-02-21 19:30:14 +00:00
Ted Kremenek
443003ba38
Regression fix: Handle pointer arithmetic in unary ++/--.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47449 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 19:29:23 +00:00
Ted Kremenek
89063af27f
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
2008-02-21 19:15:37 +00:00
Ted Kremenek
9258a645ea
Remove incorrect casts from UnknownVal to NonLVal.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47446 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 19:10:12 +00:00
Ted Kremenek
61e090cbe1
FIX: Promote the correct operand.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47445 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 18:46:24 +00:00
Ted Kremenek
9ef1ec98a8
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
2008-02-21 18:43:30 +00:00
Ted Kremenek
297d0d701d
Added transfer function support for sizeof(void)
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47443 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 18:15:29 +00:00
Eli Friedman
cca196b553
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
2008-02-21 18:07:36 +00:00
Ted Kremenek
aa1c4e5a6b
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
2008-02-21 18:02:17 +00:00
Eli Friedman
3b707e7476
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
2008-02-21 17:57:49 +00:00
Eli Friedman
4d1c018607
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
2008-02-21 17:45:41 +00:00
Gabor Greif
3513e138cc
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
2008-02-21 17:40:55 +00:00
Gabor Greif
266586765e
Added classes SolarisTargetInfo and
...
SolarisSparcV8TargetInfo to be able
to handle "sparc-" triple prefixes.
Please be aware that this is a minimal
kludge, that pretty much duplicates
the features of DarwinPowerPCTargetInfo,
and also incorrectly uses stuff from
the PPC namespace.
But in result "make test" now passes
a lot of tests, the notable exceptions
being the objc rewrite tests and
mandel.c.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47436 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 16:29:08 +00:00
Chris Lattner
a269ebfd91
implement codegen support for sizeof(void), fixing PR2080.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47429 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 05:45:29 +00:00
Chris Lattner
7380466f2e
add some semantic checks for address spaces.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47423 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 01:42:41 +00:00
Chris Lattner
bde7184435
add a fixme.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47421 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 01:32:57 +00:00
Chris Lattner
7654914fc5
Collect and build and process type attributes on pointers. For
...
example, we can now correctly build the type for things like:
_AS1 float * _AS2 *B;
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47420 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 01:32:26 +00:00
Chris Lattner
232e882226
move some code, no other change.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47419 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 01:08:11 +00:00
Chris Lattner
f1d705c3e2
move type attribute processing into the creatively named ProcessTypeAttributes method.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47418 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 01:07:18 +00:00
Chris Lattner
74788ba1dc
Correctly handle address space qualifiers in declspecs. This
...
allows us to correctly handle stuff like:
_AS1 float *B;
and to reject stuff like:
_AS1 _AS2* x;
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47417 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 00:48:22 +00:00
Chris Lattner
fab5b45729
move ConvertDeclSpecToType into Sema
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47415 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 23:53:49 +00:00
Chris Lattner
2070d809d2
rename some methods.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47414 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 23:25:22 +00:00
Chris Lattner
212839c2ee
Use getKind() in HandleDeclAttribute instead of decoding the string inline.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47413 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 23:17:35 +00:00
Chris Lattner
2335191341
add a method to AttributeList that converts an identifier to an enum.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47412 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 23:14:47 +00:00
Nate Begeman
1abc7f654d
Tabs are the enemy
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47410 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 22:57:40 +00:00
Chris Lattner
38d8b98803
add some code that will be used to remove processed attrs from
...
declspec, it is currently nonfunctional though.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47405 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 22:04:11 +00:00
Chris Lattner
958858e04e
Change ConvertDeclSpecToType to break out of switch instead of
...
returning directly. This allows us to factor handling of _Complex.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47404 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 21:40:32 +00:00
Chris Lattner
f46699ce22
Alternate address spaces work:
...
rename QualType::getQualifiers to getCVRQualifiers.
Add some fixme's and clean up some code relevant to qualifiers.
Change ASQualType to contain a Type* instead of a QualType.
Any CVR qualifiers should be on the outer qual type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47398 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 20:55:12 +00:00
Ted Kremenek
90e420321f
Implemented transfer function logic for unary '+'
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47357 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 04:12:31 +00:00
Ted Kremenek
d8e9f0dc73
Placed transfer function logic for dereferences in its own method, while at
...
the same time clearing up some logic of how the unary '*' operator is processed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47356 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 04:02:35 +00:00
Lauro Ramos Venancio
13e22cf1ee
Improve non-const initializer implementation.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47347 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 22:04:22 +00:00
Lauro Ramos Venancio
41ef30e869
Implement CodeGenModule::getMemSetFn method.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47346 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 22:01:01 +00:00
Ted Kremenek
1caf26aa84
Added missing case in constant propagation logic for handling the Xor of
...
two concrete integer values.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47341 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 20:53:37 +00:00
Ted Kremenek
b5339121f6
Added special handling for UninitializedVals for the transfer function logic
...
for pointer dereferences.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47340 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 20:53:06 +00:00
Ted Kremenek
a888c98b42
Implemented "getType()" for symbolic values representing the "contents" of
...
another symbolic value.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47339 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 20:51:40 +00:00