Commit Graph

19497 Commits

Author SHA1 Message Date
Ken Dyck de37a67f50 Change return type of getObjCEncodingTypeSize() to CharUnits as the units are in characters.
llvm-svn: 93171
2010-01-11 19:19:56 +00:00
David Chisnall c8fc573ea0 Fix type mismatch on 64-bit platforms (GNU ObjC).
llvm-svn: 93169
2010-01-11 19:02:35 +00:00
Douglas Gregor 217604ac71 Remove some pointless FIXMEs. No functionality change
llvm-svn: 93168
2010-01-11 19:00:50 +00:00
Douglas Gregor 133bc74d7a Add support for out-of-line definitions of conversion function
templates. Previously, a little thinko in the code that replaced a
conversion function template with its redeclaration was causing some
very weird lookup behavior.

llvm-svn: 93166
2010-01-11 18:53:25 +00:00
Douglas Gregor bb91767b82 Tighten up the "cannot return array or function type" diagnostic to
say either "array type" or "function type", whichever it is. No reason
to make the user guess.

llvm-svn: 93164
2010-01-11 18:46:21 +00:00
Douglas Gregor ea0a0a9b3f Implement name lookup for conversion function template specializations
(C++ [temp.mem]p5-6), which involves template argument deduction based
on the type named, e.g., given

  struct X { template<typename T> operator T*(); } x;

when we call

  x.operator int*();

we perform template argument deduction to determine that T=int. This
template argument deduction is needed for template specialization and
explicit instantiation, e.g.,

  template<> X::operator float*() { /* ... */ }

and when calling or otherwise naming a conversion function (as in the
first example). 

This fixes PR5742 and PR5762, although there's some remaining ugliness
that's causing out-of-line definitions of conversion function
templates to fail. I'll look into that separately.

llvm-svn: 93162
2010-01-11 18:40:55 +00:00
Fariborz Jahanian 9146e44124 Fixup rewrite of ivars accessed via an explicit object
in a function. Fixes radar 7522803.

llvm-svn: 93159
2010-01-11 17:50:35 +00:00
Ken Dyck 40775003e6 Roll out ASTContext::getTypeSizeInChars(), replacing instances of
"ASTContext::getTypeSize() / 8". Replace [u]int64_t variables with CharUnits
ones as appropriate. 

Also rename RawType, fromRaw(), and getRaw() in CharUnits to QuantityType, 
fromQuantity(), and getQuantity() for clarity.

llvm-svn: 93153
2010-01-11 17:06:35 +00:00
Sebastian Redl 9a8dd0db89 Make Clang complain about taking the address of an unqualified member function. Fixes PR5985.
llvm-svn: 93150
2010-01-11 15:56:56 +00:00
Zhongxing Xu e47550e452 Enhance ScanReachableSymbols::scan(). Now another OSAtomic test case passes.
The old test case has a little mistake.

llvm-svn: 93148
2010-01-11 07:40:00 +00:00
Zhongxing Xu cbbf855432 Enhance SVals::getAsRegion: get the region that is converted to an integer.
This with previous patch fixes a OSAtomic test case.

llvm-svn: 93146
2010-01-11 06:52:53 +00:00
Chris Lattner 21d9b9a948 add a TODO for a perf improvement in LexIdentifier.
llvm-svn: 93141
2010-01-11 02:38:50 +00:00
Ted Kremenek be909b5eff Switch RegionStore over to using <BaseRegion+raw offset> to store
value bindings.  Along with a small change to OSAtomicChecker, this
resolves <rdar://problem/7527292> and resolves some long-standing
issues with how values can be bound to the same physical address by
not have the same "key".  This change is only a beginning; logically
RegionStore needs to better handle loads from addresses where the
stored value is larger/smaller/different type than the loaded value.
We handle these cases in an approximate fashion now (via
CastRetrievedVal and help in SimpleSValuator), but it could be made
much smarter.

llvm-svn: 93137
2010-01-11 02:33:26 +00:00
Ted Kremenek 8e994a2808 Preliminary reworking of value-binding logic in RegionStore:
(1) Introduce a new 'BindingKey' class to match 'BindingValue'.  This
gives us the flexibility to change the current key value from 'const
MemRegion*' to something more interesting.

(2) Rework additions/removals/lookups from the store to use new
'Remove', 'Add', 'Lookup' utility methods.

No "real" functionality change; just prep work and abstraction.

llvm-svn: 93136
2010-01-11 00:07:44 +00:00
Alexis Hunt 91b78382b5 Do not parse hexadecimal floating point literals in C++0x mode because they are
incompatible with user-defined literals, specifically with the following form:

  0x1p+1

The preprocessing-number token extends only as far as the 'p'; the '+' is not
included. Previously we could get away with this extension as p was an invalid
suffix, but now with user-defined literals, 'p' might well be a valid suffix
and we are forced to consider it as such.

This patch also adds a warning in non-0x C++ modes telling the user that
this extension is incompatible with C++0x that is enabled by default
(previously and with other languages, we warn only with a compliance
option such as -pedantic).

llvm-svn: 93135
2010-01-10 23:37:56 +00:00
Douglas Gregor 504a6ae83e Improve code completion by introducing patterns for the various C and
C++ grammatical constructs that show up in top-level (namespace-level)
declarations, member declarations, template declarations, statements,
expressions, conditions, etc. For example, we now provide a pattern
for

  static_cast<type>(expr)

when we can have an expression, or

  using namespace identifier;

when we can have a using directive.

Also, improves the results of code completion at the beginning of a
top-level declaration. Previously, we would see value names (function
names, global variables, etc.); now we see types, namespace names,
etc., but no values.

llvm-svn: 93134
2010-01-10 23:08:15 +00:00
Ted Kremenek ec144538ae Make sure this test case tests analyzing both x86_64 and i386 archs.
llvm-svn: 93133
2010-01-10 22:31:25 +00:00
Benjamin Kramer e056cea3a6 Silence MSVC warning.
RewriteObjC.cpp(4419) : warning C4804: '>' : unsafe use of type 'bool' in operation

llvm-svn: 93124
2010-01-10 19:57:50 +00:00
Anton Korobeynikov 3d364fddda Make clone() method out-of-line for Attr classes.
llvm-svn: 93120
2010-01-10 14:38:13 +00:00
Anton Korobeynikov b322c3a34b Try to make cmake happy
llvm-svn: 93119
2010-01-10 13:06:34 +00:00
Anton Korobeynikov 55bcea1e65 Generalize target weirdness handling having proper layering in mind:
1. Add helper class for sema checks for target attributes
 2. Add helper class for codegen of target attributes

As a proof-of-concept - implement msp430's 'interrupt' attribute.

llvm-svn: 93118
2010-01-10 12:58:08 +00:00
Anton Korobeynikov 89b14a4309 Rename file to generalization in next commits
llvm-svn: 93117
2010-01-10 12:57:30 +00:00
Benjamin Kramer 307c2c7ebc Simplify code. No functionality change.
llvm-svn: 93114
2010-01-10 09:51:00 +00:00
Zhongxing Xu 9635f6f5ef Enhance test case.
llvm-svn: 93101
2010-01-10 02:52:56 +00:00
Chris Lattner d081f8c851 stringref'ize a bunch of filename handling logic. Much
nicer than passing around two const char*'s.

llvm-svn: 93094
2010-01-10 01:35:12 +00:00
Chris Lattner e0d2e342b3 try to make this more stable?
llvm-svn: 93090
2010-01-10 00:59:17 +00:00
Daniel Dunbar d281a7146a Fix PR5982, a refacto in checking for '=' in a -D argument.
llvm-svn: 93088
2010-01-10 00:46:21 +00:00
Daniel Dunbar 620327d66b Fix a FIXME.
llvm-svn: 93087
2010-01-10 00:46:10 +00:00
Daniel Dunbar 1c4788b66b Darwin/ld: Don't pass '-weak_reference_mismatches non-weak' when
-weak_reference_mismatches is not present, it is the default.

llvm-svn: 93086
2010-01-10 00:46:00 +00:00
Chris Lattner 062a721c46 add comment to test.
llvm-svn: 93085
2010-01-10 00:36:16 +00:00
Chris Lattner abcbb7c05b clarify comment.
llvm-svn: 93084
2010-01-10 00:35:27 +00:00
Chris Lattner 2ceb625f59 implement rdar://7520940: published framework headers should
import other headers within the same framework with the full
framework path, not with a relative include.

llvm-svn: 93083
2010-01-10 00:24:58 +00:00
Ted Kremenek c6aa800eb3 Fix overzealous assertion in GRExprEngine::VisitLValue(). A
CallExpr/ObjCMessageExpr can be visited in an "lvalue" context if it
returns a struct temporary.  Currently the analyzer doesn't reason
about struct temporary returned by function calls, but we shouldn't
crash here either.

llvm-svn: 93081
2010-01-09 22:58:54 +00:00
Chris Lattner e23003d1f1 implement -ftabstop=width, patch by Christian Adåker
llvm-svn: 93078
2010-01-09 21:54:33 +00:00
Chris Lattner b71980f888 revert 91891, a workaround for PR5514.
llvm-svn: 93077
2010-01-09 21:45:57 +00:00
Chris Lattner bb8976e36e implement codegen support for preinc as an lvalue, PR5514.
llvm-svn: 93076
2010-01-09 21:44:40 +00:00
Chris Lattner 116ce8f172 refactor pre/postinc logic into CGF and require the caller to pass in the
lvalue to poke, no functionality change.

llvm-svn: 93075
2010-01-09 21:40:03 +00:00
Chris Lattner 34c72dd683 revert r92749, which is just dead code.
llvm-svn: 93074
2010-01-09 21:14:47 +00:00
Chris Lattner 5ed4390474 make missing prototypes warn by default in c99 mode like GCC does,
rdar://7083878

llvm-svn: 93073
2010-01-09 20:43:38 +00:00
Chris Lattner f9895c48fd add a bunch of missing prototypes to tests
llvm-svn: 93072
2010-01-09 20:43:19 +00:00
Ted Kremenek 9aa01441c3 Fix broken diagnostic when returning the address of a stack-allocated array.
llvm-svn: 93071
2010-01-09 20:05:00 +00:00
Benjamin Kramer 60fbd641ad Simplify with StringSwitch.
llvm-svn: 93064
2010-01-09 18:53:11 +00:00
Chris Lattner 09ac1b888c 2010 is here.
llvm-svn: 93063
2010-01-09 18:40:42 +00:00
Benjamin Kramer dc2f006f4e Hopefully unbreak build with g++ >= 4.3.
llvm-svn: 93060
2010-01-09 18:20:57 +00:00
Benjamin Kramer 2d6fda3205 Use MacroBuilder for TargetDefines instead of std::vector.
llvm-svn: 93058
2010-01-09 17:55:51 +00:00
Benjamin Kramer 3f6323dea5 Move MacroBuilder into Frontend/Utils.h and clean it up a bit.
llvm-svn: 93057
2010-01-09 17:43:21 +00:00
Benjamin Kramer f65e959035 Rework InitPreprocessor to use a MacroBuilder class instead of pushing around
std::vectors.

- MacroBuilder wraps a raw_ostream so it can easily write to any buffer
  supported by raw_ostream.
- MacroBuilder's method take Twines for easy string concatenation (this was done
  with sprintf and temporary buffers before).
- Targets still use std::vector as they don't have access to the builder.

llvm-svn: 93051
2010-01-09 16:17:37 +00:00
Kovarththanan Rajaratnam e8ed5be89f Switch UndefineBuiltinMacro() over to using StringRef
llvm-svn: 93049
2010-01-09 09:31:32 +00:00
Kovarththanan Rajaratnam 2f14619d89 Switch DefineBuiltinMacro() over to using StringRef
llvm-svn: 93048
2010-01-09 09:27:11 +00:00
Zhongxing Xu f1eeb78ffc When binding an rvalue to a reference, create a temporary object. Use
CXXObjectRegion to represent it. 

In Environment, lookup a literal expression before make up a value for it.

llvm-svn: 93047
2010-01-09 09:16:47 +00:00