Commit Graph

7918 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis ace521a1e1 Implement some suggestions by Daniel:
-Change Parser::ParseCXXScopeSpecifier to MaybeParseCXXScopeSpecifier
-Remove Parser::isTokenCXXScopeSpecifier and fold it into MaybeParseCXXScopeSpecifier
-Rename Parser::TryAnnotateScopeToken to TryAnnotateCXXScopeToken and only allow it to be called when in C++

llvm-svn: 60117
2008-11-26 21:41:52 +00:00
Argyrios Kyrtzidis 041f958303 Add an overload for operator<<(const DiagnosticBuilder &DB,bool I).
Fixes building error on MSVC where passing bool couldn't resolve to one of the overloads.

llvm-svn: 60116
2008-11-26 20:39:45 +00:00
Fariborz Jahanian e7167c28f6 Removed a FIXME. Added a test case for anonymous category.
llvm-svn: 60115
2008-11-26 20:33:54 +00:00
Fariborz Jahanian f8ef9f3dc9 Set default property attributes on each property.
Implemented anonymous category (also know as continuation class)
used to override main class's property attribute. This is work in 
propgress.

llvm-svn: 60114
2008-11-26 20:01:34 +00:00
Anders Carlsson f7a9a92359 Convert incomplete array types before emitting debug info for them, fixes PR3134.
llvm-svn: 60109
2008-11-26 17:40:42 +00:00
Nuno Lopes 8c6fbc04ee add missing RUN lines
llvm-svn: 60107
2008-11-26 15:50:12 +00:00
Douglas Gregor 08d96d5182 Fix a minor typo in the handling of the conditional operator for Objective-C interface pointers
llvm-svn: 60096
2008-11-26 06:43:45 +00:00
Douglas Gregor a60a6914cc Tweak the new ResolveOverloadedCallFn to just return a FunctionDecl. It makes ActOnCallExpr simpler
llvm-svn: 60094
2008-11-26 06:01:48 +00:00
Douglas Gregor 99dcbff154 Move the overloading logic of Sema::ActOnCallExpr to a separate function
llvm-svn: 60093
2008-11-26 05:54:23 +00:00
Zhongxing Xu 21148402d6 Add plugin loading for clang. This will be used to load alternative constraint manager for static analysis.
llvm-svn: 60091
2008-11-26 05:23:17 +00:00
Devang Patel c6fab4f50f Disable -loop-index-split for now.
llvm-svn: 60089
2008-11-26 05:01:52 +00:00
Ted Kremenek bf2d60145d Re-apply r60071 now that raw_fd_ostream::tell has been committed.
llvm-svn: 60086
2008-11-26 03:36:26 +00:00
Daniel Dunbar 3ea9485335 Revert 60071, depends on uncommitted LLVM changes.
llvm-svn: 60077
2008-11-26 02:18:33 +00:00
Ted Kremenek 22d4b885fd Migrate token-cache generation logic from dummy harness in PPLexerChange.cpp to CacheTokens.cpp.
llvm-svn: 60071
2008-11-26 00:57:55 +00:00
Ted Kremenek e6847594ef Add setter method PreprocessorLexer::setParsingPreprocessorDirective(). This will be used by the mechanism to generate cached tokens.
llvm-svn: 60070
2008-11-26 00:57:02 +00:00
Nuno Lopes 615f34c719 remove debug-only assertion in the complex float evaluator as it makes some real apps crash
llvm-svn: 60069
2008-11-26 00:39:53 +00:00
Daniel Dunbar 762e77b55f Only call TryAnnotateScopeToken when parsing C++.
- This improves -parse-noop of Carbon.h by +2%, and I believe
   compensates for the majority of the performance regression in r58913.

llvm-svn: 60063
2008-11-25 23:05:24 +00:00
Anders Carlsson 32ef8ceaa1 Handle returning complex types that get coerced. Fixes PR3131
llvm-svn: 60058
2008-11-25 22:21:48 +00:00
Sebastian Redl 511ed55524 Use RAII objects to ensure proper destruction of expression and statement AST nodes in the parser in most cases, even on error.
llvm-svn: 60057
2008-11-25 22:21:31 +00:00
Daniel Dunbar 44b58a2c14 Fix 80-col violations.
llvm-svn: 60051
2008-11-25 21:53:21 +00:00
Fariborz Jahanian 829b908b74 Refactored checking on readonly property into a method.
llvm-svn: 60050
2008-11-25 21:48:26 +00:00
Fariborz Jahanian 9a207ee4dc Patch to allow over-riding of readonly property to
a writable property in one of its category.

llvm-svn: 60035
2008-11-25 17:56:43 +00:00
Anders Carlsson 28a423f42e Remove more #ifdeffed code
llvm-svn: 60033
2008-11-25 17:16:39 +00:00
Anders Carlsson 9f77f60620 Remove the #ifdeffed out code.
llvm-svn: 60032
2008-11-25 17:10:10 +00:00
Nuno Lopes 6cdcbd1f95 add note about running the test suite with valgrind
llvm-svn: 60029
2008-11-25 15:46:06 +00:00
Nuno Lopes a1232e5d7f remove unused var
llvm-svn: 60018
2008-11-25 12:23:46 +00:00
Douglas Gregor 3ff3cf5f21 Test another error message, make sure to verify C++ new and delete tests
llvm-svn: 60007
2008-11-25 04:08:05 +00:00
Douglas Gregor 2afd0be069 Simple parsing of exception specifications, with no semantic analysis yet
llvm-svn: 60005
2008-11-25 03:22:00 +00:00
Zhongxing Xu f39268ae8c Add documentation for test.
llvm-svn: 60002
2008-11-25 01:45:11 +00:00
Daniel Dunbar 5c4cc09498 Comment fix.
llvm-svn: 59997
2008-11-25 00:20:22 +00:00
Zhongxing Xu 2939a50b67 Add no-warning to test case.
llvm-svn: 59995
2008-11-24 23:45:56 +00:00
Fariborz Jahanian 8fc3741b76 Patch to remove bogus waring when a property declaration
is imported from a protocol into the implementation.

llvm-svn: 59988
2008-11-24 22:16:00 +00:00
Sebastian Redl 198a5838df Remove an empty if and add a reminder for when we implement C++ try-catch.
llvm-svn: 59987
2008-11-24 21:45:59 +00:00
Ted Kremenek 3ca000af83 Display the function we are analyzing before running LiveVariables.
llvm-svn: 59983
2008-11-24 20:53:32 +00:00
Ted Kremenek e03879b8ad Fix CFG bug where the 'increment' block for a 'for' statement would not be
properly reversed once constructed.

This fixes PR 3125:

http://llvm.org/bugs/show_bug.cgi?id=3125

llvm-svn: 59982
2008-11-24 20:50:24 +00:00
Sebastian Redl 849b1e6ac7 Remove some bad characters from comment.
llvm-svn: 59979
2008-11-24 20:06:50 +00:00
Sebastian Redl f7cb84d771 Fix the fix of revision 59974. Now array-struct.c passes too.
llvm-svn: 59975
2008-11-24 19:39:40 +00:00
Sebastian Redl 81c1e1306c Fix crash of array bounds checking under 64-bit.
There might be other, similar bugs lurking there.

llvm-svn: 59974
2008-11-24 19:35:33 +00:00
Ted Kremenek 01c414c070 Remove FIXME comment.
llvm-svn: 59973
2008-11-24 19:27:06 +00:00
Zhongxing Xu 9165ed69af Add support for AllocaRegion extent with GDM.
One design problem that is emerging is the signed-ness problem during static
analysis. Many unsigned value have to be converted into signed value because
it partipates in operations with signed values. 

On the other hand, we cannot blindly make all values occuring in static analysis
signed, because we do have cases where unsignedness is required, for example,
integer overflow detection.

llvm-svn: 59957
2008-11-24 09:44:56 +00:00
Zhongxing Xu 1dffa8cd73 Add utility methods.
llvm-svn: 59956
2008-11-24 09:38:21 +00:00
Zhongxing Xu f1b4ff28a7 Fix 80-col violation.
llvm-svn: 59954
2008-11-24 07:38:01 +00:00
Zhongxing Xu 6587c75488 Cleanup code with utility method.
llvm-svn: 59951
2008-11-24 07:02:06 +00:00
Chris Lattner 1e5665e6be Change a whole lot of diagnostics to take QualType's directly
instead of converting them to strings first.  This also fixes a
bunch of minor inconsistencies in the diagnostics emitted by clang
and adds a bunch of FIXME's to DiagnosticKinds.def.

llvm-svn: 59948
2008-11-24 06:25:27 +00:00
Chris Lattner f3d3faeca6 Rename NamedDecl::getName() to getNameAsString(). Replace a bunch of
uses of getName() with uses of getDeclName().  This upgrades a bunch of
diags to take DeclNames instead of std::strings.

This also tweaks a couple of diagnostics to be cleaner and changes
CheckInitializerTypes/PerformInitializationByConstructor to pass
around DeclarationNames instead of std::strings.

llvm-svn: 59947
2008-11-24 05:29:24 +00:00
Anders Carlsson a7c5eb72a0 Reimplement Expr::isConstantExpr in terms of Expr::Evaluate. This fixes PR2832.
llvm-svn: 59946
2008-11-24 05:23:59 +00:00
Anders Carlsson 4fb8a9c6b6 __builtin_constant_p takes an argument that can have any type.
llvm-svn: 59944
2008-11-24 05:23:12 +00:00
Zhongxing Xu f556cd6cb9 Strings are NULL terminated. So the region size should plus one.
llvm-svn: 59943
2008-11-24 05:16:01 +00:00
Anders Carlsson 87da2b5dce Forgot the newline :)
llvm-svn: 59942
2008-11-24 05:13:45 +00:00
Anders Carlsson 3abcb58a35 Add test case for bug that's been fixed.
llvm-svn: 59941
2008-11-24 05:11:21 +00:00
Anders Carlsson a42ee44aab The address of a variable is only constant if the variable has global storage.
llvm-svn: 59939
2008-11-24 04:41:22 +00:00
Anders Carlsson 4c76e93507 Fix bug in the constant evaluator. Fixes PR3115.
llvm-svn: 59938
2008-11-24 04:21:33 +00:00
Chris Lattner 1cbaacc4a0 Migrate some stuff from NamedDecl::getName() to
NamedDecl::getNameAsString() to make it more explicit.

llvm-svn: 59937
2008-11-24 04:00:27 +00:00
Chris Lattner 86d7d91366 Rename NamedDecl::getIdentifierName() to ::getNameAsCString() and make it
assert if the name is not an identifier.  Update callers to do the right
thing and avoid this method in unsafe cases.  This also fixes an objc
warning that was missing a space, and migrates a couple more to taking
IdentifierInfo and QualTypes instead of std::strings.

llvm-svn: 59936
2008-11-24 03:54:41 +00:00
Chris Lattner 9b1f2792ba simplify this code.
llvm-svn: 59935
2008-11-24 03:52:59 +00:00
Chris Lattner e4b95698df Rename Selector::getName() to Selector::getAsString(), and add
a new NamedDecl::getAsString() method.

Change uses of Selector::getName() to just pass in a Selector 
where possible (e.g. to diagnostics) instead of going through
an std::string.

This also adds new formatters for objcinstance and objcclass
as described in the dox.

llvm-svn: 59933
2008-11-24 03:33:13 +00:00
Zhongxing Xu 8361d4c51b Add a comment about the signedness.
llvm-svn: 59932
2008-11-24 02:30:48 +00:00
Zhongxing Xu bf900755d0 Add test case for out-of-bound memory access checking.
llvm-svn: 59931
2008-11-24 02:19:49 +00:00
Zhongxing Xu a61731dd0d Add getSize() support for StringRegion.
llvm-svn: 59930
2008-11-24 02:18:56 +00:00
Chris Lattner 4fc69799f5 Rewrite FindDiagnostics to be more strict about the formatting of the
expected-foo strings.  Now the only allowed characters between 
expected-error and {{  is whitespace.

llvm-svn: 59925
2008-11-24 01:28:17 +00:00
Chris Lattner f3ab014308 clean up -verify mode output. If the expected-error string is
mangled, report it using the diagnostics machinery instead of printf.

llvm-svn: 59924
2008-11-23 23:38:26 +00:00
Chris Lattner 12f7c5a36a convert some more warnings to NOTEs.
llvm-svn: 59923
2008-11-23 23:26:13 +00:00
Chris Lattner d068503565 remove warn_previous_declaration
llvm-svn: 59922
2008-11-23 23:20:13 +00:00
Chris Lattner 03c4041cb5 make the 'to match this' diagnostic a note.
llvm-svn: 59921
2008-11-23 23:17:07 +00:00
Chris Lattner 0369c57ac6 Make all the 'redefinition' diagnostics more consistent, and make the
"previously defined here" diagnostics all notes.

llvm-svn: 59920
2008-11-23 23:12:31 +00:00
Chris Lattner e6447ef989 make some objc redefinition warnings more consistent: call definitions
"definitions", not declarations.  Point out the location of the 
original definition.

llvm-svn: 59919
2008-11-23 22:46:27 +00:00
Chris Lattner 88dcd2a1ab Tweak duplicate category diagnostic to work like the duplicate protocol diagnostic.
Also, point out where the previous decl was.  This unxfails two tests.

llvm-svn: 59918
2008-11-23 22:38:38 +00:00
Chris Lattner e3d20d9545 Convert IdentifierInfo's to be printed the same as DeclarationNames
with implicit quotes around them.  This has a bunch of follow-on 
effects and requires tweaking to a whole lot of code.  This causes
a regression in two tests (xfailed) by causing it to emit things like:

  Line 10: duplicate interface declaration for category 'MyClass1' ('Category1')

instead of:

  Line 10: duplicate interface declaration for category 'MyClass1(Category1)'

I will fix this in a follow-up commit.

As part of this, I had to start switching stuff to use ->getDeclName() instead
of Decl::getName() for consistency.  This is good, but I was planning to do this
as an independent patch.  There will be several follow-on patches
to clean up some of the mess, but this patch is already too big.

llvm-svn: 59917
2008-11-23 21:45:46 +00:00
Chris Lattner f7e69d5a77 add support for inserting a DeclarationName into a diagnostic directly
without calling getAsString().  This implicitly puts quotes around the
name, so diagnostics need to be tweaked to accommodate this.

llvm-svn: 59916
2008-11-23 20:28:15 +00:00
Chris Lattner d125393d24 inserting a qualtype adds quotes implicitly
llvm-svn: 59915
2008-11-23 20:27:13 +00:00
Chris Lattner 63ecc509e3 Genericize the qualtype formating callback to support any diag argument.
No functionality change.

llvm-svn: 59908
2008-11-23 09:21:17 +00:00
Chris Lattner 6a2ed6f6dc Add support for sending QualType's directly into diags and convert two
diags over to use this.  QualTypes implicitly print single quotes around 
them for uniformity and future extension.

Doing this requires a little function pointer dance to prevent libbasic
from depending on libast.

llvm-svn: 59907
2008-11-23 09:13:29 +00:00
Chris Lattner 4e2e9f1a5d other minor edits.
llvm-svn: 59906
2008-11-23 08:32:53 +00:00
Chris Lattner c788a8bdec minor cleanups.
llvm-svn: 59905
2008-11-23 08:16:56 +00:00
Zhongxing Xu aa86cff14c Add out-of-bound memory access warning report code.
llvm-svn: 59903
2008-11-23 05:52:28 +00:00
Zhongxing Xu 60d6cd1940 Improve test case.
llvm-svn: 59902
2008-11-23 05:50:21 +00:00
Zhongxing Xu cdf25053ee Clean up code by using utility methods.
llvm-svn: 59899
2008-11-23 04:30:35 +00:00
Chris Lattner 1fea89ccb1 finish up the diagnostics documentation. We don't
support QualType and DeclarationName yet, so some of it
is lies, however, this will be fixed shortly.

llvm-svn: 59896
2008-11-23 00:42:53 +00:00
Chris Lattner 80bec16f14 more updates
llvm-svn: 59895
2008-11-23 00:28:33 +00:00
Chris Lattner cc6147cd3b finish documentation of %select.
llvm-svn: 59892
2008-11-22 23:50:47 +00:00
Anders Carlsson 7c282e4f3f Return false if we encounter a type we can't handle.
llvm-svn: 59889
2008-11-22 22:56:32 +00:00
Sebastian Redl 632ab20e1e Fix test cases broken by quote normalization in diagnostics.
llvm-svn: 59888
2008-11-22 22:39:41 +00:00
Anders Carlsson 4046e65b27 An expression is not foldable if it can't be fully evaluated. Fixes PR3060
llvm-svn: 59887
2008-11-22 22:32:07 +00:00
Fariborz Jahanian 9ac535162b Implemented ir-gen for 'implicit' properties using the new AST nodes.
llvm-svn: 59886
2008-11-22 22:30:21 +00:00
Sebastian Redl 6cae80da20 Documentation for the plural modifier.
llvm-svn: 59885
2008-11-22 22:16:45 +00:00
Anders Carlsson 475f4bce36 Case values must be evaluated
llvm-svn: 59884
2008-11-22 21:50:49 +00:00
Chris Lattner e72a8a3048 start documenting Diagnostics. Sebastian, I'd appreciate it
if you can fill in the section for %plural.

llvm-svn: 59883
2008-11-22 21:41:31 +00:00
Chris Lattner ddda82b200 consistently use single quotes for quoted things.
llvm-svn: 59882
2008-11-22 21:16:43 +00:00
Anders Carlsson 59689ed764 Use Expr::Evaluate for case statements. Fixes PR2525
llvm-svn: 59881
2008-11-22 21:04:56 +00:00
Anders Carlsson 2fedf0e8f7 Fix indentation width.
llvm-svn: 59880
2008-11-22 20:49:42 +00:00
Chris Lattner bd414e34c2 remove a dead enum
llvm-svn: 59879
2008-11-22 20:47:38 +00:00
Fariborz Jahanian 5118c418e6 Support for implicit property assignment. Error assigning to
'implicit' property with no 'setter'.

llvm-svn: 59878
2008-11-22 20:25:50 +00:00
Chris Lattner 8cd9b96ee1 add a silly testcase
llvm-svn: 59877
2008-11-22 19:57:03 +00:00
Fariborz Jahanian bf65ce5372 And a test case for my last patch.
llvm-svn: 59875
2008-11-22 18:40:47 +00:00
Fariborz Jahanian 8a1810f06b New AST node to access "implicit" setter/getter using property dor syntax.
Issuing diagnostics when assigning to read-only properties.
This is work in progress.

llvm-svn: 59874
2008-11-22 18:39:36 +00:00
Sebastian Redl 15b02d2e62 Implement a %plural modifier for complex plural forms in diagnostics. Use it in the overload diagnostics.
llvm-svn: 59871
2008-11-22 13:44:36 +00:00
Zhongxing Xu 4c8bf0086a Remove debug code.
llvm-svn: 59870
2008-11-22 13:23:00 +00:00
Zhongxing Xu 4d45b34a8a Initial support for checking out of bound memory access. Only support
ConcreteInt index for now.

llvm-svn: 59869
2008-11-22 13:21:46 +00:00
Chris Lattner 3b0f3ef97e remove some more old Diag methods, replace with a single static helper function
llvm-svn: 59868
2008-11-22 08:32:36 +00:00
Chris Lattner bc495d775f move the Diag method for Sema to be inline. This shrinks the release-asserts
clang executable (when built with gcc 4.2 on the mac) from 14519740 to 
14495028 bytes.  This shrinks individual object files as well: SemaChecking
from 23580->22248, SemaDeclObjc from 61368->57376, SemaExpr from 
115628->110516, as well as several others.

llvm-svn: 59867
2008-11-22 08:28:49 +00:00
Chris Lattner 060068a0ef alphabeticalize.
llvm-svn: 59866
2008-11-22 08:22:53 +00:00
Chris Lattner f3cb394f41 Fix a weird inconsistency with hex floats. Previously the lexer
would not eat the "-1" in "0x0p-1", but LiteralSupport would accept
it when extensions are on.  This caused strangeness and failures 
when hexfloats were properly treated as an extension (not error)
in LiteralSupport.

llvm-svn: 59865
2008-11-22 07:39:03 +00:00
Chris Lattner 59acca5874 remove the NumericLiteralParser::Diag helper method, inlining it into
its call sites.  This makes it more explicit when the hasError flag is
getting set and removes a confusing difference in behavior between
PP.Diag and Diag in this code.

llvm-svn: 59863
2008-11-22 07:23:31 +00:00
Chris Lattner 1ef2028205 Move the Preprocessor::Diag methods inline. This has the interesting
(and carefully calculated) effect of allowing the compiler to reason
about the aliasing properties of DiagnosticBuilder object better,
allowing the whole thing to be promoted to registers instead of
resulting in a ton of stack traffic.

While I'm not very concerned about the performance of the Diag() method
invocations, I *am* more concerned about their code size and impact on the
non-diagnostic code.  This patch shrinks the clang executable (in 
release-asserts mode with gcc-4.2) from 14523980 to 14519816 bytes.  This
isn't much, but it shrinks the lexer from 38192 to 37776, PPDirectives.o
from 31116 to 28868 bytes, etc.

llvm-svn: 59862
2008-11-22 07:03:46 +00:00
Anders Carlsson 4d5f2e532c Add test for PR2992.
llvm-svn: 59861
2008-11-22 06:42:54 +00:00
Chris Lattner fdabe83c67 inline a method into its only two call sites.
llvm-svn: 59860
2008-11-22 06:42:31 +00:00
Chris Lattner 014156e108 actually, this version isn't really needed.
llvm-svn: 59859
2008-11-22 06:22:39 +00:00
Chris Lattner 57dab26be1 remove a sneaky version of Diag hiding in PreprocessorLexer.
llvm-svn: 59858
2008-11-22 06:20:42 +00:00
Anders Carlsson 20e11f8fc8 Use tryEvaluate for constant exprs.
llvm-svn: 59857
2008-11-22 02:34:39 +00:00
Chris Lattner 6d27a16b95 Change the Lexer::Diag method to not magically silence warnings,
force the caller to check instead.  This eliminates the need (and the
risk!) of weird null DiagnosticBuilder's floating around.

llvm-svn: 59856
2008-11-22 02:02:22 +00:00
Chris Lattner 399f9656ba Teach tentative parsing to handle block pointers (rdar://6394309)
llvm-svn: 59853
2008-11-22 01:15:33 +00:00
Chris Lattner afd8aa9d73 fit in 80 cols
llvm-svn: 59851
2008-11-22 01:04:49 +00:00
Ted Kremenek 25391e7cb7 reverting this because it breaks some blocks cases, I'll send doug a testcase
llvm-svn: 59850
2008-11-22 01:04:48 +00:00
Chris Lattner 427c9c1763 Split the DiagnosticInfo class into two disjoint classes:
one for building up the diagnostic that is in flight (DiagnosticBuilder)
and one for pulling structured information out of the diagnostic when
formatting and presenting it.

There is no functionality change with this patch.

llvm-svn: 59849
2008-11-22 00:59:29 +00:00
Ted Kremenek a3148f16e4 Fix predicate: we're not in caching mode if CurPPLexer == 0, not CurLexer == 0.
llvm-svn: 59848
2008-11-22 00:41:34 +00:00
Ted Kremenek 6b3ced2b15 In PTHLexer::DiscardToEndOfLine() use Lex() instead of AdvanceToken(). This handles transitions in the preprocessor state.
llvm-svn: 59845
2008-11-21 23:28:56 +00:00
Ted Kremenek 1ad05ce600 Reenable the default lexer.
llvm-svn: 59843
2008-11-21 20:51:59 +00:00
Ted Kremenek b6209858cb When creating the raw tokens for PTHLexer, make sure the token representing the file to include is checked for being an identifier.
llvm-svn: 59842
2008-11-21 20:51:15 +00:00
Ted Kremenek 72d9912b08 When creating raw tokens for the PTHLexer specially handle angled strings for #include directives.
llvm-svn: 59840
2008-11-21 19:41:29 +00:00
Fariborz Jahanian e2caaaa13c Fixed bugzilla bug# 3095 related to code gen. for @synchronized.
llvm-svn: 59838
2008-11-21 19:21:53 +00:00
Sebastian Redl bd150f431e Implementation of new and delete parsing and sema.
This version uses VLAs to represent arrays. I'll try an alternative way next, but I want this safe first.

llvm-svn: 59835
2008-11-21 19:14:01 +00:00
Chris Lattner 841399c95a rearrange some fields.
llvm-svn: 59832
2008-11-21 18:59:21 +00:00
Chris Lattner cedef8d111 merge some simple call diagnostics.
llvm-svn: 59831
2008-11-21 18:44:24 +00:00
Chris Lattner 40bb0c83d4 print a type in a diagnostic.
llvm-svn: 59829
2008-11-21 18:27:34 +00:00
Fariborz Jahanian 735a4158d9 Fields of ivars of struct types are considered ivars
themselves for gc API generation purposes.

llvm-svn: 59828
2008-11-21 18:14:01 +00:00
Douglas Gregor 09075a99e0 Don't turn off blocks in C++
llvm-svn: 59827
2008-11-21 17:10:06 +00:00
Chris Lattner 0f137df0aa reapply the (corrected) patch to use the new llvm intrinsics for memcpy/memmove etc.
llvm-svn: 59824
2008-11-21 16:43:15 +00:00
Douglas Gregor 5d58c3a568 Allow redeclaration of typedefs in C++
llvm-svn: 59822
2008-11-21 16:29:06 +00:00
Chris Lattner b7f4ce3de7 temporarily revert Sangiv's patch.
llvm-svn: 59821
2008-11-21 16:26:37 +00:00
Douglas Gregor 15799fd210 Tiny fix to the parsing of linkage-specifications
llvm-svn: 59820
2008-11-21 16:10:08 +00:00
Douglas Gregor b81897cda6 Fix overloading of non-static member functions that differ in their cv-qualifiers
llvm-svn: 59819
2008-11-21 15:36:28 +00:00
Douglas Gregor 9eb16eadfb Enable some more operator overloading tests, and don't look into an identifier for functions that might not have one
llvm-svn: 59818
2008-11-21 15:30:19 +00:00
Sanjiv Gupta 371298488b mem[cpy,set,move] intrinsics are now overloaded.
llvm-svn: 59806
2008-11-21 07:57:42 +00:00
Chris Lattner c5bab9f35e merge 3 more diagnostics into 1.
llvm-svn: 59805
2008-11-21 07:57:12 +00:00
Chris Lattner 2b78690a9c Add the concept of "modifiers" to the clang diagnostic format
strings.  This allows us to have considerable flexibility in how
these things are displayed and provides extra information that
allows us to merge away diagnostics that are very similar.

Diagnostic modifiers are a string of characters with the regex
[-a-z]+ that occur between the % and digit.  They may 
optionally have an argument that can parameterize them.

For now, I've added two example modifiers.  One is a very useful
tool that allows you to factor commonality across diagnostics
that need single words or phrases combined.  Basically you can
use %select{a|b|c}4 with with an integer argument that selects
either a/b/c based on an integer value in the range [0..3).

The second modifier is also an integer modifier, aimed to help
English diagnostics handle plurality.  "%s3" prints to 's' if 
integer argument #3 is not 1, otherwise it prints to nothing.
I'm fully aware that 's' is an English concept and doesn't
apply to all situations (mouse vs mice).  However, this is very
useful and we can add other crazy modifiers once we add support
for polish! ;-)

I converted a couple C++ diagnostics over to use this as an
example, I'd appreciate it if others could merge the other
likely candiates.  If you have other modifiers that you want,
lets talk on cfe-dev.

llvm-svn: 59803
2008-11-21 07:50:02 +00:00
Chris Lattner 6b0cf14ba4 Change CheckIncrementDecrementOperand to test for common cases first
and fall through better.

llvm-svn: 59799
2008-11-21 07:05:48 +00:00
Chris Lattner 85a94a04f4 move the diagnostic location and ID out of DiagnosticInfo and store it in
the Diagnostic class. Since we can already only have one diagnostic in 
flight at a time, this shrinks DiagnosticInfo.

This reduces DiagnosticInfo to being basically a rather crazy smart pointer
to a DiagnosticInfo :)

llvm-svn: 59798
2008-11-21 06:59:12 +00:00
Chris Lattner b11c23da14 move diagnostic insertion methods to be free methods instead of
in the DiagnosticInfo class.  This requires marking them as taking
a const DiagnosticInfo, which is bogus (they logically mutate DI), 
but works with the C++ type system.

llvm-svn: 59797
2008-11-21 06:54:20 +00:00
Chris Lattner adcbb7f85d testcase for PR3096
llvm-svn: 59794
2008-11-21 06:19:48 +00:00
Douglas Gregor 9ecea26443 Cleanup memory management in overloading of operator->, slightly
llvm-svn: 59791
2008-11-21 03:04:22 +00:00
Douglas Gregor 4fc308bd3b Don't print canonical types in overloading-related diagnostics
llvm-svn: 59789
2008-11-21 02:54:28 +00:00
Chris Lattner fd384b1b3a Change -verify mode to find the "expected-error" and "expected-warning" strings
with a raw lexer instead of a PP lexer.  This means that -verify doesn't scan
#include'd headers for expected-error/warning strings, and it also means that it
doesn't ignore them in #if 0.

llvm-svn: 59774
2008-11-21 01:18:36 +00:00
Ted Kremenek 473d76e81d Add comment to IsFileLexer, clean up indentation, and tighten how it's written.
llvm-svn: 59773
2008-11-21 01:07:52 +00:00
Chris Lattner 66c8bebe81 remove expected-error from #if 0 section of code.
llvm-svn: 59772
2008-11-21 01:05:35 +00:00
Chris Lattner 4d7c58f0eb disable expected-errors in #if parts of the test.
llvm-svn: 59771
2008-11-21 01:05:04 +00:00
Chris Lattner 1759ea400e split into two tests.
llvm-svn: 59770
2008-11-21 01:04:13 +00:00
Ted Kremenek 53ab374d9f PTHLexer:
- Move out logic for handling the end-of-file to LexEndOfFile (to match the Lexer) class.  The logic now mirrors the Lexer class more, which allows us to pass most of the Preprocessor test cases.

llvm-svn: 59768
2008-11-21 00:58:35 +00:00
Fariborz Jahanian c2ad6dc3b4 Consolidated @try and @synchronize into a single
code gen. method.

llvm-svn: 59767
2008-11-21 00:49:24 +00:00
Ted Kremenek dfcbcfe328 Add checker test case: warn about returning an uninitialized value to the caller.
llvm-svn: 59765
2008-11-21 00:28:47 +00:00
Ted Kremenek 0b63f96ab5 - Clean up transfer function logic for 'return' statements.
- Add check for returning an undefined value to a caller.

llvm-svn: 59764
2008-11-21 00:27:44 +00:00
Ted Kremenek c7792048ff Enable test file for 'region store' in addition to basic store.
llvm-svn: 59762
2008-11-21 00:15:15 +00:00
Fariborz Jahanian 75686a58f3 Support generation of objc_assign_ivar for ivar
write-barriers.

llvm-svn: 59748
2008-11-20 20:53:20 +00:00
Ted Kremenek 111caaac58 PTHLexer:
- Move PTHLexer::GetToken() to be inside PTHLexer.cpp.
- When lexing in raw mode, null out identifiers.

llvm-svn: 59744
2008-11-20 19:49:00 +00:00
Fariborz Jahanian c1877cbc21 __weak ivar need not warn.
llvm-svn: 59743
2008-11-20 19:35:51 +00:00
Fariborz Jahanian e881b536e8 Introducing objc_assign_ivar to clang.
llvm-svn: 59740
2008-11-20 19:23:36 +00:00
Fariborz Jahanian d4081c697a Added a test case for __weak field decls. Change SetVarDeclObjCAttribute
to static function. Added comments.

llvm-svn: 59738
2008-11-20 18:10:58 +00:00
Ted Kremenek cbc984169f Handle another case where we should use PTHLexer as an alternative to the normal Lexer.
llvm-svn: 59736
2008-11-20 16:46:54 +00:00
Douglas Gregor 8e3e16ed2e Update C++ status
llvm-svn: 59735
2008-11-20 16:46:32 +00:00
Ted Kremenek 94981e1f23 PTHLexer:
- Rename 'CurToken' and 'LastToken' to 'CurTokenIdx' and 'LastTokenIdx'
  respectively.
- Add helper methods GetToken(), AdvanceToken(), AtLastToken() to abstract away
  details of the token stream. This also allows us to easily replace their
  implementation later.

llvm-svn: 59733
2008-11-20 16:32:22 +00:00
Douglas Gregor e0e79bdef6 Add support for overloaded operator-> when used in a member access
expression (smart_ptr->mem).

llvm-svn: 59732
2008-11-20 16:27:02 +00:00
Ted Kremenek 6bc5f3ec90 Rename IsNonPragmaNonMacroLexer to IsFileLexer.
llvm-svn: 59731
2008-11-20 16:19:53 +00:00
Ted Kremenek b6df273d2c Output 'ANALYZE' messages to standard error. This should address the intermixing of 'ANALYZE' and the other diagnostics the clang driver emits to standard error.
llvm-svn: 59730
2008-11-20 16:14:48 +00:00
Douglas Gregor f49fdf8337 Fix strange quote characters
llvm-svn: 59729
2008-11-20 13:33:37 +00:00
Daniel Dunbar 203bfdfcf3 De-unionize fields in Token class.
- This is fairly gross but although the code is conceptually the
   same, introducting the union causes gcc 4.2 on x86 (darwin, if that
   matters) to pessimize LexTokenInternal which is critical to our
   preprocessor performance.

This speeds up -Eonly lexing of Cocoa.h by ~4.7% in my timings and
reduces the code size of LexTokenInternal by 8.6%.

llvm-svn: 59725
2008-11-20 08:01:39 +00:00
Ted Kremenek c490c8877c Rewrote PTHLexer::Lex by digging through the sources of Lexer again. Now we can do basic macro expansion using the PTHLexer.
llvm-svn: 59724
2008-11-20 07:58:05 +00:00
Ted Kremenek 85b48c6e3a Add ugly "test harness" for PTHLexer that is not enabled by default. The
(temporary hack) to test the PTHLexer is that whenever we would create a Lexer
object we instead raw lex a memory buffer first and then use the PTHLexer. This
logic exists only to driver the PTHLexer and will be removed/changed in the
future. Note that the regular path using normal Lexer objects is what is used by
default.

llvm-svn: 59723
2008-11-20 07:56:33 +00:00
Ted Kremenek f4fd9b7ec4 Added virtual method 'IndirectLex' to PTHLexer. This will likely get removed in the future when we correctly handle #include processing.
llvm-svn: 59722
2008-11-20 07:54:06 +00:00
Ted Kremenek 49e4579a86 Preprocessor::isCurrentLexer() now takes a PreprocessorLexer* argument to match against CurPPLexer instead of CurLexer.
llvm-svn: 59721
2008-11-20 07:53:31 +00:00
Chris Lattner 9b5a53424b Daniel really really likes = instead of += :)
llvm-svn: 59716
2008-11-20 07:09:32 +00:00
Chris Lattner 651d42dba5 remove the last old-fashioned Diag method. Transition complete!
llvm-svn: 59714
2008-11-20 06:38:18 +00:00
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
Ted Kremenek 678f8d7992 Use ScheduleDAGSDNodes.h instead of ScheduleDAG.h (stuff moved around).
llvm-svn: 59684
2008-11-20 00:52:19 +00:00
Zhongxing Xu 06b377668d Split region store specific test cases.
llvm-svn: 59683
2008-11-20 00:46:15 +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 20b300231a Beef up the test for function call operators slightly
llvm-svn: 59675
2008-11-19 22:59:19 +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 5b75170014 Fix comment.
llvm-svn: 59673
2008-11-19 22:55:55 +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 c9a67fa201 Add version of 'getFileCharacteristic()' for FileIDs.
llvm-svn: 59669
2008-11-19 22:41:46 +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
Steve Naroff dbfc693f47 Fix <rdar://problem/6291588> assertion failure: SourceManager.h line 489.
llvm-svn: 59664
2008-11-19 21:15:47 +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
Daniel Dunbar bc47ed8e74 Ignore Output directories when searching for tests.
llvm-svn: 59660
2008-11-19 19:06:57 +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