Commit Graph

2268 Commits

Author SHA1 Message Date
Chris Lattner f7e3f6d294 remove another old Diag method.
llvm-svn: 59713
2008-11-20 06:13:02 +00:00
Chris Lattner 29e812b905 remove another old-school Diag method.
llvm-svn: 59712
2008-11-20 06:06:08 +00:00
Chris Lattner ec7f7732f1 remove the type_info identifier cache. Compared to the cost
of doing the lookup_decl, the hash lookup is cheap.  Also,
typeid doesn't happen enough in real world code to worry about
it.

I'd like to eventually get rid of KnownFunctionIDs from Sema
also, but today is not that day.

llvm-svn: 59711
2008-11-20 05:51:55 +00:00
Chris Lattner 0e73b2c352 compared to the rest of the code in Sema::GetStdNamespace(),
looking up the "std" identifier is trivial.  Just do it, particularly
since this is only done if the namespace hasn't already been looked up.

llvm-svn: 59710
2008-11-20 05:45:14 +00:00
Chris Lattner 66e32812cd remove some other identifiers that are looked up really early and only
used in one cold place.

llvm-svn: 59709
2008-11-20 05:41:43 +00:00
Chris Lattner 4500f721ed instead of looking up super at startup time,
just check for it when needed.  It doesn't incur real cost
in any hot paths.

llvm-svn: 59708
2008-11-20 05:35:30 +00:00
Chris Lattner 68e486804f Rename IdentifierInfo::isName to ::isStr. Use a nifty trick
from Sebastian to enforce that a literal string is passed in,
and use this to avoid having to call strlen on it.

llvm-svn: 59706
2008-11-20 04:42:34 +00:00
Ted Kremenek 2af3cee287 Make FIXME a hard assertion.
llvm-svn: 59695
2008-11-20 01:52:55 +00:00
Ted Kremenek b33ce32bda Preprocessor::getCurrentFileLexer() now returns a PreprocessorLexer* instead of
a Lexer*. This means it will either return the current (normal) file Lexer or a
PTHLexer.

llvm-svn: 59694
2008-11-20 01:49:44 +00:00
Ted Kremenek 300590b584 Just use the SourceLocation of SysHeaderTok when doing a callback to emit #line
information. A diff of the -E output for Cocoa.h shows that there is no change
in output.

llvm-svn: 59693
2008-11-20 01:45:11 +00:00
Ted Kremenek 6552d259d4 Assign the result of getCurrentFileLexer() to a PreprocessorLexer* instead of Lexer* (narrower interface).
llvm-svn: 59691
2008-11-20 01:35:24 +00:00
Ted Kremenek b0262c1e64 - Default initialize ParsingPreprocessorDirective, ParsingFilename, and
LexingRawMode in the ctor of PreprocessorLexer.

- PTHLexer: Use "LastToken" instead of "NumToken"

llvm-svn: 59690
2008-11-20 01:29:45 +00:00
Ted Kremenek 61915f5d4a Add (untested) implementation of PTHLexer::isNextPPTokenLParen() and PTHLexer::DiscardToEndOfLine().
llvm-svn: 59687
2008-11-20 01:16:50 +00:00
Fariborz Jahanian 003e83004b More objc gc stuff. Read/Write barriers for local static/extern,
diagnostics on use of __weak attribute on fields,
Early support for read/write barriers for objc fields.

llvm-svn: 59682
2008-11-20 00:15:42 +00:00
Douglas Gregor ab7897ac44 Implement the rest of C++ [over.call.object], which permits the object
being called to be converted to a reference-to-function,
pointer-to-function, or reference-to-pointer-to-function. This is done
through "surrogate" candidate functions that model the conversions
from the object to the function (reference/pointer) and the
conversions in the arguments.

llvm-svn: 59674
2008-11-19 22:57:39 +00:00
Ted Kremenek 2861cf42fe Use PreprocessorLexer::getFileID() instead of Lexer::getFileLoc(). This is an intermediate step to having getCurrentLexer() return a PreprocessorLexer* instead of a Lexer*.
llvm-svn: 59672
2008-11-19 22:55:25 +00:00
Ted Kremenek a2c3c8d71c Move more cases of using 'CurLexer' to 'CurPPLexer'.
Use PTHLexer::isNextPPTokenLParen() when using the PTHLexer.

llvm-svn: 59671
2008-11-19 22:43:49 +00:00
Ted Kremenek 11cfbb473e Add stub for PTHLexer::isNextPPTokenLParen().
llvm-svn: 59670
2008-11-19 22:42:26 +00:00
Ted Kremenek 76c3441a4e When using a PTHLexer, use DiscardToEndOfLine() instead of ReadToEndOfLine().
llvm-svn: 59668
2008-11-19 22:21:33 +00:00
Ted Kremenek 45245217bc - 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.

llvm-svn: 59666
2008-11-19 21:57:25 +00:00
Douglas Gregor 91cea0ad1e 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? :)

llvm-svn: 59663
2008-11-19 21:05:33 +00:00
Douglas Gregor 7911b3711d Some tweaks suggested by Argiris
llvm-svn: 59661
2008-11-19 19:09:45 +00:00
Oscar Fuentes 77543d9af0 CMake: Added some source files.
Patch contributed by Jay Foad!

llvm-svn: 59656
2008-11-19 18:46:39 +00:00
Fariborz Jahanian a598b5286e More of objective-c's gc code-gen. Treat objective-c
objects as __strong when attribute unspecified.

llvm-svn: 59654
2008-11-19 18:38:10 +00:00
Argyrios Kyrtzidis 554689a3aa Make DeclContext::getLexicalParent reuse DeclContext::getParent.
llvm-svn: 59651
2008-11-19 18:07:24 +00:00
Argyrios Kyrtzidis 0d09c4944e 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

llvm-svn: 59650
2008-11-19 18:01:13 +00:00
Nuno Lopes 0e33c688d5 fix folding of '*doubleArray'
llvm-svn: 59647
2008-11-19 17:44:31 +00:00
Argyrios Kyrtzidis 7768a30c37 Make the non-const DeclContext::getParent call the const version, instead of the other way around.
llvm-svn: 59646
2008-11-19 17:36:39 +00:00
Fariborz Jahanian 50a1270d87 Few more changes due to Daniel's feedback.
llvm-svn: 59645
2008-11-19 17:34:06 +00:00
Douglas Gregor 40412acc02 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.

llvm-svn: 59643
2008-11-19 17:17:41 +00:00
Steve Naroff 9e4ac111f0 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).

llvm-svn: 59639
2008-11-19 15:54:23 +00:00
Douglas Gregor d08452f60a 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.

llvm-svn: 59638
2008-11-19 15:42:04 +00:00
Argyrios Kyrtzidis 89709ac2cc 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.

llvm-svn: 59636
2008-11-19 15:22:16 +00:00
Argyrios Kyrtzidis f5e2812e69 Remove Preprocessor::CacheTokens boolean data member. The same functionality can be provided by using Preprocessor::isBacktrackEnabled().
llvm-svn: 59631
2008-11-19 14:23:14 +00:00
Daniel Dunbar 7689f6be47 Add spec ref to comment.
llvm-svn: 59622
2008-11-19 11:54:05 +00:00
Zhongxing Xu e5816f213d Add support for symbolicating global structs and arrays in RegionStoreManager::getInitialStore().
llvm-svn: 59619
2008-11-19 11:06:24 +00:00
Zhongxing Xu b8e54884c8 Add SymbolData for array elements and struct fields.
llvm-svn: 59618
2008-11-19 11:03:17 +00:00
Daniel Dunbar af7efa695c Fix silly code, use IdentifierInfo* instead of std::string in
PragmaPackStack. Thanks Chris!

llvm-svn: 59616
2008-11-19 10:32:38 +00:00
Daniel Dunbar 9b1335eca8 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.

llvm-svn: 59615
2008-11-19 09:36:46 +00:00
Sanjiv Gupta f99d54498a Pointer width for PIC16 is 16 bits. Modify getMemCpy, getMemMove and getMemSet accordingly.
llvm-svn: 59613
2008-11-19 09:02:07 +00:00
Chris Lattner e503373e67 fix save-o
llvm-svn: 59611
2008-11-19 08:26:36 +00:00
Chris Lattner d9c7bcf4bc simplify
llvm-svn: 59610
2008-11-19 08:24:49 +00:00
Chris Lattner 4bd8dd8568 stop calling II::getName() unnecesarily in sema
llvm-svn: 59609
2008-11-19 08:23:25 +00:00
Chris Lattner 6ef2bc4b42 simplify some code.
llvm-svn: 59608
2008-11-19 07:55:04 +00:00
Chris Lattner 760d19ade1 remove uses of IdentifierInfo::getName()
llvm-svn: 59607
2008-11-19 07:51:13 +00:00
Chris Lattner 406c096993 remove some uses of IdentifierInfo::getName()
llvm-svn: 59606
2008-11-19 07:49:38 +00:00
Chris Lattner 66e3877b42 Use smallstring instead of new[]'ing a string. This simplifies
the code and speeds it up.

llvm-svn: 59604
2008-11-19 07:41:27 +00:00
Chris Lattner ebad6a220f remove uses of IdentifierInfo::getName()
llvm-svn: 59603
2008-11-19 07:37:42 +00:00
Chris Lattner c5cdade2df don't turn identifierinfo's into strings in diagnostics.
llvm-svn: 59602
2008-11-19 07:33:58 +00:00
Chris Lattner b91fd17b7d Allow sending IdentifierInfo*'s into Diagnostics without turning them into strings
first.  This should allow removal of a bunch of II->getName() calls.

llvm-svn: 59601
2008-11-19 07:32:16 +00:00