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

2619 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor e2dedf8f61 Add public placement-delete operators. These are automatically used if the allocation throws
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64056 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-08 00:29:56 +00:00
Anders Carlsson 89941c1c68 Improve Sema of the cleanup attribute somewhat.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64047 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-07 23:16:50 +00:00
Ted Kremenek 7a9bb52171 Commit header.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64042 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-07 22:46:46 +00:00
Ted Kremenek 8189cde56b Overhaul of Stmt allocation:
- Made allocation of Stmt objects using vanilla new/delete a *compiler
  error* by making this new/delete "protected" within class Stmt.
- Now the only way to allocate Stmt objects is by using the new
  operator that takes ASTContext& as an argument.  This ensures that
  all Stmt nodes are allocated from the same (pool) allocator.
- Naturally, these two changes required that *all* creation sites for
  AST nodes use new (ASTContext&).  This is a large patch, but the
  majority of the changes are just this mechanical adjustment.
- The above changes also mean that AST nodes can no longer be
  deallocated using 'delete'.  Instead, one most do
  StmtObject->Destroy(ASTContext&) or do
  ASTContextObject.Deallocate(StmtObject) (the latter not running the
  'Destroy' method).

Along the way I also...
- Made CompoundStmt allocate its array of Stmt* using the allocator in
  ASTContext (previously it used std::vector).  There are a whole
  bunch of other Stmt classes that need to be similarly changed to
  ensure that all memory allocated for ASTs comes from the allocator
  in ASTContext.
- Added a new smart pointer ExprOwningPtr to Sema.h.  This replaces
  the uses of llvm::OwningPtr within Sema, as llvm::OwningPtr used
  'delete' to free memory instead of a Stmt's 'Destroy' method.

Big thanks to Doug Gregor for helping with the acrobatics of making
'new/delete' private and the new smart pointer ExprOwningPtr!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63997 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-07 01:47:29 +00:00
Sebastian Redl 7878ffde0c Add negative test cases and fix diagnostics for member pointer dereferencing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63987 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-07 00:41:42 +00:00
Sebastian Redl 224605064a Implement dereferencing of pointers-to-member.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63983 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-07 00:15:38 +00:00
Douglas Gregor ddc29e116d Semantic checking for class template declarations and
redeclarations. For example, checks that a class template
redeclaration has the same template parameters as previous
declarations.

Detangled class-template checking from ActOnTag, whose logic was
getting rather convoluted because it tried to handle C, C++, and C++
template semantics in one shot.

Made some inroads toward eliminating extraneous "declaration does not
declare anything" errors by adding an "error" type specifier.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63973 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 22:42:48 +00:00
Ted Kremenek 4398a78095 Update comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63961 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 21:15:34 +00:00
Ted Kremenek 6e94ef5696 Move StringLiteral to allocate its internal string data using the allocator in
ASTContext. This required changing all clients to pass in the ASTContext& to the
constructor of StringLiteral. I also changed all allocations of StringLiteral to
use new(ASTContext&).

Along the way, I updated a bunch of new()'s in StmtSerialization.cpp to use the
allocator from ASTContext& (not complete).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63958 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 19:55:15 +00:00
Ted Kremenek 42542c6a4b Added special versions of new[]/delete[] to complement the new/delete which uses ASTContext's allocator. Updated some comments along the way.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63949 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 19:10:16 +00:00
Douglas Gregor 4ce205f94c Diagnose attempts to define a namespace member out-of-line when no
matching member exists. Thanks to Piotr Rak for reporting the problem!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63939 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 17:46:57 +00:00
Chris Lattner f73903a1de Add an implementation of -dM that follows GCC closely enough to permit
diffing the output of:
  clang -dM -o - -E -x c foo.c | sort


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63926 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 06:45:26 +00:00
Chris Lattner 09b5c1d08a add interface for walking macro table.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63925 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 06:26:42 +00:00
Chris Lattner 2b5abf515f simplify and refactor a bunch of type definition code in Preprocessor
predefines buffer initialization.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63919 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 05:04:11 +00:00
Chris Lattner 15221422ed don't emit any diagnostics after a fatal one.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63914 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 04:16:02 +00:00
Douglas Gregor fab9d67ceb Improve the representation of template type parameters. We now
canonicalize by template parameter depth, index, and name, and the
unnamed version of a template parameter serves as the canonical.

TemplateTypeParmDecl no longer needs to inherit from
TemplateParmPosition, since depth and index information is present
within the type.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63899 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 23:33:38 +00:00
Chris Lattner 7fc24e2d47 allow mapping errors to fatal.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63896 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 22:56:06 +00:00
Chris Lattner da0cbc1ad4 add support to the diagnostics machinery for mapping warnings and
errors to 'fatal' error severity.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63894 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 22:47:05 +00:00
Douglas Gregor 7dda67d8de Improvements and fixes for name lookup with using directives, from Piotr Rak!
Also, put Objective-C protocols into their own identifier
namespace. Otherwise, we find protocols when we don't want to in C++
(but not in C).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63877 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 19:25:20 +00:00
Sebastian Redl 76ad2e8557 Put the invalid flag of OwningResult into the Action pointer.
This shrinks OwningResult by one pointer. Since it is no longer larger than OwningPtr, merge the two.
This leads to simpler client code and speeds up my benchmark by 2.7%.
For some reason, this exposes a previously hidden bug, causing a regression in SemaCXX/condition.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63867 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 15:02:23 +00:00
Chris Lattner 3fa8f7491a privatize some stuff.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63847 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 07:27:29 +00:00
Zhongxing Xu 026c66395b Make SymbolicRegion subclass TypedRegion, for symbols usually have types, so
do the symblic regions associated with them and we need them to be typed.

Current SymbolicRegion::getRValueType() method is very restricting. It may be
modified when we are more clear about what could be the types of symblic
regions.

BasicConstraintManager::Assume() is changed due to that now SymblicRegion is a
subclass of SubRegion.
 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63844 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 06:57:29 +00:00
Ted Kremenek cf118d41f7 Overhaul BugReporter interface and implementation. The new interface cleans up
the ownership of BugTypes and BugReports. Now BugReports are owned by BugTypes,
and BugTypes are owned by the BugReporter object.

The major functionality change in this patch is that reports are not immediately
emitted by a call to BugReporter::EmitWarning (now called EmitReport), but
instead of queued up in report "equivalence classes". When
BugReporter::FlushReports() is called, it emits one diagnostic per report
equivalence class. This provides a nice cleanup with the caching of reports as
well as enables the BugReporter engine to select the "best" path for reporting a
path-sensitive bug based on all the locations in the ExplodedGraph that the same
bug could occur.

Along with this patch, Leaks are now coalesced into a common equivalence class
by their allocation site, and the "summary" diagnostic for leaks now reports the
allocation site as the location of the bug (this may later be augmented to also
provide an example location where the leak occurs).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63796 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 23:49:09 +00:00
Douglas Gregor eeb15d499f Implement semantic analysis for the GNU flexible array initialization
extension. The interaction with designated initializers is a
bit... interesting... but we follow GNU's lead and don't permit too
much crazy code in this area.

Also, make the "excess initializers" error message a bit more
informative.

Addresses PR2561: http://llvm.org/bugs/show_bug.cgi?id=2561


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63785 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 22:46:25 +00:00
Mike Stump 98eb8a7a70 Add support for blocks with explicit return types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63784 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 22:31:32 +00:00
Daniel Dunbar d604c40e93 Add -femit-all-decls codegen option.
- Emits all declarations, even unused (static) ones.
 - Useful when doing minimization of codegen problems (otherwise
   problems localized to a static function aren't minimized well).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63776 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 21:19:06 +00:00
Douglas Gregor d6efafa514 Improve documentation for Sema::getTypeName. Also, it's return type is
DeclTy*, not TypeTy*.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63756 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 19:16:12 +00:00
Douglas Gregor aaba5e346d Basic representation of C++ class templates, from Andrew Sutton.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63750 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 19:02:06 +00:00
Douglas Gregor 47b9a1ca55 Some name-lookup-related fixes, from Piotr Rak!
- Changes Lookup*Name functions to return NamedDecls, instead of
Decls. Unfortunately my recent statement that it will simplify lot of
code, was not quite right, but it simplifies some...
- Makes MergeLookupResult SmallPtrSet instead of vector, following
Douglas suggestions.
- Adds %qN format for printing qualified names to Diagnostic.
- Avoids searching for using-directives in Scopes, which are not
DeclScope, during unqualified name lookup.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63739 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 17:27:36 +00:00
Douglas Gregor b696ea3a06 Diagnose ambiguities in getTypeName. Fixes http://llvm.org/bugs/show_bug.cgi?id=3475
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63737 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 17:00:24 +00:00
Douglas Gregor 17330019f0 Fix our semantic analysis of
unqualified-id '('

in C++. The unqualified-id might not refer to any declaration in our
current scope, but declarations by that name might be found via
argument-dependent lookup. We now do so properly.

As part of this change, CXXDependentNameExpr, which was previously
designed to express the unqualified-id in the above constructor within
templates, has become UnresolvedFunctionNameExpr, which does
effectively the same thing but will work for both templates and
non-templates.

Additionally, we cope with all unqualified-ids, since ADL also applies
in cases like

  operator+(x, y)




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63733 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 15:01:18 +00:00
Chris Lattner 137b6a6149 Implement handling of file entry/exit notifications from GNU
line markers, including maintenance of the virtual include stack.

For something like this:

# 42 "bar.c" 1
# 142 "bar2.c" 1

#warning zappa
# 92 "bar.c" 2
#warning gonzo
# 102 "foo.c" 2
#warning bonkta


we now produce these three warnings:

#1:
In file included from foo.c:3:
In file included from bar.c:42:
bar2.c:143:2: warning: #warning zappa
#warning zappa
 ^

#2:
In file included from foo.c:3:
bar.c:92:2: warning: #warning gonzo
#warning gonzo
 ^

#3:
foo.c:102:2: warning: #warning bonkta
#warning bonkta
 ^




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63722 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 06:25:26 +00:00
Chris Lattner 6b3066780b make getFileCharacteristic linetable aware. line markers that
play around with the 'is system header' bit now function correctly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63720 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 05:33:01 +00:00
Chris Lattner 9d79ebac47 propagate linemarker flags down into the the line table, currently
ignoring include stack push/pop info though.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63719 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 05:21:58 +00:00
Zhongxing Xu 97c4d4759d Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63715 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 02:30:11 +00:00
Chris Lattner a3824c6348 simplify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63708 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 01:54:28 +00:00
Chris Lattner 30fc933e5f lower the interface to getLineNumber like we did for
getColumnNumber.  This fixes a FIXME in 
SourceManager::getPresumedLoc because we now just decompose
the sloc once.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63701 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 01:06:56 +00:00
Chris Lattner 7da5aea766 make SM::getColumnNumber take a predecomposed FileID/offset, which
makes it clear to clients that they have to pick an instantiation
or spelling location before calling it and allows optimization based
on that.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63698 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 00:55:58 +00:00
Chris Lattner ac50e3427c more plumbing for #line propagation. Use happy bit #3
out of FileInfo :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63672 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 22:13:05 +00:00
Chris Lattner 4c4ea17d7f stub out basic #line handling calls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63667 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 21:52:55 +00:00
Sebastian Redl ebc07d57be Allow taking the address of data members, resulting in a member pointer.
Pointers to functions don't work yet, and pointers to overloaded functions even less. Also, far too much illegal code is accepted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63655 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 20:19:35 +00:00
Douglas Gregor 2a3009a432 Semantic analysis, ASTs, and unqualified name lookup support for C++
using directives, from Piotr Rak!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63646 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 19:21:40 +00:00
Chris Lattner 00282d6e11 reclaim my precious bit in FileInfo by ensuring that ContentCache objects
are 8-byte aligned.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63630 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 07:41:46 +00:00
Chris Lattner 0d0bf8cf58 switch SourceManager from using an std::map and std::list of
ContentCache objects to using a densemap and list, and allocating
the ContentCache objects from a bump pointer.  This does not speed
up or slow down things substantially, but gives us control over 
their alignment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63628 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 07:30:45 +00:00
Chris Lattner 1100258c19 add #include to make more self-contained.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63624 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 07:20:54 +00:00
Chris Lattner 90f255356e Content Cache only needs to be 4-byte aligned. Since it is stored in
an std::set, we can't make a strong guarantee about what its alignment
will be.  Since I don't need the 3rd bit anyway yet, just change the
assertion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63588 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 01:28:04 +00:00
Douglas Gregor 64650af7cc Add a macro-based enumeration of all of the Decl nodes (like we do
with Stmt/Expr nodes), and convert some of the more mundane
switch-on-all-decl-kinds uses over to use this new file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63570 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-02 23:39:07 +00:00
Douglas Gregor 669c9a28fa Split specific_decl_iterator, which had a run-time field for
determining what decls are acceptable, into specific_decl_iterator
(in which all decls matching the SpecificDecl type requirements are
acceptable) and filtered_decl_iterator (which also does a run-time
check via a member pointer non-type template parameter). This saves
some space in the iterators.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63535 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-02 18:25:48 +00:00
Douglas Gregor d6f0b4e97e Slim down the specific_decl_iterator, since NULL denotes the end of the range. Good eyes, Chris
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63528 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-02 17:56:05 +00:00
Douglas Gregor 87fd703e09 Check value-initializations that occur when an initializer list
provides too few elements.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63525 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-02 17:43:21 +00:00