Граф коммитов

6098 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor b37b648b3f Improve representation of tag declarations first declared or defined
within the declarator of another declaration, from Enea Zaffanella!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95991 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 17:40:34 +00:00
Douglas Gregor c4875ee41b Improve documentation for DependentTypeOfExprType, DependentDecltypeType. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95989 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 17:28:41 +00:00
John McCall 27935ee59c Waste two bits in every clang::Type so that the type class can be read
in a single byte-load rather than some crazy bitmunging operation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95964 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 03:41:30 +00:00
Tanya Lattner e6bbc01d1c Implementing unused function warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95940 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 00:07:30 +00:00
Charles Davis b84412f587 Warn about using the new force_align_arg_pointer attribute on a function
pointer. If you don't like the new warning, you can turn it off with
-Wno-force-align-arg-pointer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95939 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 23:57:08 +00:00
Ted Kremenek ad7fe86486 Fix leak in CXXNewExpr where the SubExprs array would get allocated directly using 'new[]' instead of the allocator associated with ASTContext.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95933 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 22:51:03 +00:00
Ted Kremenek eb3b324800 Allocate the SubExprs array in ObjCMessageExpr using the allocator associated with ASTContext. This fixes yet another leak (<rdar://problem/7639260>).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95930 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 22:41:21 +00:00
Douglas Gregor 4800d95d28 When AST merging for record declarations fails, warn about the
incompatibility and show where the structural differences are. For
example:

struct1.c:36:8: warning: type 'struct S7' has incompatible definitions
in different translation units
struct S7 { int i : 8; unsigned j : 8; } x7;
       ^
struct1.c:36:33: note: bit-field 'j' with type 'unsigned int' and length 8 here
struct S7 { int i : 8; unsigned j : 8; } x7;
                                ^
struct2.c:33:33: note: bit-field 'j' with type 'unsigned int' and length 16 here
struct S7 { int i : 8; unsigned j : 16; } x7;
                                ^

There are a few changes to make this work:
  - ASTImporter now has only a single Diagnostic object, not multiple
  diagnostic objects. Otherwise, having a warning/error printed via
  one Diagnostic and its note printed on the other Diagnostic could
  cause the note to be suppressed.
  - Implemented import functionality for IntegerLiteral (along with
  general support for statements and expressions)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95900 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 19:21:55 +00:00
Eli Friedman d42ba8a578 Add builtins from PR5255. Implementations coming soon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95894 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 19:02:42 +00:00
Anders Carlsson 848fa64143 More vtable layout dumper improvements. Handle destructors, dump the complete function type of the member functions (using PredefinedExpr::ComputeName.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95887 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 18:20:28 +00:00
Benjamin Kramer 8aa79947cb Remove noisy semicolon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95872 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 11:33:47 +00:00
Ted Kremenek 5c41ee8c49 Patch by Cristian Draghici:
Enhance the printf format string checking when using the format
specifier flags ' ', '0', '+' with the 'p' or 's' conversions (since
they are nonsensical and undefined).  This is similar to GCC's
checking.

Also warning when a precision is used with the 'p' conversin
specifier, since it has no meaning.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95869 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 09:27:41 +00:00
Anders Carlsson 824d7ea07a Check in the beginnings of my new vtable layout builder idea.
Right now, it's off by default but can be tested by passing -fdump-vtable-layouts to clang -cc1. This option will cause all vtables that will normally be emitted as part of codegen to also be dumped using the new layout code.

I've also added a very simple new vtable layout test case.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95865 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 08:02:13 +00:00
Ted Kremenek 5961611172 Use the allocator associated with ASTContext to allocate the args
array associated with NonNullAttr.  This fixes yet another leak when
ASTContext uses a BumpPtrAllocator.

Fixes: <rdar://problem/7637150>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95863 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 07:31:47 +00:00
Ted Kremenek 3478eb6872 Have ~ASTContext() delete StoredDeclsMap (internal to DeclContext) by
storing the set of StoredDeclsMaps in an internal vector of void*.
This isn't an ideal solution, but for the time being this fixes a
major memory leak with these DenseMaps not being freed.

Fixes: <rdar://problem/7634755>



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95861 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 07:12:28 +00:00
Ted Kremenek 3d2c43e9a7 Remove use of 'std::string' from Attr objects, using instead a byte
array allocated using the allocator in ASTContext.  This addresses
these strings getting leaked when using a BumpPtrAllocator (in
ASTContext).

Fixes: <rdar://problem/7636765>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95853 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 05:28:37 +00:00
Daniel Dunbar 64952508c2 Driver: Add -rewrite-objc, which is an interface to clang -cc1 -rewrite-objc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95849 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 03:16:21 +00:00
Douglas Gregor 2d5b70386d Remove another redundant ASTContext parameter
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95843 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 01:30:34 +00:00
Douglas Gregor 838db383b6 Eliminate a bunch of unnecessary ASTContexts from members functions of
Decl subclasses. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95841 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 01:19:42 +00:00
Fariborz Jahanian e9ff443040 Diagnose when user provided getter is being used as lvalue
using property dot-syntax. Fixes radar 7628953.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95838 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 01:11:34 +00:00
Douglas Gregor 952b017601 Eliminate the ASTContext parameter from RecordDecl::getDefinition()
and CXXRecordDecl::getDefinition(); it's totally unnecessary. No
functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95836 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 01:04:33 +00:00
Douglas Gregor 96a01b4acf Implement basic AST merging for classes, structs, and unions in C.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95833 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 00:48:18 +00:00
Charles Davis 5a0164d6ab Add support for the force_align_arg_pointer attribute. This is an x86-specific
attribute, so it uses Anton's new target-specific attribute support. It's
supposed to ensure that the stack is 16-byte aligned, but since necessary
support is lacking from LLVM, this is a no-op for now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95820 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10 23:06:52 +00:00
Douglas Gregor a404ea673c Implement basic support for merging function declarations across
translation units.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95794 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10 19:54:31 +00:00
Daniel Dunbar b2987d159a Switch to using -fsjlj-exceptions instead of hard-coding it. Notably, this fixes
calls to the UnwindResumeOrRethrow function for C++/Obj-C exception handling,
for Darwin ARM.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95787 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10 18:49:11 +00:00
Daniel Dunbar 7348288456 clang -cc1: Add -fsjlj-exceptions, which requires far too much button pushing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95785 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10 18:48:44 +00:00
John McCall 6b2accb479 Improve access control diagnostics. Perform access control on member-pointer
conversions.  Fix an access-control bug where privileges were not considered
at intermediate points along the inheritance path.  Prepare for friends.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95775 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10 09:31:12 +00:00
Douglas Gregor 885237354f Implement basic support for importing source locations from one AST
into another AST, including their include history. Here's an example
error that involves a conflict merging a variable with different types
in two translation units (diagnosed in the third AST context into
which everything is merged).

/Volumes/Data/dgregor/Projects/llvm/tools/clang/test/ASTMerge/Inputs/var2.c:3:5:
error: external variable 'x2' declared with incompatible types in
different translation units ('int' vs. 'double')
int x2;
    ^
In file included from
/Volumes/Data/dgregor/Projects/llvm/tools/clang/test/ASTMerge/Inputs/var1.c:3:
/Volumes/Data/dgregor/Projects/llvm/tools/clang/test/ASTMerge/Inputs/var1.h:1:8:
note: declared here with type 'double'
double x2;
       ^

Although we maintain include history, we do not maintain macro
instantiation history across a merge. Instead, we map down to the
spelling location (for now!).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95732 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10 00:15:17 +00:00
Douglas Gregor 89cc9d6e2a Complain about types and declarations that we don't know how to import.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95706 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-09 22:48:33 +00:00
Douglas Gregor 79a9a34179 Move the diagnostic argument formatting function out of Sema and make
it available within the AST library, of which Sema is one client. No
functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95701 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-09 22:26:47 +00:00
Fariborz Jahanian 412e798941 Implement synthesizing properties by default.
This is a non-fragile-abi feature only. Since it
breaks existing code, it is currently placed under
-fobjc-nonfragile-abi2 option for test purposes only
until further notice. WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95685 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-09 19:31:38 +00:00
Douglas Gregor 9bed879896 Introduce a testbed for merging multiple ASTs into a single AST
context with the AST importer. WIP, still useless but at least it has
a test.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95683 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-09 19:21:46 +00:00
Douglas Gregor de09096a9e Implement a specific diagnostic when a class template partial
specialization does not use any of its template parameters, then
recover far more gracefully. Fixes PR6181.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95629 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-09 00:37:32 +00:00
Douglas Gregor a3890baf12 Clean up the CIndex interface to diagnostic ranges. Thanks, Daniel!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95602 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 23:11:56 +00:00
Douglas Gregor 0087e1a12b Note that a CXIndex cannot be destroyed until after all of its translation units have been destroyed
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95598 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 23:03:06 +00:00
Douglas Gregor fd6a0887a0 Eliminate a pointer of storage in each ObjCInterfaceType and
ObjCObjectPointerType AST node by allocating the list of protocols
after the type node itself. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95597 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 22:59:26 +00:00
Douglas Gregor ba915af51c Warn when cases are missing from a switch on a value of enumeration
type (-Wswitch), from Michal! 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95592 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 22:24:16 +00:00
Douglas Gregor 591bd3cb60 Keep track of whether a tag was defined in a declarator vs. being
defined by itself, from Enea Zaffanella!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95586 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 22:07:33 +00:00
Douglas Gregor 089459a16b Implement basic importing and merging of variable declarations within
the AST importer. This doesn't actually do anything (yet), because we
don't have driver logic for merging ASTs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95570 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 21:09:39 +00:00
Sebastian Redl 39d67117f8 When placing an annotation token over an existing annotation token, make sure that the new token's range extends to the end of the old token. Assert that in AnnotateCachedTokens. Fixes PR6248.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95555 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 19:35:18 +00:00
Benjamin Kramer b6f3c70fb8 Reapply r95546, no intended change in performance or functionality.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95552 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 18:38:55 +00:00
Ted Kremenek e7d03121af Revert 95546 since it changed the algorithmic characteristics of the convention lookup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95547 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 16:45:01 +00:00
Benjamin Kramer de69f70443 Simplify code with StringRef.
3 files changed, 76 insertions(+), 153 deletions(-)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95546 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 16:39:00 +00:00
Ted Kremenek 1397663af9 Revert 95541.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95545 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 16:18:51 +00:00
Douglas Gregor 169fba50da Cache imported types
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95543 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 15:18:58 +00:00
Zhongxing Xu 6f8c430a95 Rename: GRState::getSVal(Stmt*) => getExprVal(),
GRState::getSVal(MemRegion*) => Load().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95541 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 09:30:02 +00:00
Zhongxing Xu 52535688b1 Unify the implementation of getLValueElement of store managers.
It's more sophisticated than the original one of BasicStore. But it does
matter. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95536 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 08:17:02 +00:00
Zhongxing Xu c1511e0499 Unify the implementation of getLValueIvar and getLValueField of store managers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95535 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 07:58:06 +00:00
Zhongxing Xu 459731d468 Move common methods to the base StoreManager class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95534 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 07:10:35 +00:00
Zhongxing Xu 2a393db096 ASTContext is now a reference member of StoreManager.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95531 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 06:00:22 +00:00