]> granicus.if.org Git - clang/log
clang
15 years agothis massive patch introduces a simple new abstraction: it makes
Chris Lattner [Sat, 17 Jan 2009 06:22:33 +0000 (06:22 +0000)]
this massive patch introduces a simple new abstraction: it makes
"FileID" a concept that is now enforced by the compiler's type checker
instead of yet-another-random-unsigned floating around.

This is an important distinction from the "FileID" currently tracked by
SourceLocation.  *That* FileID may refer to the start of a file or to a
chunk within it.  The new FileID *only* refers to the file (and its
#include stack and eventually #line data), it cannot refer to a chunk.

FileID is a completely opaque datatype to all clients, only SourceManager
is allowed to poke and prod it.

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

15 years agomake "ContentCache::Buffer" mutable to avoid a const_cast.
Chris Lattner [Sat, 17 Jan 2009 03:54:16 +0000 (03:54 +0000)]
make "ContentCache::Buffer" mutable to avoid a const_cast.

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

15 years agono need to check this: content cache is already 1-1 map with fileentries.
Chris Lattner [Sat, 17 Jan 2009 03:49:48 +0000 (03:49 +0000)]
no need to check this: content cache is already 1-1 map with fileentries.

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

15 years agoInstead of iterating over FileID's, have PTH generation iterate over the
Chris Lattner [Sat, 17 Jan 2009 03:48:08 +0000 (03:48 +0000)]
Instead of iterating over FileID's, have PTH generation iterate over the
content cache directly.  Content cache has a 1-1 mapping with fileentries,
whereas multiple FileIDs can be the same FileEntry.

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

15 years agoremove an irrelevant idea
Chris Lattner [Sat, 17 Jan 2009 03:46:44 +0000 (03:46 +0000)]
remove an irrelevant idea

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

15 years agoWarn about typedefs of enums without any declarator name. Fixes rdar://problem/6503878
Douglas Gregor [Sat, 17 Jan 2009 02:55:50 +0000 (02:55 +0000)]
Warn about typedefs of enums without any declarator name. Fixes rdar://problem/6503878

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

15 years agoccc: Support running piped jobs (-pipe now works).
Daniel Dunbar [Sat, 17 Jan 2009 02:02:35 +0000 (02:02 +0000)]
ccc: Support running piped jobs (-pipe now works).

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

15 years agoFix analyzer crash found when scanning Wine sources where the analyzer used old logic...
Ted Kremenek [Sat, 17 Jan 2009 01:54:16 +0000 (01:54 +0000)]
Fix analyzer crash found when scanning Wine sources where the analyzer used old logic to determine the value of a switch 'case' label.

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

15 years agoPODify LookupResult, for a measly 1% speedup on Cocoa.h.
Douglas Gregor [Sat, 17 Jan 2009 01:13:24 +0000 (01:13 +0000)]
PODify LookupResult, for a measly 1% speedup on Cocoa.h.

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

15 years agoAdd -fnext-runtime to Objective-C properties testcase
Douglas Gregor [Sat, 17 Jan 2009 00:53:59 +0000 (00:53 +0000)]
Add -fnext-runtime to Objective-C properties testcase

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

15 years agoccc: Don't be pedantically compatible with -Z options, these are the
Daniel Dunbar [Sat, 17 Jan 2009 00:53:19 +0000 (00:53 +0000)]
ccc: Don't be pedantically compatible with -Z options, these are the
result of an internal implementation detail of gcc.

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

15 years agoReturn success indicator from CmpDriver.
Daniel Dunbar [Sat, 17 Jan 2009 00:50:45 +0000 (00:50 +0000)]
Return success indicator from CmpDriver.

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

15 years agoadd support for usage of cast to union thing with static vars
Nuno Lopes [Sat, 17 Jan 2009 00:48:48 +0000 (00:48 +0000)]
add support for usage of cast to union thing with static vars

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

15 years agoTeach DeclContext how to find the primary declaration for any TagDecl
Douglas Gregor [Sat, 17 Jan 2009 00:42:38 +0000 (00:42 +0000)]
Teach DeclContext how to find the primary declaration for any TagDecl
even when we are still defining the TagDecl. This is required so that
qualified name lookup of a class name within its definition works (see
the new bits in test/SemaCXX/qualified-id-lookup.cpp).

As part of this, move the nested redefinition checking code into
ActOnTag. This gives us diagnostics earlier (when we try to perform
the nested redefinition, rather than when we try to complete the 2nd
definition) and removes some code duplication.

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

15 years agoCatch a foreach parse error.
Fariborz Jahanian [Sat, 17 Jan 2009 00:00:40 +0000 (00:00 +0000)]
Catch a foreach parse error.

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

15 years agoConvert some more statement actions to smart pointers.
Sebastian Redl [Fri, 16 Jan 2009 23:28:06 +0000 (23:28 +0000)]
Convert some more statement actions to smart pointers.
Fix a type error; parser wanted to pass the third part of a for-statement as a statement; should be expression.

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

15 years agoUpdated checker build.
Ted Kremenek [Fri, 16 Jan 2009 23:26:38 +0000 (23:26 +0000)]
Updated checker build.

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

15 years agoccc: Clean up (user level) error handling.
Daniel Dunbar [Fri, 16 Jan 2009 23:12:12 +0000 (23:12 +0000)]
ccc: Clean up (user level) error handling.
 - ccc now checks for existence of input files (more annoying to test,
   but matches gcc).
 - Fix some test cases.

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

15 years agoeliminate FullSourceLoc::getLocation() now that FullSourceLoc
Chris Lattner [Fri, 16 Jan 2009 23:06:35 +0000 (23:06 +0000)]
eliminate FullSourceLoc::getLocation() now that FullSourceLoc
*is* the location.  This eliminates some weird X.getLocation().getLocation()'s.

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

15 years agoMake FullSourceLoc derive from SourceLocation instead of
Chris Lattner [Fri, 16 Jan 2009 23:03:56 +0000 (23:03 +0000)]
Make FullSourceLoc derive from SourceLocation instead of
containing one.  Containment is generally better than derivation,
but in this case FullSourceLoc really 'isa' SourceLocation.

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

15 years agoelimiante FullSourceLoc::getCanonicalFileID
Chris Lattner [Fri, 16 Jan 2009 22:59:51 +0000 (22:59 +0000)]
elimiante FullSourceLoc::getCanonicalFileID

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

15 years agoremove FullSourceLoc::isFileID
Chris Lattner [Fri, 16 Jan 2009 22:53:56 +0000 (22:53 +0000)]
remove FullSourceLoc::isFileID

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

15 years agoan instantiation loc is always a file loc.
Chris Lattner [Fri, 16 Jan 2009 22:53:27 +0000 (22:53 +0000)]
an instantiation loc is always a file loc.

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

15 years agoFix PR2477 - clang misparses "//*" in C89 mode
Chris Lattner [Fri, 16 Jan 2009 22:39:25 +0000 (22:39 +0000)]
Fix PR2477 - clang misparses "//*" in C89 mode

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

15 years agoMake sure to escape " when it occurs in a string in pragma comment
Chris Lattner [Fri, 16 Jan 2009 22:13:37 +0000 (22:13 +0000)]
Make sure to escape " when it occurs in a string in pragma comment

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

15 years agoccc: Fix thinko, add gross but effective test of translation for Darwin/X86/cc1.
Daniel Dunbar [Fri, 16 Jan 2009 21:20:42 +0000 (21:20 +0000)]
ccc: Fix thinko, add gross but effective test of translation for Darwin/X86/cc1.

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

15 years agoccc: Darwin/X86: gcc compatibility, only add
Daniel Dunbar [Fri, 16 Jan 2009 21:07:21 +0000 (21:07 +0000)]
ccc: Darwin/X86: gcc compatibility, only add
'-feliminate-unused-debug-symbols' in reponse to '-g' (not '-g*').

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

15 years agoDon't ICE (issue diagnostics) when receiver is a non-objc
Fariborz Jahanian [Fri, 16 Jan 2009 20:35:09 +0000 (20:35 +0000)]
Don't ICE (issue diagnostics) when receiver is a non-objc
type.

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

15 years agoccc: Darwin/X86: Implement remainder of (non -Z...) generic argument
Daniel Dunbar [Fri, 16 Jan 2009 20:25:36 +0000 (20:25 +0000)]
ccc: Darwin/X86: Implement remainder of (non -Z...) generic argument
translation.
 - As is my general strategy, this is initially pedantically
   compatible with gcc and can be cleaned up later. So, for example,
   we still pass -static to collect2 4 times if you say '-mkernel
   -fapple-kext'. ;)

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

15 years agoDon't ICE on user redeclaration of objc's built-in types.
Fariborz Jahanian [Fri, 16 Jan 2009 19:58:32 +0000 (19:58 +0000)]
Don't ICE on user redeclaration of objc's built-in types.
Issue diagnostics instead if types do not match.

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

15 years agoAs a performance optimization, don't bother calling MacroInfo::isIdenticalTo
Chris Lattner [Fri, 16 Jan 2009 19:50:11 +0000 (19:50 +0000)]
As a performance optimization, don't bother calling MacroInfo::isIdenticalTo
if warnings in system headers are disabled.  isIdenticalTo can end up
calling the expensive getSpelling method, and other bad stuff and is
completely unneeded if the warning will be discarded anyway. rdar://6502956

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

15 years agosilence release-assert warning.
Chris Lattner [Fri, 16 Jan 2009 19:44:00 +0000 (19:44 +0000)]
silence release-assert warning.

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

15 years agoFix <rdar://problem/6502934>. We were creating an ImplicitCastExpr
Douglas Gregor [Fri, 16 Jan 2009 19:38:23 +0000 (19:38 +0000)]
Fix <rdar://problem/6502934>. We were creating an ImplicitCastExpr
with reference type (it should be an lvalue with non-reference type).

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

15 years agoRandom note so I remember how to do this :)
Chris Lattner [Fri, 16 Jan 2009 19:33:59 +0000 (19:33 +0000)]
Random note so I remember how to do this :)

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

15 years agoStringRegion::print: Remove copy/paste code and just call Stmt::printPretty() for...
Ted Kremenek [Fri, 16 Jan 2009 19:26:50 +0000 (19:26 +0000)]
StringRegion::print: Remove copy/paste code and just call Stmt::printPretty() for the StringLiteral.

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

15 years agoMake -E mode propagate #pragma comment's into the output.
Chris Lattner [Fri, 16 Jan 2009 19:25:54 +0000 (19:25 +0000)]
Make -E mode propagate #pragma comment's into the output.

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

15 years agomake ast-print handle random non-printable characters correctly with octal escapes.
Chris Lattner [Fri, 16 Jan 2009 19:25:18 +0000 (19:25 +0000)]
make ast-print handle random non-printable characters correctly with octal escapes.

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

15 years agoChanged the API yet again.
Fariborz Jahanian [Fri, 16 Jan 2009 19:02:53 +0000 (19:02 +0000)]
Changed the API yet again.

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

15 years agoonly notify callbacks if they exist.
Chris Lattner [Fri, 16 Jan 2009 19:01:46 +0000 (19:01 +0000)]
only notify callbacks if they exist.

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

15 years agoImprove #pragma comment support by building the string argument and
Chris Lattner [Fri, 16 Jan 2009 18:59:23 +0000 (18:59 +0000)]
Improve #pragma comment support by building the string argument and
notifying PPCallbacks about it.

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

15 years agominor cleanups to StringLiteralParser: no need to pass target info
Chris Lattner [Fri, 16 Jan 2009 18:51:42 +0000 (18:51 +0000)]
minor cleanups to StringLiteralParser: no need to pass target info
into its ctor.  Also, make it handle validity checking of pascal
strings instead of making clients do it.

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

15 years agoFix PR 3337 [retain/release checker]: Handle FunctionDecl's declared using typedefs.
Ted Kremenek [Fri, 16 Jan 2009 18:40:33 +0000 (18:40 +0000)]
Fix PR 3337 [retain/release checker]: Handle FunctionDecl's declared using typedefs.

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

15 years agoPart one of handling C++ functional casts. This handles semantic
Douglas Gregor [Fri, 16 Jan 2009 18:33:17 +0000 (18:33 +0000)]
Part one of handling C++ functional casts. This handles semantic
analysis and AST-building for the cases where we have N != 1
arguments. For N == 1 arguments, we need to finish the C++
implementation of explicit type casts (C++ [expr.cast]).

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

15 years agoUsed a more suitable api to get to the type of a record
Fariborz Jahanian [Fri, 16 Jan 2009 17:41:13 +0000 (17:41 +0000)]
Used a more suitable api to get to the type of a record
in code gen.

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

15 years agoAdd test case for member name lookup
Douglas Gregor [Fri, 16 Jan 2009 17:06:33 +0000 (17:06 +0000)]
Add test case for member name lookup

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

15 years agoUse a single function for doing vararg argument promotion. Also, make sure to do...
Anders Carlsson [Fri, 16 Jan 2009 16:48:51 +0000 (16:48 +0000)]
Use a single function for doing vararg argument promotion. Also, make sure to do the promotion before checking the type - fixes PR3340.

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

15 years agoImplement basic support for parsing #pragma comment, a microsoft extension
Chris Lattner [Fri, 16 Jan 2009 08:21:25 +0000 (08:21 +0000)]
Implement basic support for parsing #pragma comment, a microsoft extension
documented here:
http://msdn.microsoft.com/en-us/library/7f0aews7(VS.80).aspx

This is according to my understanding reading the docs, I don't know if it
really agrees fully with what VC++ allows.

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

15 years agomore SourceLocation lexicon change: instead of referring to the
Chris Lattner [Fri, 16 Jan 2009 07:36:28 +0000 (07:36 +0000)]
more SourceLocation lexicon change: instead of referring to the
"logical" location, refer to the "instantiation" location.

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

15 years agorename "virtual location" of a macro to "instantiation location".
Chris Lattner [Fri, 16 Jan 2009 07:15:35 +0000 (07:15 +0000)]
rename "virtual location" of a macro to "instantiation location".

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

15 years agorename PP::getPhysicalCharacterAt -> PP::getSpelledCharacterAt.
Chris Lattner [Fri, 16 Jan 2009 07:10:29 +0000 (07:10 +0000)]
rename PP::getPhysicalCharacterAt -> PP::getSpelledCharacterAt.
Slightly speed up sema of numbers like '1' by going directly to
TargetInfo instead of through ASTContext.

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

15 years agoremove obsolete comment which happened to go over 80 cols.
Chris Lattner [Fri, 16 Jan 2009 07:04:11 +0000 (07:04 +0000)]
remove obsolete comment which happened to go over 80 cols.

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

15 years agoremove an unneeded const_cast.
Chris Lattner [Fri, 16 Jan 2009 07:02:14 +0000 (07:02 +0000)]
remove an unneeded const_cast.

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

15 years agoupdate for terminology change.
Chris Lattner [Fri, 16 Jan 2009 07:00:50 +0000 (07:00 +0000)]
update for terminology change.

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

15 years agoChange some terminology in SourceLocation: instead of referring to
Chris Lattner [Fri, 16 Jan 2009 07:00:02 +0000 (07:00 +0000)]
Change some terminology in SourceLocation: instead of referring to
the "physical" location of tokens, refer to the "spelling" location.
This is more concrete and useful, tokens aren't really physical objects!

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

15 years agoDon't advance the statement iterator after we've deallocated the statement
Douglas Gregor [Fri, 16 Jan 2009 06:50:08 +0000 (06:50 +0000)]
Don't advance the statement iterator after we've deallocated the statement

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

15 years agoExtract code dealing with typedef declarators into a separate function.
Zhongxing Xu [Fri, 16 Jan 2009 03:34:13 +0000 (03:34 +0000)]
Extract code dealing with typedef declarators into a separate function.

No functionality change.

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

15 years agoAdd test for contextual conversion to bool, and enable some FIXME'd tests
Douglas Gregor [Fri, 16 Jan 2009 03:02:29 +0000 (03:02 +0000)]
Add test for contextual conversion to bool, and enable some FIXME'd tests

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

15 years agoExtract code dealing with variable declarator into a separate function.
Zhongxing Xu [Fri, 16 Jan 2009 02:36:34 +0000 (02:36 +0000)]
Extract code dealing with variable declarator into a separate function.

No functionality change.

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

15 years agoAttempt to unbreak Windows build.
Daniel Dunbar [Fri, 16 Jan 2009 01:50:29 +0000 (01:50 +0000)]
Attempt to unbreak Windows build.

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

15 years agopostpone sizeof objc-class computatin to the clients.
Fariborz Jahanian [Fri, 16 Jan 2009 01:42:12 +0000 (01:42 +0000)]
postpone sizeof objc-class computatin to the clients.

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

15 years agoExtract code dealing with declarators of function type into a separate function
Zhongxing Xu [Fri, 16 Jan 2009 01:13:29 +0000 (01:13 +0000)]
Extract code dealing with declarators of function type into a separate function
Sema::ActOnFunctionDeclarator().
No functionality change.

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

15 years agoImplemented code gen for sizeof(objc class interface).
Fariborz Jahanian [Fri, 16 Jan 2009 00:57:08 +0000 (00:57 +0000)]
Implemented code gen for sizeof(objc class interface).

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

15 years agoImprove diagnostics for ambiguous name lookup results
Douglas Gregor [Fri, 16 Jan 2009 00:38:09 +0000 (00:38 +0000)]
Improve diagnostics for ambiguous name lookup results

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

15 years agoadd codegen support to union casts
Nuno Lopes [Thu, 15 Jan 2009 20:14:33 +0000 (20:14 +0000)]
add codegen support to union casts
init of static vars still not working. I'll get back to it tomorrow or so

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

15 years agoPTH: Fix termination condition in binary search.
Ted Kremenek [Thu, 15 Jan 2009 19:28:38 +0000 (19:28 +0000)]
PTH: Fix termination condition in binary search.

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

15 years agoPR3330: given an enum like this:
Chris Lattner [Thu, 15 Jan 2009 19:19:42 +0000 (19:19 +0000)]
PR3330: given an enum like this:

enum E {
 A = 1U,
 B
};

Don't make an implicit cast expr of null for B.

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

15 years agoIdentifierInfo:
Ted Kremenek [Thu, 15 Jan 2009 18:47:46 +0000 (18:47 +0000)]
IdentifierInfo:
- IdentifierInfo can now (optionally) have its string data not be
  co-located with itself.  This is for use with PTH.  This aspect is a
  little gross, as getName() and getLength() now make assumptions
  about a possible alternate representation of IdentifierInfo.
  Perhaps we should make IdentifierInfo have virtual methods?

IdentifierTable:
- Added class "IdentifierInfoLookup" that can be used by
  IdentifierTable to perform "string -> IdentifierInfo" lookups using
  an auxilliary data structure.  This is used by PTH.
- Perform tests show that IdentifierTable::get() does not slow down
  because of the extra check for the IdentiferInfoLookup object (the
  regular StringMap lookup does enough work to mitigate the impact of
  an extra null pointer check).
- The upshot is that now that some IdentifierInfo objects might be
  owned by the IdentiferInfoLookup object.  This should be reviewed.

PTH:
- Modified PTHManager::GetIdentifierInfo to *not* insert entries in
  IdentifierTable's string map, and instead create IdentifierInfo
  objects on the fly when mapping from persistent IDs to
  IdentifierInfos.  This saves a ton of work with string copies,
  hashing, and StringMap lookup and resizing.  This change was
  motivated because when processing source files in the PTH cache we
  don't need to do any string -> IdentifierInfo lookups.
- PTHManager now subclasses IdentifierInfoLookup, allowing clients of
  IdentifierTable to transparently use IdentifierInfo objects managed
  by the PTH file.  PTHManager resolves "string -> IdentifierInfo"
  queries by doing a binary search over a sorted table of identifier
  strings in the PTH file (the exact algorithm we use can be changed
  as needed).

These changes lead to the following performance changes when using PTH on Cocoa.h:
- fsyntax-only: 10% performance improvement
- Eonly: 30% performance improvement

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

15 years agoFix some unused variable, control reaches end of non-void function,
Daniel Dunbar [Thu, 15 Jan 2009 18:32:35 +0000 (18:32 +0000)]
Fix some unused variable, control reaches end of non-void function,
and uninitialized use options.

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

15 years agoAdd dummy X86_64 ABIInfo implementation.
Daniel Dunbar [Thu, 15 Jan 2009 18:18:40 +0000 (18:18 +0000)]
Add dummy X86_64 ABIInfo implementation.

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

15 years agoadd support for initializing static vars with a cast to union (gcc extension)
Nuno Lopes [Thu, 15 Jan 2009 16:44:45 +0000 (16:44 +0000)]
add support for initializing static vars with a cast to union (gcc extension)

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

15 years agoPR2746: Implement GCC cast to union extension
Seo Sanghyeon [Thu, 15 Jan 2009 04:51:39 +0000 (04:51 +0000)]
PR2746: Implement GCC cast to union extension

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

15 years agoAdd utils/ABITest, my ABI test generation tool.
Daniel Dunbar [Thu, 15 Jan 2009 04:24:17 +0000 (04:24 +0000)]
Add utils/ABITest, my ABI test generation tool.
 - Mostly written as an entertaining exercise in enumerating large or
   (countably, naturally) infinite sets. But hey, its useful too!

 - Idea is to number all C-types so that the N-th type can quickly be
   computed, with a good deal of flexibility about what types to
   include, and taking some care so that the (N+1)-th type is
   interestingly different from the N-th type. For example, using the
   default generator, the 1,000,000-th function type is:
--
typedef _Complex int T0;
typedef char T1 __attribute__ ((vector_size (4)));
typedef int T2 __attribute__ ((vector_size (4)));
T2 fn1000000(T0 arg0, signed long long arg1, T1 arg2, T0 arg3);
--
   and the 1,000,001-th type is:
--
typedef _Complex char T0;
typedef _Complex char T2;
typedef struct T1 { T2 field0; T2 field1; T2 field2; } T1;
typedef struct T3 {  } T3;
unsigned short fn1000001(T0 arg0, T1 arg1, T3 arg2);
--

   Computing the 10^1600-th type takes a little less than 1s. :)

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

15 years agoDeallocate the BasePaths structure that we allocate for LookupResult.
Douglas Gregor [Thu, 15 Jan 2009 02:19:31 +0000 (02:19 +0000)]
Deallocate the BasePaths structure that we allocate for LookupResult.

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

15 years agoPTH: Embed a persistentID side-table in the PTH file that is sorted in the
Ted Kremenek [Thu, 15 Jan 2009 01:26:25 +0000 (01:26 +0000)]
PTH: Embed a persistentID side-table in the PTH file that is sorted in the
lexical order of the corresponding identifier strings. This will be used for a
forthcoming optimization. This slows down PTH generation time by 7%. We can
revert this change if the optimization proves to not be valuable.

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

15 years agoInitial implementation of member name lookup
Douglas Gregor [Thu, 15 Jan 2009 00:26:24 +0000 (00:26 +0000)]
Initial implementation of member name lookup

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

15 years agoccc: Implement support clang PTH using gcc PCH style interface.
Daniel Dunbar [Wed, 14 Jan 2009 23:26:40 +0000 (23:26 +0000)]
ccc: Implement support clang PTH using gcc PCH style interface.

This requires some hackery, as gcc's PCH mechanism changes behavior,
whereas while PTH is simply a cache. Notably:

 - Automatically cause clang to load a .pth file if we find one that
   matches a command line -include argument (similar to how gcc
   looks for .gch files).

 - When generating precompiled headers, translate the suffix from .gch
   to .pth (so we do not conflict with actual gcc PCH files).

 - When generating precompiled headers, copy the input header to the
   same location as the output PTH file. This is necessary because gcc
   supports -include xxx.h even if xxx.h doesn't exist, but for clang
   we need to actually have the contents of this file available.

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

15 years agoRefactor name lookup.
Douglas Gregor [Wed, 14 Jan 2009 22:20:51 +0000 (22:20 +0000)]
Refactor name lookup.

This change refactors and cleans up our handling of name lookup with
LookupDecl. There are several aspects to this refactoring:

  - The criteria for name lookup is now encapsulated into the class
  LookupCriteria, which replaces the hideous set of boolean values
  that LookupDecl currently has.

  - The results of name lookup are returned in a new class
  LookupResult, which can lazily build OverloadedFunctionDecls for
  overloaded function sets (and, eventually, eliminate the need to
  allocate member for OverloadedFunctionDecls) and contains a
  placeholder for handling ambiguous name lookup (for C++).

  - The primary entry points for name lookup are now LookupName (for
    unqualified name lookup) and LookupQualifiedName (for qualified
    name lookup). There is also a convenience function
    LookupParsedName that handles qualified/unqualified name lookup
    when given a scope specifier. Together, these routines are meant
    to gradually replace the kludgy LookupDecl, but this won't happen
    until after we have base class lookup (which forces us to cope
    with ambiguities).

  - Documented the heck out of name lookup. Experimenting a little
    with using Doxygen's member groups to make some sense of the Sema
    class. Feedback welcome!

  - Fixes some lingering issues with name lookup for
  nested-name-specifiers, which now goes through
  LookupName/LookupQualifiedName.

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

15 years agoCmpDriver: Allow over-ride of drivers to compare through env variables
Daniel Dunbar [Wed, 14 Jan 2009 20:06:04 +0000 (20:06 +0000)]
CmpDriver: Allow over-ride of drivers to compare through env variables
(DRIVER_[AB]).

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

15 years agoccc: Finish main clang compiler argument translation.
Daniel Dunbar [Wed, 14 Jan 2009 19:42:31 +0000 (19:42 +0000)]
ccc: Finish main clang compiler argument translation.
 - Still missing some odds and ends like -M.

 - Also, we still need to do some translation and forwarding of
   codegen options.

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

15 years agoPatch to keep clang honest that it does not yet support
Fariborz Jahanian [Wed, 14 Jan 2009 19:39:53 +0000 (19:39 +0000)]
Patch to keep clang honest that it does not yet support
explicit return type on block literals.

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

15 years agoFix typo and spelling of -Wunused-macros.
Daniel Dunbar [Wed, 14 Jan 2009 18:56:36 +0000 (18:56 +0000)]
Fix typo and spelling of -Wunused-macros.

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

15 years agoTest explicit constructor
Douglas Gregor [Wed, 14 Jan 2009 18:02:48 +0000 (18:02 +0000)]
Test explicit constructor

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

15 years agoIntroduce support for C++0x explicit conversion operators (N2437)
Douglas Gregor [Wed, 14 Jan 2009 15:45:31 +0000 (15:45 +0000)]
Introduce support for C++0x explicit conversion operators (N2437)

Small cleanup in the handling of user-defined conversions.

Also, implement an optimization when constructing a call. We avoid
recomputing implicit conversion sequences and instead use those
conversion sequences that we computed as part of overload resolution.

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

15 years agoAdd a FIXME.
Steve Naroff [Wed, 14 Jan 2009 07:06:32 +0000 (07:06 +0000)]
Add a FIXME.

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

15 years agoccc: Darwin/Compiler: Improve gcc compat in use of -auxbase-strip.
Daniel Dunbar [Wed, 14 Jan 2009 03:31:16 +0000 (03:31 +0000)]
ccc: Darwin/Compiler: Improve gcc compat in use of -auxbase-strip.

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

15 years agoccc: Implement argument translation for clang.
Daniel Dunbar [Wed, 14 Jan 2009 01:50:15 +0000 (01:50 +0000)]
ccc: Implement argument translation for clang.
 - This is what ccc (old) currently handles.

 - Clang accepts some more things that aren't getting forwarded...

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

15 years agoccc: Add hello.{cpp,m} tests.
Daniel Dunbar [Wed, 14 Jan 2009 01:34:13 +0000 (01:34 +0000)]
ccc: Add hello.{cpp,m} tests.
 - hello.cpp is XFAIL pending g++ emulation.

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

15 years agoccc: Add -ccc-echo special option, and support pulling CCC_CLANG,
Daniel Dunbar [Wed, 14 Jan 2009 01:32:05 +0000 (01:32 +0000)]
ccc: Add -ccc-echo special option, and support pulling CCC_CLANG,
CCC_ECHO, and CCC_FALLBACK from environment as ccc (old) did.

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

15 years agoccc: Use Clang/Compile for Objective-C files as well.
Daniel Dunbar [Wed, 14 Jan 2009 01:30:55 +0000 (01:30 +0000)]
ccc: Use Clang/Compile for Objective-C files as well.

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

15 years agoFix a subtle bug in DeclContext::DestroyDecls().
Steve Naroff [Wed, 14 Jan 2009 01:27:31 +0000 (01:27 +0000)]
Fix a subtle bug in DeclContext::DestroyDecls().

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

15 years agoccc: Add dummy Clang/Compile tool and use on Darwin/X86 for C files.
Daniel Dunbar [Wed, 14 Jan 2009 01:03:36 +0000 (01:03 +0000)]
ccc: Add dummy Clang/Compile tool and use on Darwin/X86 for C files.

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

15 years agoFunctionDecl::setParams() now uses the allocator associated with ASTContext to alloca...
Ted Kremenek [Wed, 14 Jan 2009 00:42:25 +0000 (00:42 +0000)]
FunctionDecl::setParams() now uses the allocator associated with ASTContext to allocate the array of ParmVarDecl*'s.

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

15 years agoccc: Darwin/Compile: Define __private_extern__ when building c++.
Daniel Dunbar [Wed, 14 Jan 2009 00:06:14 +0000 (00:06 +0000)]
ccc: Darwin/Compile: Define __private_extern__ when building c++.

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

15 years agoImplemenent objective-c's NSObject attribute as a way of ddeclaraing c-type
Fariborz Jahanian [Tue, 13 Jan 2009 23:34:40 +0000 (23:34 +0000)]
Implemenent objective-c's NSObject attribute as a way of ddeclaraing c-type
objects as an objective-c object.

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

15 years agoPTH:
Ted Kremenek [Tue, 13 Jan 2009 23:19:12 +0000 (23:19 +0000)]
PTH:
- Use canonical FileID when using getSpelling() caching.  This
  addresses some cache misses we were seeing with -fsyntax-only on
  Cocoa.h
- Added Preprocessor::getPhysicalCharacterAt() utility method for
  clients to grab the first character at a specified sourcelocation.
  This uses the PTH spelling cache.
- Modified Sema::ActOnNumericConstant() to use
  Preprocessor::getPhysicalCharacterAt() instead of
  SourceManager::getCharacterData() (to get PTH hits).

These changes cause -fsyntax-only to not page in any sources from
Cocoa.h.  We see a speedup of 27%.

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

15 years agoPermitting typedefs without a name is a Microsoft/GNU extension
Douglas Gregor [Tue, 13 Jan 2009 23:10:51 +0000 (23:10 +0000)]
Permitting typedefs without a name is a Microsoft/GNU extension

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

15 years agoFix corner cases in PTH getSpelling() binary search.
Ted Kremenek [Tue, 13 Jan 2009 22:16:45 +0000 (22:16 +0000)]
Fix corner cases in PTH getSpelling() binary search.

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

15 years agoPTH: Fix remaining cases where the spelling cache in the PTH file was being missed...
Ted Kremenek [Tue, 13 Jan 2009 22:05:50 +0000 (22:05 +0000)]
PTH: Fix remaining cases where the spelling cache in the PTH file was being missed when it shouldn't.  This shaves another 7% off PTH time for -Eonly on Cocoa.h

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

15 years agoccc: Fix a test case.
Daniel Dunbar [Tue, 13 Jan 2009 21:11:28 +0000 (21:11 +0000)]
ccc: Fix a test case.

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

15 years agouse a slightly more sensible position for an array ref's "getExprLoc"
Chris Lattner [Tue, 13 Jan 2009 21:11:15 +0000 (21:11 +0000)]
use a slightly more sensible position for an array ref's "getExprLoc"

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