]> granicus.if.org Git - clang/log
clang
15 years agoAdd stub for PTHLexer::isNextPPTokenLParen().
Ted Kremenek [Wed, 19 Nov 2008 22:42:26 +0000 (22:42 +0000)]
Add stub for PTHLexer::isNextPPTokenLParen().

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

15 years agoAdd version of 'getFileCharacteristic()' for FileIDs.
Ted Kremenek [Wed, 19 Nov 2008 22:41:46 +0000 (22:41 +0000)]
Add version of 'getFileCharacteristic()' for FileIDs.

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

15 years agoWhen using a PTHLexer, use DiscardToEndOfLine() instead of ReadToEndOfLine().
Ted Kremenek [Wed, 19 Nov 2008 22:21:33 +0000 (22:21 +0000)]
When using a PTHLexer, use DiscardToEndOfLine() instead of ReadToEndOfLine().

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

15 years ago- Move static function IsNonPragmaNonMacroLexer into Preprocessor.h.
Ted Kremenek [Wed, 19 Nov 2008 21:57:25 +0000 (21:57 +0000)]
- Move static function IsNonPragmaNonMacroLexer into Preprocessor.h.
- Add variants of IsNonPragmaNonMacroLexer to accept an IncludeMacroStack entry
  (simplifies some uses).
- Use IsNonPragmaNonMacroLexer in Preprocessor::LookupFile.
- Add 'FileID' to PreprocessorLexer, and have Preprocessor query this fileid
  when looking up the FileEntry for a file

Performance testing of -Eonly on Cocoa.h shows no performance regression because
of this patch.

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

15 years agoFix <rdar://problem/6291588> assertion failure: SourceManager.h line 489.
Steve Naroff [Wed, 19 Nov 2008 21:15:47 +0000 (21:15 +0000)]
Fix <rdar://problem/6291588> assertion failure: SourceManager.h line 489.

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

15 years agoSupport for calling overloaded function call operators (operator())
Douglas Gregor [Wed, 19 Nov 2008 21:05:33 +0000 (21:05 +0000)]
Support for calling overloaded function call operators (operator())
with function call syntax, e.g.,

  Functor f;
  f(x, y);

This is the easy part of handling calls to objects of class type
(C++ [over.call.object]). The hard part (coping with conversions from
f to function pointer or reference types) will come later. Nobody uses
that stuff anyway, right? :)

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

15 years agoSome tweaks suggested by Argiris
Douglas Gregor [Wed, 19 Nov 2008 19:09:45 +0000 (19:09 +0000)]
Some tweaks suggested by Argiris

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

15 years agoIgnore Output directories when searching for tests.
Daniel Dunbar [Wed, 19 Nov 2008 19:06:57 +0000 (19:06 +0000)]
Ignore Output directories when searching for tests.

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

15 years agoCMake: Added some source files.
Oscar Fuentes [Wed, 19 Nov 2008 18:46:39 +0000 (18:46 +0000)]
CMake: Added some source files.

Patch contributed by Jay Foad!

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

15 years agoMore of objective-c's gc code-gen. Treat objective-c
Fariborz Jahanian [Wed, 19 Nov 2008 18:38:10 +0000 (18:38 +0000)]
More of objective-c's gc code-gen. Treat objective-c
objects as __strong when attribute unspecified.

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

15 years agoMake DeclContext::getLexicalParent reuse DeclContext::getParent.
Argyrios Kyrtzidis [Wed, 19 Nov 2008 18:07:24 +0000 (18:07 +0000)]
Make DeclContext::getLexicalParent reuse DeclContext::getParent.

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

15 years agoTake care another assert:
Argyrios Kyrtzidis [Wed, 19 Nov 2008 18:01:13 +0000 (18:01 +0000)]
Take care another assert:

struct A {
  struct B;
};

struct A::B {
  void m() {} // Assertion failed: getContainingDC(DC) == CurContext && "The next DeclContext should be lexically contained in the current one."
};

Introduce DeclContext::getLexicalParent which may be different from DeclContext::getParent when nested-names are involved, e.g:

   namespace A {
      struct S;
   }
   struct A::S {}; // getParent() == namespace 'A'
                   // getLexicalParent() == translation unit

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

15 years agofix folding of '*doubleArray'
Nuno Lopes [Wed, 19 Nov 2008 17:44:31 +0000 (17:44 +0000)]
fix folding of '*doubleArray'

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

15 years agoMake the non-const DeclContext::getParent call the const version, instead of the...
Argyrios Kyrtzidis [Wed, 19 Nov 2008 17:36:39 +0000 (17:36 +0000)]
Make the non-const DeclContext::getParent call the const version, instead of the other way around.

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

15 years agoFew more changes due to Daniel's feedback.
Fariborz Jahanian [Wed, 19 Nov 2008 17:34:06 +0000 (17:34 +0000)]
Few more changes due to Daniel's feedback.

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

15 years agoSupport overloading of the subscript operator[], including support for
Douglas Gregor [Wed, 19 Nov 2008 17:17:41 +0000 (17:17 +0000)]
Support overloading of the subscript operator[], including support for
built-in operator candidates. Test overloading of '&' and ','.

In C++, a comma expression is an lvalue if its right-hand
subexpression is an lvalue. Update Expr::isLvalue accordingly.

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

15 years agoFix <rdar://problem/6150376> [sema] crash on invalid message send.
Steve Naroff [Wed, 19 Nov 2008 15:54:23 +0000 (15:54 +0000)]
Fix <rdar://problem/6150376> [sema] crash on invalid message send.

The core fix in Sema::ActOnClassMessage(). All the other changes have to do with passing down the SourceLocation for the receiver (to properly position the cursor when producing an error diagnostic).

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

15 years agoAdded operator overloading for unary operators, post-increment, and
Douglas Gregor [Wed, 19 Nov 2008 15:42:04 +0000 (15:42 +0000)]
Added operator overloading for unary operators, post-increment, and
post-decrement, including support for generating all of the built-in
operator candidates for these operators.

C++ and C have different rules for the arguments to the builtin unary
'+' and '-'. Implemented both variants in Sema::ActOnUnaryOp.

In C++, pre-increment and pre-decrement return lvalues. Update
Expr::isLvalue accordingly.

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

15 years agoFix this:
Argyrios Kyrtzidis [Wed, 19 Nov 2008 15:22:16 +0000 (15:22 +0000)]
Fix this:

With this snippet:
  void f(a::b);

An assert is hit:
Assertion failed: CachedTokens[CachedLexPos-1].getLocation() == Tok.getAnnotationEndLoc() && "The annotation should be until the most recent cached token", file ..\..\lib\Lex\PPCaching.cpp, line 98

Introduce Preprocessor::RevertCachedTokens that reverts a specific number of tokens when backtracking is enabled.

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

15 years agoRemove Preprocessor::CacheTokens boolean data member. The same functionality can...
Argyrios Kyrtzidis [Wed, 19 Nov 2008 14:23:14 +0000 (14:23 +0000)]
Remove Preprocessor::CacheTokens boolean data member. The same functionality can be provided by using Preprocessor::isBacktrackEnabled().

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

15 years agoAdd spec ref to comment.
Daniel Dunbar [Wed, 19 Nov 2008 11:54:05 +0000 (11:54 +0000)]
Add spec ref to comment.

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

15 years agoAdd test for path-sensitive uninit-val detection involving struct field.
Zhongxing Xu [Wed, 19 Nov 2008 11:10:42 +0000 (11:10 +0000)]
Add test for path-sensitive uninit-val detection involving struct field.

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

15 years agoAdd support for symbolicating global structs and arrays in RegionStoreManager::getIni...
Zhongxing Xu [Wed, 19 Nov 2008 11:06:24 +0000 (11:06 +0000)]
Add support for symbolicating global structs and arrays in RegionStoreManager::getInitialStore().

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

15 years agoAdd SymbolData for array elements and struct fields.
Zhongxing Xu [Wed, 19 Nov 2008 11:03:17 +0000 (11:03 +0000)]
Add SymbolData for array elements and struct fields.

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

15 years agoFix silly code, use IdentifierInfo* instead of std::string in
Daniel Dunbar [Wed, 19 Nov 2008 10:32:38 +0000 (10:32 +0000)]
Fix silly code, use IdentifierInfo* instead of std::string in
PragmaPackStack. Thanks Chris!

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

15 years agoFix redundant load of bit-fields on assignment (to get the updated
Daniel Dunbar [Wed, 19 Nov 2008 09:36:46 +0000 (09:36 +0000)]
Fix redundant load of bit-fields on assignment (to get the updated
value).
 - Use extra argument to EmitStoreThroughLValue to provide place to
   write update bit-field value if caller requires it.
 - This fixes several FIXMEs.

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

15 years agoPointer width for PIC16 is 16 bits. Modify getMemCpy, getMemMove and getMemSet accord...
Sanjiv Gupta [Wed, 19 Nov 2008 09:02:07 +0000 (09:02 +0000)]
Pointer width for PIC16 is 16 bits. Modify getMemCpy, getMemMove and getMemSet accordingly.

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

15 years agofix save-o
Chris Lattner [Wed, 19 Nov 2008 08:26:36 +0000 (08:26 +0000)]
fix save-o

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

15 years agosimplify
Chris Lattner [Wed, 19 Nov 2008 08:24:49 +0000 (08:24 +0000)]
simplify

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

15 years agostop calling II::getName() unnecesarily in sema
Chris Lattner [Wed, 19 Nov 2008 08:23:25 +0000 (08:23 +0000)]
stop calling II::getName() unnecesarily in sema

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

15 years agosimplify some code.
Chris Lattner [Wed, 19 Nov 2008 07:55:04 +0000 (07:55 +0000)]
simplify some code.

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

15 years agoremove uses of IdentifierInfo::getName()
Chris Lattner [Wed, 19 Nov 2008 07:51:13 +0000 (07:51 +0000)]
remove uses of IdentifierInfo::getName()

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

15 years agoremove some uses of IdentifierInfo::getName()
Chris Lattner [Wed, 19 Nov 2008 07:49:38 +0000 (07:49 +0000)]
remove some uses of IdentifierInfo::getName()

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

15 years agoadd a new helper method. It is unclear to me why this doesn't work, but GCC
Chris Lattner [Wed, 19 Nov 2008 07:49:14 +0000 (07:49 +0000)]
add a new helper method.  It is unclear to me why this doesn't work, but GCC
won't match it:

  template<std::size_t StrLen>
  bool isName(const char Str[StrLen]) const {
    return getLength() == StrLen-1 && !memcmp(getName(), Str, StrLen-1);
  }

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

15 years agoUse smallstring instead of new[]'ing a string. This simplifies
Chris Lattner [Wed, 19 Nov 2008 07:41:27 +0000 (07:41 +0000)]
Use smallstring instead of new[]'ing a string.  This simplifies
the code and speeds it up.

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

15 years agoremove uses of IdentifierInfo::getName()
Chris Lattner [Wed, 19 Nov 2008 07:37:42 +0000 (07:37 +0000)]
remove uses of IdentifierInfo::getName()

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

15 years agodon't turn identifierinfo's into strings in diagnostics.
Chris Lattner [Wed, 19 Nov 2008 07:33:58 +0000 (07:33 +0000)]
don't turn identifierinfo's into strings in diagnostics.

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

15 years agoAllow sending IdentifierInfo*'s into Diagnostics without turning them into strings
Chris Lattner [Wed, 19 Nov 2008 07:32:16 +0000 (07:32 +0000)]
Allow sending IdentifierInfo*'s into Diagnostics without turning them into strings
first.  This should allow removal of a bunch of II->getName() calls.

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

15 years agoconvert some diags to use numbers instead of strings.
Chris Lattner [Wed, 19 Nov 2008 07:25:44 +0000 (07:25 +0000)]
convert some diags to use numbers instead of strings.

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

15 years agoformatting
Chris Lattner [Wed, 19 Nov 2008 07:24:05 +0000 (07:24 +0000)]
formatting

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

15 years agoadd direct support for signed and unsigned integer arguments to diagnostics.
Chris Lattner [Wed, 19 Nov 2008 07:22:31 +0000 (07:22 +0000)]
add direct support for signed and unsigned integer arguments to diagnostics.

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

15 years agoswitch TextDiagnosticPrinter to raw_ostream.
Chris Lattner [Wed, 19 Nov 2008 06:56:25 +0000 (06:56 +0000)]
switch TextDiagnosticPrinter to raw_ostream.

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

15 years agorewrite FormatDiagnostic to be less gross and a lot more efficient.
Chris Lattner [Wed, 19 Nov 2008 06:51:40 +0000 (06:51 +0000)]
rewrite FormatDiagnostic to be less gross and a lot more efficient.
This also makes it illegal to have bare '%'s in diagnostics.  If you
want a % in a diagnostic, use %%.

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

15 years agoDiscard unused runtime function declarations (for readability).
Daniel Dunbar [Wed, 19 Nov 2008 06:15:35 +0000 (06:15 +0000)]
Discard unused runtime function declarations (for readability).

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

15 years agoimplement a transparent optimization with the diagnostics stuff:
Chris Lattner [Wed, 19 Nov 2008 06:04:55 +0000 (06:04 +0000)]
implement a transparent optimization with the diagnostics stuff:
const char*'s are now not converted to std::strings when the diagnostic
is formed, we just hold onto their pointer and format as needed.

This commit makes DiagnosticClient::FormatDiagnostic even more of a
mess, I'll fix it in the next commit.

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

15 years agoUpdated checker build.
Ted Kremenek [Wed, 19 Nov 2008 05:46:43 +0000 (05:46 +0000)]
Updated checker build.

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

15 years agoAddress Sebastian and Doug's objections with taking pointers to temporaries.
Chris Lattner [Wed, 19 Nov 2008 05:34:22 +0000 (05:34 +0000)]
Address Sebastian and Doug's objections with taking pointers to temporaries.
Instead of doing that, copy the strings into the diagnostic info.

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

15 years agoremove one more old-style Diag method.
Chris Lattner [Wed, 19 Nov 2008 05:27:50 +0000 (05:27 +0000)]
remove one more old-style Diag method.

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

15 years agoSwitch several more Sema Diag methods over. This simplifies the
Chris Lattner [Wed, 19 Nov 2008 05:08:23 +0000 (05:08 +0000)]
Switch several more Sema Diag methods over.  This simplifies the
__builtin_prefetch code to only emit one diagnostic per builtin_prefetch.
While this has nothing to do with the rest of the patch, the code seemed
like overkill when I was updating it.

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

15 years agoBuilt-in equality and relational operators have return type "bool" in C++,
Douglas Gregor [Wed, 19 Nov 2008 03:25:36 +0000 (03:25 +0000)]
Built-in equality and relational operators have return type "bool" in C++,
not "int".

Fix a typo in the promotion of enumeration types that was causing some
integral promotions to look like integral conversions (leading to
extra ambiguities in overload resolution).

Check for "acceptable" overloaded operators based on the types of the
arguments. This is a somewhat odd check that is specified by the
standard, but I can't see why it actually matters: the overload
candidates it suppresses don't seem like they would ever be picked as
the best candidates.

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

15 years agoRevert 59574 (caused tests to fail).
Ted Kremenek [Wed, 19 Nov 2008 01:54:47 +0000 (01:54 +0000)]
Revert 59574 (caused tests to fail).

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

15 years agoscan-build now recognizes when the user is directly invoking gcc for:
Ted Kremenek [Wed, 19 Nov 2008 01:46:21 +0000 (01:46 +0000)]
scan-build now recognizes when the user is directly invoking gcc for:
(a) different versions of gcc (e.g., a suffix '-4.2')
(b) different paths for gcc

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

15 years agoGenerate strong write barriers for __strong objects.
Fariborz Jahanian [Wed, 19 Nov 2008 00:59:10 +0000 (00:59 +0000)]
Generate strong write barriers for __strong objects.
Also, took care of Daniel's commments.

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

15 years ago- Move static function IsNonPragmaNonMacroLexer into Preprocessor.h.
Ted Kremenek [Wed, 19 Nov 2008 00:46:18 +0000 (00:46 +0000)]
- Move static function IsNonPragmaNonMacroLexer into Preprocessor.h.
- Add variants of IsNonPragmaNonMacroLexer to accept an IncludeMacroStack entry
  (simplifies some uses).
- Use IsNonPragmaNonMacroLexer in Preprocessor::LookupFile.

Performance testing of -Eonly on Cocoa.h shows no performance regression because
of this patch.

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

15 years agoInitialize CurPPLexer in Preprocessor's constructor.
Ted Kremenek [Wed, 19 Nov 2008 00:44:06 +0000 (00:44 +0000)]
Initialize CurPPLexer in Preprocessor's constructor.

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

15 years agoFix warning about RegionStoreManager::Retrieve() not always returning a value.
Ted Kremenek [Wed, 19 Nov 2008 00:27:37 +0000 (00:27 +0000)]
Fix warning about RegionStoreManager::Retrieve() not always returning a value.

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

15 years agoPartial expansion of C++ operator overloading (for binary operators)
Douglas Gregor [Tue, 18 Nov 2008 23:14:02 +0000 (23:14 +0000)]
Partial expansion of C++ operator overloading (for binary operators)
to support operators defined as member functions, e.g.,

  struct X {
    bool operator==(X&);
  };

Overloading with non-member operators is supported, and the special
rules for the implicit object parameter (e.g., the ability for a
non-const *this to bind to an rvalue) are implemented.

This change also refactors and generalizes the code for adding
overload candidates for overloaded operator calls (C++ [over.match.expr]),
both to match the rules more exactly (name lookup of non-member
operators actually ignores member operators) and to make this routine
more reusable for the other overloaded operators.

Testing for the initialization of the implicit object parameter is
very light. More tests will come when we get support for calling
member functions directly (e.g., o.m(a1, a2)).

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

15 years agostart converting Sema over to using its canonical Diag method.
Chris Lattner [Tue, 18 Nov 2008 22:52:51 +0000 (22:52 +0000)]
start converting Sema over to using its canonical Diag method.

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

15 years agoPatch for generation of weak write barriers for objc
Fariborz Jahanian [Tue, 18 Nov 2008 22:37:34 +0000 (22:37 +0000)]
Patch for generation of weak write barriers for objc
__weak objects.

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

15 years agointroduce the one true Diag method for Sema. Next up: kill all the others off.
Chris Lattner [Tue, 18 Nov 2008 21:53:24 +0000 (21:53 +0000)]
introduce the one true Diag method for Sema.  Next up: kill all the others off.

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

15 years agoAllow diagnostics to be used in bool context, like:
Chris Lattner [Tue, 18 Nov 2008 21:53:02 +0000 (21:53 +0000)]
Allow diagnostics to be used in bool context, like:

return Diag(...);

when the function returns bool.  This always evaluates to true.

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

15 years agoRemove the last of the old-style Preprocessor::Diag methods.
Chris Lattner [Tue, 18 Nov 2008 21:48:13 +0000 (21:48 +0000)]
Remove the last of the old-style Preprocessor::Diag methods.

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

15 years agoGenerate objc_read_weak for __weak objc loads.
Fariborz Jahanian [Tue, 18 Nov 2008 21:45:40 +0000 (21:45 +0000)]
Generate objc_read_weak for __weak objc loads.

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

15 years agoSome basic support toward objective-c's GC code gen.
Fariborz Jahanian [Tue, 18 Nov 2008 20:18:11 +0000 (20:18 +0000)]
Some basic support toward objective-c's GC code gen.

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

15 years agoFix <rdar://problem/6329769> [sema] crash on duplication definition of interface...
Steve Naroff [Tue, 18 Nov 2008 19:15:30 +0000 (19:15 +0000)]
Fix <rdar://problem/6329769> [sema] crash on duplication definition of interface with protocols.

As soon as we detect duplicate interfaces, discontinue further semantic checks (returning the original interface).

This is now consistent with how we handle protocols (and less error prone in general).

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

15 years agoremove this testcase, it fails with -verify still
Torok Edwin [Tue, 18 Nov 2008 18:48:14 +0000 (18:48 +0000)]
remove this testcase, it fails with -verify still

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

15 years agofix test. it now crashes, but thats another problem..
Nuno Lopes [Tue, 18 Nov 2008 17:57:01 +0000 (17:57 +0000)]
fix test. it now crashes, but thats another problem..

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

15 years agoAdd some quick notes on the clang tests and running the LLVM test
Daniel Dunbar [Tue, 18 Nov 2008 17:56:21 +0000 (17:56 +0000)]
Add some quick notes on the clang tests and running the LLVM test
suite with clang.

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

15 years agoInput files should be before link options.
Daniel Dunbar [Tue, 18 Nov 2008 17:38:30 +0000 (17:38 +0000)]
Input files should be before link options.
 - PR3094.
 - No test case, ccc is not really a supported product (llvmc2 already
   got this right).

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

15 years agoadd testcase for PR3093
Torok Edwin [Tue, 18 Nov 2008 17:31:32 +0000 (17:31 +0000)]
add testcase for PR3093

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

15 years agodon't dereference a null pointer
Chris Lattner [Tue, 18 Nov 2008 17:18:16 +0000 (17:18 +0000)]
don't dereference a null pointer

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

15 years agoAs threatened previously: consolidate name lookup and the creation of
Douglas Gregor [Tue, 18 Nov 2008 15:03:34 +0000 (15:03 +0000)]
As threatened previously: consolidate name lookup and the creation of
DeclRefExprs and BlockDeclRefExprs into a single function
Sema::ActOnDeclarationNameExpr, eliminating a bunch of duplicate
lookup-name-and-check-the-result code.

Note that we still have the three parser entry points for identifiers,
operator-function-ids, and conversion-function-ids, since the parser
doesn't (and shouldn't) know about DeclarationNames. This is a Good
Thing (TM), and there will be more entrypoints coming (e.g., for C++
pseudo-destructor expressions).

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

15 years agoExtend DeclarationName to support C++ overloaded operators, e.g.,
Douglas Gregor [Tue, 18 Nov 2008 14:39:36 +0000 (14:39 +0000)]
Extend DeclarationName to support C++ overloaded operators, e.g.,
operator+, directly, using the same mechanism as all other special
names.

Removed the "special" identifiers for the overloaded operators from
the identifier table and IdentifierInfo data structure. IdentifierInfo
is back to representing only real identifiers.

Added a new Action, ActOnOperatorFunctionIdExpr, that builds an
expression from an parsed operator-function-id (e.g., "operator
+"). ActOnIdentifierExpr used to do this job, but
operator-function-ids are no longer represented by IdentifierInfo's.

Extended Declarator to store overloaded operator names.
Sema::GetNameForDeclarator now knows how to turn the operator
name into a DeclarationName for the overloaded operator.

Except for (perhaps) consolidating the functionality of
ActOnIdentifier, ActOnOperatorFunctionIdExpr, and
ActOnConversionFunctionExpr into a common routine that builds an
appropriate DeclRefExpr by looking up a DeclarationName, all of the
work on normalizing declaration names should be complete with this
commit.

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

15 years agoFix 80-col violation.
Zhongxing Xu [Tue, 18 Nov 2008 13:35:51 +0000 (13:35 +0000)]
Fix 80-col violation.

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

15 years agoAdd test cast for struct array.
Zhongxing Xu [Tue, 18 Nov 2008 13:30:46 +0000 (13:30 +0000)]
Add test cast for struct array.

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

15 years agohandle the case that the array element is of structure type when bind the whole array...
Zhongxing Xu [Tue, 18 Nov 2008 13:11:04 +0000 (13:11 +0000)]
handle the case that the array element is of structure type when bind the whole array to a single value (for example, UnknownVal, UndefinedVal).

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

15 years agoremove one more Preprocessor::Diag method.
Chris Lattner [Tue, 18 Nov 2008 08:02:48 +0000 (08:02 +0000)]
remove one more Preprocessor::Diag method.

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

15 years agoConvert the lexer and start converting the PP over to using canonical Diag methods.
Chris Lattner [Tue, 18 Nov 2008 07:59:24 +0000 (07:59 +0000)]
Convert the lexer and start converting the PP over to using canonical Diag methods.

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

15 years agoremove the last couple obsolete forms of Parser::Diag.
Chris Lattner [Tue, 18 Nov 2008 07:50:21 +0000 (07:50 +0000)]
remove the last couple obsolete forms of Parser::Diag.

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

15 years agoChange a couple of the Parser::Diag methods to return DiagnosticInfo
Chris Lattner [Tue, 18 Nov 2008 07:48:38 +0000 (07:48 +0000)]
Change a couple of the Parser::Diag methods to return DiagnosticInfo
and let the clients push whatever they want into the DiagnosticInfo
instead of hard coding a few forms.  Also switch various clients to
use Diag(Tok, ...) instead of Diag(Tok.getLocation(), ...) as the
canonical form to simplify the code a bit.

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

15 years agoThe 'return Diag(...)' idiom should be treated as returning an
Chris Lattner [Tue, 18 Nov 2008 07:47:11 +0000 (07:47 +0000)]
The 'return Diag(...)' idiom should be treated as returning an
invalid expr/stmt, etc.

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

15 years agoGive DiagnosticInfo a real copy constructor, even though it
Chris Lattner [Tue, 18 Nov 2008 07:46:42 +0000 (07:46 +0000)]
Give DiagnosticInfo a real copy constructor, even though it
is destructive.

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

15 years agoalphabeticalize.
Chris Lattner [Tue, 18 Nov 2008 07:46:14 +0000 (07:46 +0000)]
alphabeticalize.

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

15 years agoUpdated checker build.
Ted Kremenek [Tue, 18 Nov 2008 07:27:02 +0000 (07:27 +0000)]
Updated checker build.

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

15 years agoThis reworks some of the Diagnostic interfaces a bit to change how diagnostics
Chris Lattner [Tue, 18 Nov 2008 07:04:44 +0000 (07:04 +0000)]
This reworks some of the Diagnostic interfaces a bit to change how diagnostics
are formed.  In particular, a diagnostic with all its strings and ranges is now
packaged up and sent to DiagnosticClients as a DiagnosticInfo instead of as a
ton of random stuff.  This has the benefit of simplifying the interface, making
it more extensible, and allowing us to do more checking for things like access
past the end of the various arrays passed in.

In addition to introducing DiagnosticInfo, this also substantially changes how
Diagnostic::Report works.  Instead of being passed in all of the info required
to issue a diagnostic, Report now takes only the required info (a location and
ID) and returns a fresh DiagnosticInfo *by value*.  The caller is then free to
stuff strings and ranges into the DiagnosticInfo with the << operator.  When
the dtor runs on the DiagnosticInfo object (which should happen at the end of
the statement), the diagnostic is actually emitted with all of the accumulated
information.  This is a somewhat tricky dance, but it means that the
accumulated DiagnosticInfo is allowed to keep pointers to other expression
temporaries without those pointers getting invalidated.

This is just the minimal change to get this stuff working, but this will allow
us to eliminate the zillions of variant "Diag" methods scattered throughout
(e.g.) sema.  For example, instead of calling:

  Diag(BuiltinLoc, diag::err_overload_no_match, typeNames,
       SourceRange(BuiltinLoc, RParenLoc));

We will soon be able to just do:

  Diag(BuiltinLoc, diag::err_overload_no_match)
      << typeNames << SourceRange(BuiltinLoc, RParenLoc));

This scales better to support arbitrary types being passed in (not just
strings) in a type-safe way.  Go operator overloading?!

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

15 years agoAttribute nonnull can be applied to block pointers.
Ted Kremenek [Tue, 18 Nov 2008 06:52:58 +0000 (06:52 +0000)]
Attribute nonnull can be applied to block pointers.

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

15 years agoSourceManager::getLineNumber is logically const except for caching.
Chris Lattner [Tue, 18 Nov 2008 06:51:15 +0000 (06:51 +0000)]
SourceManager::getLineNumber is logically const except for caching.
Use mutable to make it so.

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

15 years agoeliminate dependence of strange "Diagnostic::Report" method,
Chris Lattner [Tue, 18 Nov 2008 06:07:40 +0000 (06:07 +0000)]
eliminate dependence of strange "Diagnostic::Report" method,
delete huge trailing whitespace to fit in 80 cols.

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

15 years agoremove a helper method with only one call site.
Chris Lattner [Tue, 18 Nov 2008 05:05:28 +0000 (05:05 +0000)]
remove a helper method with only one call site.

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

15 years agoChange the diagnostics interface to take an array of pointers to
Chris Lattner [Tue, 18 Nov 2008 04:56:44 +0000 (04:56 +0000)]
Change the diagnostics interface to take an array of pointers to
strings instead of array of strings.  This reduces string copying
in some not-very-important cases, but paves the way for future
improvements.

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

15 years agocleanups.
Chris Lattner [Tue, 18 Nov 2008 04:53:45 +0000 (04:53 +0000)]
cleanups.

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

15 years agosort files.
Chris Lattner [Tue, 18 Nov 2008 04:48:28 +0000 (04:48 +0000)]
sort files.

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

15 years agocleanups and simplifications.
Chris Lattner [Tue, 18 Nov 2008 04:44:58 +0000 (04:44 +0000)]
cleanups and simplifications.

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

15 years agoPreprocessor::PushIncludeMacroStack() should always zero out CurPPLexer.
Ted Kremenek [Tue, 18 Nov 2008 03:28:24 +0000 (03:28 +0000)]
Preprocessor::PushIncludeMacroStack() should always zero out CurPPLexer.

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

15 years ago- Add Lexer::isPragma() accessor for clients of Lexer that aren't friends.
Ted Kremenek [Tue, 18 Nov 2008 01:33:13 +0000 (01:33 +0000)]
- Add Lexer::isPragma() accessor for clients of Lexer that aren't friends.
- Add static method to test if the current lexer is a non-macro/non-pragma
  lexer.
- Refactor some code in PPLexerChange to use this static method.
- No performance change.

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

15 years agominor cleanups and tidying, no functionality change.
Chris Lattner [Tue, 18 Nov 2008 01:30:42 +0000 (01:30 +0000)]
minor cleanups and tidying, no functionality change.

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

15 years agoimplement a fixme by making warnings for ++/-- on non-modifiable-lvalues better.
Chris Lattner [Tue, 18 Nov 2008 01:26:17 +0000 (01:26 +0000)]
implement a fixme by making warnings for ++/-- on non-modifiable-lvalues better.

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

15 years agofactor some code out into a helper function
Chris Lattner [Tue, 18 Nov 2008 01:22:49 +0000 (01:22 +0000)]
factor some code out into a helper function

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

15 years agoReplace more uses of 'CurLexer->' with 'CurPPLexer->'. No performance change.
Ted Kremenek [Tue, 18 Nov 2008 01:12:54 +0000 (01:12 +0000)]
Replace more uses of 'CurLexer->' with 'CurPPLexer->'.  No performance change.

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

15 years agoAdd hooks to use PTHLexer::Lex instead of Lexer::Lex when CurLexer is null.
Ted Kremenek [Tue, 18 Nov 2008 01:04:47 +0000 (01:04 +0000)]
Add hooks to use PTHLexer::Lex instead of Lexer::Lex when CurLexer is null.
Performance tests on Cocoa.h (using the regular Lexer) shows no performance
difference.

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