Commit Graph

7559 Commits

Author SHA1 Message Date
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 16a92afc4b Add test for path-sensitive uninit-val detection involving struct field.
llvm-svn: 59620
2008-11-19 11:10:42 +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 49c017f4ea 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);
  }

llvm-svn: 59605
2008-11-19 07:49:14 +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
Chris Lattner f76c09dcaa convert some diags to use numbers instead of strings.
llvm-svn: 59600
2008-11-19 07:25:44 +00:00
Chris Lattner 230fc3d17d formatting
llvm-svn: 59599
2008-11-19 07:24:05 +00:00
Chris Lattner 91aea716c6 add direct support for signed and unsigned integer arguments to diagnostics.
llvm-svn: 59598
2008-11-19 07:22:31 +00:00
Chris Lattner 327984f4c4 switch TextDiagnosticPrinter to raw_ostream.
llvm-svn: 59597
2008-11-19 06:56:25 +00:00
Chris Lattner 23be067407 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 %%.

llvm-svn: 59596
2008-11-19 06:51:40 +00:00
Daniel Dunbar 1b9ad472a4 Discard unused runtime function declarations (for readability).
llvm-svn: 59594
2008-11-19 06:15:35 +00:00
Chris Lattner 8d5bec4c7d 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.

llvm-svn: 59593
2008-11-19 06:04:55 +00:00
Ted Kremenek 29704928b7 Updated checker build.
llvm-svn: 59591
2008-11-19 05:46:43 +00:00
Chris Lattner 5d78c9ab5d Address Sebastian and Doug's objections with taking pointers to temporaries.
Instead of doing that, copy the strings into the diagnostic info.

llvm-svn: 59590
2008-11-19 05:34:22 +00:00
Chris Lattner f490e15729 remove one more old-style Diag method.
llvm-svn: 59589
2008-11-19 05:27:50 +00:00
Chris Lattner 3b05413e9d 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.

llvm-svn: 59588
2008-11-19 05:08:23 +00:00
Douglas Gregor ca63811b39 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.

llvm-svn: 59583
2008-11-19 03:25:36 +00:00
Ted Kremenek a7c279ba40 Revert 59574 (caused tests to fail).
llvm-svn: 59579
2008-11-19 01:54:47 +00:00
Ted Kremenek 5a205a57d8 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

llvm-svn: 59578
2008-11-19 01:46:21 +00:00
Fariborz Jahanian d7db964495 Generate strong write barriers for __strong objects.
Also, took care of Daniel's commments.

llvm-svn: 59575
2008-11-19 00:59:10 +00:00
Ted Kremenek 1b167108bb - 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.

llvm-svn: 59574
2008-11-19 00:46:18 +00:00
Ted Kremenek c7a366309d Initialize CurPPLexer in Preprocessor's constructor.
llvm-svn: 59573
2008-11-19 00:44:06 +00:00
Ted Kremenek c0145fd0bf Fix warning about RegionStoreManager::Retrieve() not always returning a value.
llvm-svn: 59571
2008-11-19 00:27:37 +00:00
Douglas Gregor 436424cfa5 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)).

llvm-svn: 59564
2008-11-18 23:14:02 +00:00
Chris Lattner 377d1f8eae start converting Sema over to using its canonical Diag method.
llvm-svn: 59561
2008-11-18 22:52:51 +00:00
Fariborz Jahanian 83f45b55f8 Patch for generation of weak write barriers for objc
__weak objects.

llvm-svn: 59560
2008-11-18 22:37:34 +00:00
Chris Lattner 84f1ee3001 introduce the one true Diag method for Sema. Next up: kill all the others off.
llvm-svn: 59556
2008-11-18 21:53:24 +00:00
Chris Lattner a7fc74fdc1 Allow diagnostics to be used in bool context, like:
return Diag(...);

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

llvm-svn: 59555
2008-11-18 21:53:02 +00:00
Chris Lattner e05c4dfc42 Remove the last of the old-style Preprocessor::Diag methods.
llvm-svn: 59554
2008-11-18 21:48:13 +00:00
Fariborz Jahanian f5125d19e7 Generate objc_read_weak for __weak objc loads.
llvm-svn: 59553
2008-11-18 21:45:40 +00:00
Fariborz Jahanian 406b117eea Some basic support toward objective-c's GC code gen.
llvm-svn: 59543
2008-11-18 20:18:11 +00:00
Steve Naroff 119f60e12a 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).

llvm-svn: 59541
2008-11-18 19:15:30 +00:00
Torok Edwin c63831dd6a remove this testcase, it fails with -verify still
llvm-svn: 59539
2008-11-18 18:48:14 +00:00
Nuno Lopes b4e7e859e2 fix test. it now crashes, but thats another problem..
llvm-svn: 59537
2008-11-18 17:57:01 +00:00
Daniel Dunbar bf45c9a4e4 Add some quick notes on the clang tests and running the LLVM test
suite with clang.

llvm-svn: 59536
2008-11-18 17:56:21 +00:00