]> granicus.if.org Git - clang/log
clang
16 years agoAdd isSubRegionOf() method to SubRegion.
Zhongxing Xu [Thu, 8 Jan 2009 13:17:14 +0000 (13:17 +0000)]
Add isSubRegionOf() method to SubRegion.

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

16 years agoFix comment because we could have arbitrary number of overloaded functions with
Zhongxing Xu [Thu, 8 Jan 2009 07:37:03 +0000 (07:37 +0000)]
Fix comment because we could have arbitrary number of overloaded functions with
the same name.

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

16 years agoPTH: Hook up getSpelling() caching in PTHLexer. This results in a nice
Ted Kremenek [Thu, 8 Jan 2009 04:30:32 +0000 (04:30 +0000)]
PTH: Hook up getSpelling() caching in PTHLexer. This results in a nice
performance gain. Here's what we see for -Eonly on Cocoa.h (using PTH):

- wall time decreases by 21% (26% speedup overall)
- system time decreases by 35%
- user time decreases by 6%

These reductions are due to not paging source files just to get spellings for
literals. The solution in place doesn't appear to be 100% yet, as we still see
some of the pages for source files getting mapped in. Using -print-stats, we see
that SourceManager maps in 7179K less bytes of source text (reduction of 75%).
Will investigate why the remaining 25% are getting paged in.

With these changes, here's how PTH compares to non-PTH on Cocoa.h:
  -Eonly: PTH takes 64% of the time as non-PTH (54% speedup)
  -fsyntax-only: PTH takes 89% of the time as non-PTH (11% speedup)

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

16 years agoPTH:
Ted Kremenek [Thu, 8 Jan 2009 02:47:16 +0000 (02:47 +0000)]
PTH:
- Added stub PTHLexer::getSpelling() that will be used for fetching cached
  spellings from the PTH file.  This doesn't do anything yet.
- Added a hook in Preprocessor::getSpelling() to call PTHLexer::getSpelling()
  when using a PTHLexer.
- Updated PTHLexer to read the offsets of spelling tables in the PTH file.

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

16 years agoRemove debugging variable I forgot to remove in my last commit.
Ted Kremenek [Thu, 8 Jan 2009 02:44:52 +0000 (02:44 +0000)]
Remove debugging variable I forgot to remove in my last commit.

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

16 years agoCache the "spellings" of string, character, and numeric literals in the PTH
Ted Kremenek [Thu, 8 Jan 2009 02:44:06 +0000 (02:44 +0000)]
Cache the "spellings" of string, character, and numeric literals in the PTH
file. For Cocoa.h, this enlarges the PTH file by 310K (4%).

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

16 years agoRefactor CacheTokens to use a PTHWriter class that creates and manages most of the...
Ted Kremenek [Thu, 8 Jan 2009 01:17:37 +0000 (01:17 +0000)]
Refactor CacheTokens to use a PTHWriter class that creates and manages most of the PTH generation data structures.  No functionality change.

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

16 years agoObjc's compatibility-alias semantics and code
Fariborz Jahanian [Thu, 8 Jan 2009 01:10:55 +0000 (01:10 +0000)]
Objc's compatibility-alias semantics and code
gen issue fix.

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

16 years agoUpdate some doxygen comments to be more rich. Remove StoreManager::GetRegionSVal.
Ted Kremenek [Wed, 7 Jan 2009 22:56:17 +0000 (22:56 +0000)]
Update some doxygen comments to be more rich.  Remove StoreManager::GetRegionSVal.

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

16 years agoRefactor MemRegionManager instance variable into parent class. No functionality...
Ted Kremenek [Wed, 7 Jan 2009 22:18:50 +0000 (22:18 +0000)]
Refactor MemRegionManager instance variable into parent class.  No functionality change.

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

16 years agoFix PR clang/3291
Douglas Gregor [Wed, 7 Jan 2009 21:36:02 +0000 (21:36 +0000)]
Fix PR clang/3291

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

16 years agoFix printing of member references to avoid displaying implicitly-generated member...
Douglas Gregor [Wed, 7 Jan 2009 21:26:07 +0000 (21:26 +0000)]
Fix printing of member references to avoid displaying implicitly-generated member references, e.g., for anonymous struct/unions or implicit 'this' in member functions

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

16 years agoDon't ICE when messaging on 'super' receiver when class
Fariborz Jahanian [Wed, 7 Jan 2009 21:01:41 +0000 (21:01 +0000)]
Don't ICE when messaging on 'super' receiver when class
of category implementation is undeclared. Issue error instead.

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

16 years agoAnother nasty code gen. bug with trivial fix. Calling class
Fariborz Jahanian [Wed, 7 Jan 2009 20:11:22 +0000 (20:11 +0000)]
Another nasty code gen. bug with trivial fix. Calling class
method on 'super' receiver in a category implementation.
Other simpler cases were working by accident.

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

16 years agoFinished semantic analysis of anonymous unions in C++.
Douglas Gregor [Wed, 7 Jan 2009 19:46:03 +0000 (19:46 +0000)]
Finished semantic analysis of anonymous unions in C++.

Duplicate-member checking within classes is still a little messy, and
anonymous unions are still completely broken in C. We'll need to unify
the handling of fields in C and C++ to make this code applicable in
both languages.

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

16 years agoccc: Make proper synthetic arguments in places we have to construct
Daniel Dunbar [Wed, 7 Jan 2009 18:54:26 +0000 (18:54 +0000)]
ccc: Make proper synthetic arguments in places we have to construct
"fake" options, allowing Tools to be oblivious to whether an argument
is real or synthetic. This kills off DerivedArg & a number of FIXMEs.

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

16 years agoccc: Change Command to take list of strings for argv instead of Arg
Daniel Dunbar [Wed, 7 Jan 2009 18:40:45 +0000 (18:40 +0000)]
ccc: Change Command to take list of strings for argv instead of Arg
instances; this just complicated things and doesn't seem to provide
any benefit.

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

16 years agoObjC AST cleanups/simplifications (phase 1).
Steve Naroff [Wed, 7 Jan 2009 17:57:40 +0000 (17:57 +0000)]
ObjC AST cleanups/simplifications (phase 1).
Add ObjCContainerDecl class and have ObjCInterfaceDecl/ObjCCategoryDecl/ObjCProtocolDecl inherit from it.

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

16 years agoUse DeclContext::getLookupContext wherever necessary to ensure that we look through...
Douglas Gregor [Wed, 7 Jan 2009 16:34:42 +0000 (16:34 +0000)]
Use DeclContext::getLookupContext wherever necessary to ensure that we look through transparent contexts

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

16 years agoTest case for anonymous unions in C++
Douglas Gregor [Wed, 7 Jan 2009 16:22:09 +0000 (16:22 +0000)]
Test case for anonymous unions in C++

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

16 years agoWhen determining whether a variable is a file-scoped variable, check
Douglas Gregor [Wed, 7 Jan 2009 02:48:43 +0000 (02:48 +0000)]
When determining whether a variable is a file-scoped variable, check
out its lookup context (to see through linkage
specifications). Addresses <rdar://problem/6477142>.

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

16 years agoccc: Extend ArgList to support indexing into a synthetic arg array
Daniel Dunbar [Wed, 7 Jan 2009 01:57:39 +0000 (01:57 +0000)]
ccc: Extend ArgList to support indexing into a synthetic arg array
(for killing off DerivedArg).

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

16 years agoccc: Refactor so that all accesses to actual input strings go through
Daniel Dunbar [Wed, 7 Jan 2009 01:29:28 +0000 (01:29 +0000)]
ccc: Refactor so that all accesses to actual input strings go through
the ArgList.

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

16 years agoUpdate checker build.
Ted Kremenek [Wed, 7 Jan 2009 01:10:24 +0000 (01:10 +0000)]
Update checker build.

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

16 years agoInitial implementation of anonymous unions (and, as a GNU extension,
Douglas Gregor [Wed, 7 Jan 2009 00:43:41 +0000 (00:43 +0000)]
Initial implementation of anonymous unions (and, as a GNU extension,
structures and classes) in C++. Covers name lookup and the synthesis
and member access for the unnamed objects/fields associated with
anonymous unions.

Some C++ semantic checks are still missing (anonymous unions can't
have function members, static data members, etc.), and there is no
support for anonymous structs or unions in C.

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

16 years agoThis commit reflects changes to the retain/release checker motivated by my
Ted Kremenek [Wed, 7 Jan 2009 00:39:56 +0000 (00:39 +0000)]
This commit reflects changes to the retain/release checker motivated by my
recent discussions with Thomas Clement and Ken Ferry concerning the "fundamental
rule" for Cocoa memory management
(http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html).

Here is the revised behavior of the checker concerning tracking retain/release
counts for objects returned from message expressions involving instance methods:

1) Track the returned object if the return type of the message expression is
id<..>, id, or a pointer to *any* object that subclasses NSObject. Such objects
are assumed to have a retain count. Previously the checker only tracked objects
when the receiver of the message expression was part of the standard Cocoa API
(i.e., had class names prefixed with 'NS'). This should significantly expand the
amount of checking performed.

2) Consider the object owned if the selector of the message expression contains
"alloc", "new", or "copy". Previously we also considered "create", but this
doesn't follow from the fundamental rule (discussions with the Cocoa folks
confirms this).

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

16 years agoccc (old): Pass -arch through to assembler if given.
Daniel Dunbar [Wed, 7 Jan 2009 00:03:20 +0000 (00:03 +0000)]
ccc (old): Pass -arch through to assembler if given.

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

16 years agoAllow Objective-C entities to be declared within a transparent context
Douglas Gregor [Tue, 6 Jan 2009 23:51:29 +0000 (23:51 +0000)]
Allow Objective-C entities to be declared within a transparent context
nested in the translation unit. This fixes <rdar://problem/6476070>.

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

16 years agoSourceManager: Implement "lazy" creation of MemBuffers for source files.
Ted Kremenek [Tue, 6 Jan 2009 22:43:04 +0000 (22:43 +0000)]
SourceManager: Implement "lazy" creation of MemBuffers for source files.

- Big Idea:
   Source files are now mmaped when ContentCache::getBuffer() is first called.
   While this doesn't change the functionality when lexing regular source files,
   it can result in source files not being paged in when using PTH.

- Performance change:
  - No observable difference (-fsyntax-only/-Eonly) on Cocoa.h when doing
    regular source lexing.
  - No observable time difference (-fsyntax-only/-Eonly) on Cocoa.h when using
    PTH. We do observe, however, a reduction of 279K in memory mapped source
    code (3% reduction). The majority of pages from Cocoa.h (and friends) are
    still being pulled in, however, because any literal will cause
    Preprocessor::getSpelling() to be called (causing the source for the file to
    get pulled in). The next possible optimization is to cache literal strings
    in the PTH file to avoid the need for the original header sources entirely.

- Right now there is a preprocessor directive to toggle between "lazy" and
  "eager" creation of MemBuffers. This is not permanent, and is there in the
  short term to just test additional optimizations.

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

16 years agoRemove redunant (and incorrect) call to SourceManager::PrintStats(). This would...
Ted Kremenek [Tue, 6 Jan 2009 22:16:26 +0000 (22:16 +0000)]
Remove redunant (and incorrect) call to SourceManager::PrintStats().  This would be called after a SourceManager was 'cleared', so it printed bogus results.  Moreover, these stats are already printed earlier in the code path.

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

16 years agoAnother tweak to handle the MS extensions (<rdar://problem/5956221>).
Steve Naroff [Tue, 6 Jan 2009 19:34:12 +0000 (19:34 +0000)]
Another tweak to handle the MS extensions (<rdar://problem/5956221>).

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

16 years agoAdd whitespace to silence the following warning in a Release build: warning: suggest...
Ted Kremenek [Tue, 6 Jan 2009 19:17:58 +0000 (19:17 +0000)]
Add whitespace to silence the following warning in a Release build: warning: suggest a space before ';' or explicit braces around empty body in 'while' statement

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

16 years agoReturn UnknownVal in RegionStoreManager::getSizeInElements() for unsupported regions...
Ted Kremenek [Tue, 6 Jan 2009 19:12:06 +0000 (19:12 +0000)]
Return UnknownVal in RegionStoreManager::getSizeInElements() for unsupported regions.  This silences a warning when compiling Release-Asserts builds.

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

16 years agoCouple of code gen. fixes in ObjC's colection-statement. Hard
Fariborz Jahanian [Tue, 6 Jan 2009 18:56:31 +0000 (18:56 +0000)]
Couple of code gen. fixes in ObjC's colection-statement. Hard
to track down, easy to fix. This is on going.

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

16 years agoFix <rdar://problem/5956221> clang ObjC rewriter: Microsoft-specific __fastcall keywo...
Steve Naroff [Tue, 6 Jan 2009 17:40:00 +0000 (17:40 +0000)]
Fix <rdar://problem/5956221> clang ObjC rewriter: Microsoft-specific __fastcall keyword unrecognized.

This fix is C++ specific.

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

16 years agoFix a typo.
Cedric Venet [Tue, 6 Jan 2009 16:22:54 +0000 (16:22 +0000)]
Fix a typo.

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

16 years ago- Various comment typo fixes in Sema.h
Chris Lattner [Tue, 6 Jan 2009 07:27:21 +0000 (07:27 +0000)]
- Various comment typo fixes in Sema.h
- Simplify ParseDeclCXX to use early exit on error instead of nesting.
- Change ParseDeclCXX to using the 'skip on error' form of ExpectAndConsume.
- If we don't see the ; in a using directive, still call the action, for
  hopefully better error recovery.

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

16 years agoit is ok to insert empty source ranges into diagnostics, declare variable in an if.
Chris Lattner [Tue, 6 Jan 2009 07:24:29 +0000 (07:24 +0000)]
it is ok to insert empty source ranges into diagnostics, declare variable in an if.

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

16 years agosimplify some code using 'continue' and the new 'isInIdentifierNamespace' predicate.
Chris Lattner [Tue, 6 Jan 2009 07:20:03 +0000 (07:20 +0000)]
simplify some code using 'continue' and the new 'isInIdentifierNamespace' predicate.

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

16 years agoMinor tweaks to the transparent declcontext patch
Douglas Gregor [Tue, 6 Jan 2009 07:17:58 +0000 (07:17 +0000)]
Minor tweaks to the transparent declcontext patch

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

16 years agoadd a helper method.
Chris Lattner [Tue, 6 Jan 2009 07:16:40 +0000 (07:16 +0000)]
add a helper method.

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

16 years agorename MaybeParseCXXScopeSpecifier -> ParseOptionalCXXScopeSpecifier and
Chris Lattner [Tue, 6 Jan 2009 06:59:53 +0000 (06:59 +0000)]
rename MaybeParseCXXScopeSpecifier -> ParseOptionalCXXScopeSpecifier and
MaybeParseTypeSpecifier -> ParseOptionalTypeSpecifier.

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

16 years agominor code cleanups, reduce indentation since 'if' block can't fall through.
Chris Lattner [Tue, 6 Jan 2009 06:55:51 +0000 (06:55 +0000)]
minor code cleanups, reduce indentation since 'if' block can't fall through.

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

16 years agoccc: Remove ValueArg::setValue, this is no longer used.
Daniel Dunbar [Tue, 6 Jan 2009 06:32:49 +0000 (06:32 +0000)]
ccc: Remove ValueArg::setValue, this is no longer used.

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

16 years agoccc: Track last actual argument instance for each option & change
Daniel Dunbar [Tue, 6 Jan 2009 06:12:13 +0000 (06:12 +0000)]
ccc: Track last actual argument instance for each option & change
driver to lookup this way instead of manually scanning arguments in
multiple places.

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

16 years agodocument annotation tokens.
Chris Lattner [Tue, 6 Jan 2009 06:02:08 +0000 (06:02 +0000)]
document annotation tokens.

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

16 years agoMake Token::setLength assert that the token is not an annotation token.
Chris Lattner [Tue, 6 Jan 2009 05:25:04 +0000 (05:25 +0000)]
Make Token::setLength assert that the token is not an annotation token.

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

16 years agoOops. Un-publicify SrcMgr::ContentCache::Buffer.
Douglas Gregor [Tue, 6 Jan 2009 05:11:04 +0000 (05:11 +0000)]
Oops. Un-publicify SrcMgr::ContentCache::Buffer.

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

16 years agoAdd QualifiedDeclRefExpr, which retains additional source-location
Douglas Gregor [Tue, 6 Jan 2009 05:10:23 +0000 (05:10 +0000)]
Add QualifiedDeclRefExpr, which retains additional source-location
information for declarations that were referenced via a qualified-id,
e.g., N::C::value. We keep track of the location of the start of the
nested-name-specifier. Note that the difference between
QualifiedDeclRefExpr and DeclRefExpr does have an effect on the
semantics of function calls in two ways:
  1) The use of a qualified-id instead of an unqualified-id suppresses
     argument-dependent lookup
  2) If the name refers to a virtual function, the qualified-id
  version will call the function determined statically while the
  unqualified-id version will call the function determined dynamically
  (by looking up the appropriate function in the vtable).

Neither of these features is implemented yet, but we do print out
qualified names for QualifiedDeclRefExprs as part of the AST printing.

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

16 years agorename tok::annot_qualtypename -> tok::annot_typename, which is both
Chris Lattner [Tue, 6 Jan 2009 05:06:21 +0000 (05:06 +0000)]
rename tok::annot_qualtypename -> tok::annot_typename, which is both
shorter and  more accurate.  The type name might not be qualified.

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

16 years agoadd TypeTraits.h to the Xcode project
Chris Lattner [Tue, 6 Jan 2009 05:04:13 +0000 (05:04 +0000)]
add TypeTraits.h to the Xcode project

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

16 years agouse getBuffer() to fix compile error. Ted, please review.
Chris Lattner [Tue, 6 Jan 2009 04:47:20 +0000 (04:47 +0000)]
use getBuffer() to fix compile error.  Ted, please review.

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

16 years agoccc: Use dummy InputOption and UnknownOption classes instead of
Daniel Dunbar [Tue, 6 Jan 2009 02:30:10 +0000 (02:30 +0000)]
ccc: Use dummy InputOption and UnknownOption classes instead of
InputArg and UnknownArg.
 - Every argument now always corresponds to some option, which
   simplifies other code.

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

16 years agoMisc changes to SourceManager::ContentCache:
Ted Kremenek [Tue, 6 Jan 2009 01:55:26 +0000 (01:55 +0000)]
Misc changes to SourceManager::ContentCache:
- 'Buffer' is now private and must be accessed via 'getBuffer()'.
   This paves the way for lazily mapping in source files on demand.
- Added 'getSize()' (which gets the size of the content without
   necessarily accessing the MemBuffer) and 'getSizeBytesMapped()'.
- Modifed SourceManager to use these new methods.  This reduces the
  number of places that actually access the MemBuffer object for a file
  to those that actually look at the character data.

These changes result in no performance change for -fsyntax-only on Cocoa.h.

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

16 years agoccc: Introduce ArgList for keeping input argv & parsed Args together.
Daniel Dunbar [Tue, 6 Jan 2009 01:35:44 +0000 (01:35 +0000)]
ccc: Introduce ArgList for keeping input argv & parsed Args together.

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

16 years agorename these tests to match the attribute.
Chris Lattner [Mon, 5 Jan 2009 23:10:19 +0000 (23:10 +0000)]
rename these tests to match the attribute.

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

16 years agoOptimize stringification a bit to avoid std::string thrashing and
Chris Lattner [Mon, 5 Jan 2009 23:04:18 +0000 (23:04 +0000)]
Optimize stringification a bit to avoid std::string thrashing and
avoid the version of Preprocessor::getSpelling that returns an
std::string.

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

16 years agoRemainder is only valid on integer vector operands.
Daniel Dunbar [Mon, 5 Jan 2009 22:55:36 +0000 (22:55 +0000)]
Remainder is only valid on integer vector operands.

Improve ext vector test case.

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

16 years agoBack out code for handling VectorType's in getFloatingRank.
Daniel Dunbar [Mon, 5 Jan 2009 22:44:35 +0000 (22:44 +0000)]
Back out code for handling VectorType's in getFloatingRank.

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

16 years agoUse CheckVectorOperands when % is applied to a vector type.
Daniel Dunbar [Mon, 5 Jan 2009 22:42:10 +0000 (22:42 +0000)]
Use CheckVectorOperands when % is applied to a vector type.

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

16 years agoImplement getFloatingRank() for extended vectors.
Daniel Dunbar [Mon, 5 Jan 2009 22:14:37 +0000 (22:14 +0000)]
Implement getFloatingRank() for extended vectors.
 - I'm not sure this is appropriate, but it seems reasonable to be
   able to call getFloatingRank on anything which isFloatingType().

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

16 years agoSilence a GCC warning
Sebastian Redl [Mon, 5 Jan 2009 20:53:53 +0000 (20:53 +0000)]
Silence a GCC warning

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

16 years agoPODness and Type Traits
Sebastian Redl [Mon, 5 Jan 2009 20:52:13 +0000 (20:52 +0000)]
PODness and Type Traits

Make C++ classes track the POD property (C++ [class]p4)
Track the existence of a copy assignment operator.
Implicitly declare the copy assignment operator if none is provided.
Implement most of the parsing job for the G++ type traits extension.
Fully implement the low-hanging fruit of the type traits:
__is_pod: Whether a type is a POD.
__is_class: Whether a type is a (non-union) class.
__is_union: Whether a type is a union.
__is_enum: Whether a type is an enum.
__is_polymorphic: Whether a type is polymorphic (C++ [class.virtual]p1).

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

16 years agoAdd prototype ccc rewrite.
Daniel Dunbar [Mon, 5 Jan 2009 19:53:30 +0000 (19:53 +0000)]
Add prototype ccc rewrite.
 - Entry point is tools/ccc/xcc until we are a functional replacement
   for ccc.

This is highly experimental (FIXME/LOC ratio of 3.4%), quite crufty,
and barely usable (and then only on my specific Darwin). However, many
of the right ideas are present, and it already fixes a number of
things gcc gets wrong.

The major missing component is argument translation for tools
(translating driver arguments into cc1/ld/as/etc. arguments). This is
a large part of the driver functionality and will probably double the
LOC, but my hope is that the current architecture is relatively
stable.

Documentation & motivation to follow soon...

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

16 years agoAdd forgotten test case for linkage specifications
Douglas Gregor [Mon, 5 Jan 2009 19:50:09 +0000 (19:50 +0000)]
Add forgotten test case for linkage specifications

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

16 years agoIntroduce support for "transparent" DeclContexts, which are
Douglas Gregor [Mon, 5 Jan 2009 19:45:36 +0000 (19:45 +0000)]
Introduce support for "transparent" DeclContexts, which are
DeclContexts whose members are visible from enclosing DeclContexts up
to (and including) the innermost enclosing non-transparent
DeclContexts. Transparent DeclContexts unify the mechanism to be used
for various language features, including C enumerations, anonymous
unions, C++0x inline namespaces, and C++ linkage
specifications. Please refer to the documentation in the Clang
internals manual for more information.

Only enumerations and linkage specifications currently use transparent
DeclContexts.

Still to do: use transparent DeclContexts to implement anonymous
unions and GCC's anonymous structs extension, and, later, the C++0x
features. We also need to tighten up the DeclContext/ScopedDecl link
to ensure that every ScopedDecl is in a single DeclContext, which
will ensure that we can then enforce ownership and reduce the memory
footprint of DeclContext.

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

16 years agosimplify Preprocessor::getSpelling now that identifiers carry around
Chris Lattner [Mon, 5 Jan 2009 19:44:41 +0000 (19:44 +0000)]
simplify Preprocessor::getSpelling now that identifiers carry around
their length.

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

16 years agoFix an uninitialized-variable warning
Douglas Gregor [Mon, 5 Jan 2009 17:18:30 +0000 (17:18 +0000)]
Fix an uninitialized-variable warning

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

16 years agoremove optimization to avoid looking ahead for cases like ::foo. This
Chris Lattner [Mon, 5 Jan 2009 03:55:46 +0000 (03:55 +0000)]
remove optimization to avoid looking ahead for cases like ::foo.  This
isn't worth the complexity and the code already does a ton of lookahead.

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

16 years agosimplify some code.
Chris Lattner [Mon, 5 Jan 2009 02:07:19 +0000 (02:07 +0000)]
simplify some code.

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

16 years agoRearrange some code in TryAnnotateTypeOrScopeToken to make it
Chris Lattner [Mon, 5 Jan 2009 01:49:50 +0000 (01:49 +0000)]
Rearrange some code in TryAnnotateTypeOrScopeToken to make it
early exit for C and avoid template lookup for C.

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

16 years agoFix a bug where we'd try to look beyond the current cached tokens when
Chris Lattner [Mon, 5 Jan 2009 01:42:04 +0000 (01:42 +0000)]
Fix a bug where we'd try to look beyond the current cached tokens when
not in backtracking mode.  This was just using the wrong predicate.

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

16 years agoPass '-undefined- to the linker
Anders Carlsson [Mon, 5 Jan 2009 01:24:39 +0000 (01:24 +0000)]
Pass '-undefined- to the linker

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

16 years agoTryAnnotateTypeOrScopeToken and TryAnnotateCXXScopeToken can
Chris Lattner [Mon, 5 Jan 2009 01:24:05 +0000 (01:24 +0000)]
TryAnnotateTypeOrScopeToken and TryAnnotateCXXScopeToken can
only be called when they might be needed now, so make them assert
that their current token is :: or identifier.

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

16 years agoGenerate debug info for VLA types
Anders Carlsson [Mon, 5 Jan 2009 01:23:29 +0000 (01:23 +0000)]
Generate debug info for VLA types

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

16 years agoadd a testcase
Chris Lattner [Mon, 5 Jan 2009 00:59:08 +0000 (00:59 +0000)]
add a testcase

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

16 years agoParseCXXSimpleTypeSpecifier can only be called on things that are
Chris Lattner [Mon, 5 Jan 2009 00:13:00 +0000 (00:13 +0000)]
ParseCXXSimpleTypeSpecifier can only be called on things that are
verified to be simple type specifiers, so there is no need for it
to call TryAnnotateTypeOrScopeToken.

Make MaybeParseCXXScopeSpecifier reject ::new and ::delete with a
hard error now that it may never be transitively called in a
context where these are legal.  This allows me to start
disentangling things more.

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

16 years agosink a call to TryAnnotateCXXScopeToken down into the
Chris Lattner [Mon, 5 Jan 2009 00:07:25 +0000 (00:07 +0000)]
sink a call to TryAnnotateCXXScopeToken down into the
applicable cases in ParseDeclarationSpecifiers.

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

16 years agoSimplify some control flow and remove a call to TryAnnotateCXXScopeToken
Chris Lattner [Sun, 4 Jan 2009 23:51:17 +0000 (23:51 +0000)]
Simplify some control flow and remove a call to TryAnnotateCXXScopeToken
that isn't doing what is desired. It was annotating the current token
not the 'next' token.  This code should be fixed.

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

16 years agocode simplification
Chris Lattner [Sun, 4 Jan 2009 23:46:59 +0000 (23:46 +0000)]
code simplification

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

16 years agosink calls to TryAnnotateTypeOrScopeToken down into the only cases that they
Chris Lattner [Sun, 4 Jan 2009 23:41:41 +0000 (23:41 +0000)]
sink calls to TryAnnotateTypeOrScopeToken down into the only cases that they
can interact with.

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

16 years agopush the call in isCXXDeclarationSpecifier to TryAnnotateTypeOrScopeToken
Chris Lattner [Sun, 4 Jan 2009 23:33:56 +0000 (23:33 +0000)]
push the call in isCXXDeclarationSpecifier to TryAnnotateTypeOrScopeToken
down into the two cases that it can possibly affect.  This avoids calls
to it that obviously can't do anything.

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

16 years agomy previous patch caused sema to drop the global qualifier, make
Chris Lattner [Sun, 4 Jan 2009 23:23:14 +0000 (23:23 +0000)]
my previous patch caused sema to drop the global qualifier, make
sure to pass it down.  This makes the code a bit gross, I will clean
it up in subsequent commits.

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

16 years agosink the call to TryAnnotateTypeOrScopeToken in
Chris Lattner [Sun, 4 Jan 2009 22:52:14 +0000 (22:52 +0000)]
sink the call to TryAnnotateTypeOrScopeToken in
ParseCastExpression into the switch.  This gets it out of the hot
path through ParseCastExpression for all the non-identifier and
non-:: tokens.

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

16 years agouse early exits to reduce nesting.
Chris Lattner [Sun, 4 Jan 2009 22:32:19 +0000 (22:32 +0000)]
use early exits to reduce nesting.

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

16 years agosimplify control flow by removing a goto.
Chris Lattner [Sun, 4 Jan 2009 22:28:21 +0000 (22:28 +0000)]
simplify control flow by removing a goto.

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

16 years agoeliminate lookahead when parsing ::new / ::delete.
Chris Lattner [Sun, 4 Jan 2009 21:25:24 +0000 (21:25 +0000)]
eliminate lookahead when parsing ::new / ::delete.

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

16 years agominor simplifications.
Chris Lattner [Sun, 4 Jan 2009 21:14:15 +0000 (21:14 +0000)]
minor simplifications.

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

16 years agoFix the bug that would cause Python to crash at startup.
Anders Carlsson [Sun, 4 Jan 2009 02:08:04 +0000 (02:08 +0000)]
Fix the bug that would cause Python to crash at startup.

When emitting the static variables we need to make sure that the order is preserved.
Fix this by making StaticDecls a std::list which has O(1) random removal.

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

16 years agoRename AddReadAttrs to FunctionAttrs. This is related to Duncan's patch r61525.
Bill Wendling [Wed, 31 Dec 2008 19:51:31 +0000 (19:51 +0000)]
Rename AddReadAttrs to FunctionAttrs. This is related to Duncan's patch r61525.

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

16 years agoPerform default function/array conversion for input arguments to inline asm statement...
Anders Carlsson [Wed, 31 Dec 2008 07:27:38 +0000 (07:27 +0000)]
Perform default function/array conversion for input arguments to inline asm statements if the input expr can be a memory operand

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

16 years agoParser support for C++ using directives, from Piotr Rak
Douglas Gregor [Tue, 30 Dec 2008 03:27:21 +0000 (03:27 +0000)]
Parser support for C++ using directives, from Piotr Rak

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

16 years agoRemove hasKind(). Use existing getKind().
Fariborz Jahanian [Mon, 29 Dec 2008 19:57:17 +0000 (19:57 +0000)]
Remove hasKind(). Use existing getKind().

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

16 years agoFill in C++ status table for statements.
Sebastian Redl [Sun, 28 Dec 2008 17:18:13 +0000 (17:18 +0000)]
Fill in C++ status table for statements.

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

16 years agoConvert a two more statement actions to smart pointers.
Sebastian Redl [Sun, 28 Dec 2008 16:13:43 +0000 (16:13 +0000)]
Convert a two more statement actions to smart pointers.

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

16 years agoFix a grep error that caused CodeGenObjC/encode-test.m to fail.
Sebastian Redl [Sun, 28 Dec 2008 15:48:05 +0000 (15:48 +0000)]
Fix a grep error that caused CodeGenObjC/encode-test.m to fail.

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

16 years agoDiagnose declarations that don't declare anything, and fix PR3020.
Sebastian Redl [Sun, 28 Dec 2008 15:28:59 +0000 (15:28 +0000)]
Diagnose declarations that don't declare anything, and fix PR3020.
Examples:
int;
typedef int;

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

16 years agoFix filename typo.
Sebastian Redl [Sun, 28 Dec 2008 14:19:27 +0000 (14:19 +0000)]
Fix filename typo.

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

16 years agoadd RUN line
Nuno Lopes [Sat, 27 Dec 2008 23:47:34 +0000 (23:47 +0000)]
add RUN line

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

16 years agoAdd a MS specific intrinsic.
Anders Carlsson [Sat, 27 Dec 2008 04:26:15 +0000 (04:26 +0000)]
Add a MS specific intrinsic.

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