Commit Graph

23658 Commits

Author SHA1 Message Date
Ted Kremenek c150887fef Add CXType support for FunctionNoProto and FunctionProto types. This includes adding a new
function, clang_getResultType(), which returns the result type of the function type.

llvm-svn: 106459
2010-06-21 20:15:39 +00:00
Jordy Rose 79404afc1c When folding additive operations, convert the values to the same type. When assuming relationships, convert the integers to the same type as the symbol, at least for now.
llvm-svn: 106458
2010-06-21 20:15:15 +00:00
Jordy Rose 3d85888d4e If a nonnull argument evaluates to UnknownVal, don't warn (and don't crash).
llvm-svn: 106456
2010-06-21 20:08:28 +00:00
Fariborz Jahanian 090e4e5773 Use more efficient API of SmallVector/array_pod_sort
for sorting (radar 8076356).

llvm-svn: 106453
2010-06-21 19:49:38 +00:00
Ted Kremenek d34da45a83 Add clang_getCursorType() support for @property declarations.
llvm-svn: 106451
2010-06-21 19:41:40 +00:00
Fariborz Jahanian 9f2a4eed0d IRGen for implementation of init-priority attribute.
Test case will be checked in llvm test suite.
(finishes off radar 8076356).

llvm-svn: 106441
2010-06-21 18:45:05 +00:00
Douglas Gregor 5dd34744c5 Instantiations subject to an explicit template instantiation
declaration have default visibility even under
-fvisibility=hidden. Fixes <rdar://problem/8109763>.

llvm-svn: 106440
2010-06-21 18:41:26 +00:00
Fariborz Jahanian cc99b3ca9e Fixes a corner case bug whereby declaring and defining an extern variable in a
particular sequence causes its definition to not be generated in the object file.
(fixes radar 8071804).

llvm-svn: 106424
2010-06-21 16:08:37 +00:00
Argyrios Kyrtzidis a35c8e4092 Combine ClassTemplateDecl's PreviousDeclaration with CommonPtr, as in FunctionTemplateDecl.
llvm-svn: 106412
2010-06-21 10:57:41 +00:00
Nate Begeman ed48c857dc Implement remaining codegen for NEON, all operations should now work.
llvm-svn: 106407
2010-06-20 23:05:28 +00:00
Argyrios Kyrtzidis 41d4562da2 Support PCH emitting/reading of using declarations.
llvm-svn: 106404
2010-06-20 14:40:59 +00:00
Benjamin Kramer 22a544bc82 Add braces to avoid an ambiguous else, fixing a GCC warning.
llvm-svn: 106403
2010-06-20 10:20:36 +00:00
Jordy Rose 895c899142 Adds analyzer support for idempotent and tautological binary operations such as "a*0" and "a+0". This is not very powerful, but does make the analyzer look a little smarter than it actually is.
llvm-svn: 106402
2010-06-20 04:56:29 +00:00
Jordy Rose 2dd9b02cc8 Casting to void* or any other pointer-to-sizeless type (e.g. function pointers) causes a divide-by-zero error. Simple fix: check if the pointee type size is 0 and bail out early if it is.
llvm-svn: 106401
2010-06-20 04:30:57 +00:00
Argyrios Kyrtzidis e1224c8aba Cure for Doug's insomnia.
llvm-svn: 106394
2010-06-19 19:58:34 +00:00
Argyrios Kyrtzidis 26b72453f7 Include a hack to allow loading of templated CXXRecordDecls and test template reading from PCH.
llvm-svn: 106393
2010-06-19 19:29:21 +00:00
Argyrios Kyrtzidis 95c04caf92 Initial support for reading templates from PCH.
llvm-svn: 106392
2010-06-19 19:29:09 +00:00
Argyrios Kyrtzidis 106caf92cd Initial support for writing templates to PCH.
llvm-svn: 106391
2010-06-19 19:28:53 +00:00
Anton Korobeynikov cc50b7d7d5 More AltiVec support.
Patch by Anton Yartsev!

llvm-svn: 106387
2010-06-19 09:47:18 +00:00
Chris Lattner 40ad0a2893 add a libs-only target to the clang makefile, patch by Sunay Ismail
in PR7397

llvm-svn: 106386
2010-06-19 06:35:25 +00:00
Eli Friedman c96b2496fc Fix for PR7415: refactor CodeGenModule::MayDeferGeneration and make it less
conservative for static variables in templated classes.

llvm-svn: 106385
2010-06-19 06:24:06 +00:00
Chris Lattner 87233f785b Fix PR7097, a bad interaction between -fno-use-cxa-atexit and
-mconstructor-aliases by using a WeakVH instead of a raw pointer.

llvm-svn: 106384
2010-06-19 05:52:45 +00:00
Fariborz Jahanian 0bf5ee74c4 More Sema Check and a test case for init_priority attr.
(radar 8076356).

llvm-svn: 106350
2010-06-18 23:14:53 +00:00
Jordy Rose c0fe8429f2 Fold additive constants, and support comparsions of the form $sym+const1 <> const2
llvm-svn: 106339
2010-06-18 22:49:11 +00:00
Chris Lattner ed8b6b799d introduce a new CharSourceRange class, and enhance the diagnostics routines
to use them instead of SourceRange.  CharSourceRange is just a SourceRange
plus a bool that indicates whether the range has the end character resolved
or whether the end location is the start of the end token.  While most of
the compiler wants to think of ranges that have ends that are the start of
the end token, the printf diagnostic stuff wants to highlight ranges within
tokens.

This is transparent to the diagnostic stuff.  To start taking advantage of
the new capabilities, you can do something like this:
  Diag(..) << CharSourceRange::getCharRange(Begin,End)

llvm-svn: 106338
2010-06-18 22:45:06 +00:00
Douglas Gregor 7ba0c3fd55 A trivial fix for a test case that's too horrible to commit. Fixes
<rdar://problem/8108088>.

llvm-svn: 106328
2010-06-18 22:12:56 +00:00
Fariborz Jahanian ef5f621215 Implements Sema part of init_priority(priority) attribute
(radar 8076356) - wip.

llvm-svn: 106322
2010-06-18 21:44:06 +00:00
Douglas Gregor 8fba4f22ce Don't complain about missing field initializers when the initializer
list is completely empty, from Lasse Kärkkäinen! Fixes PR7413.

llvm-svn: 106320
2010-06-18 21:43:10 +00:00
Douglas Gregor 77e274fbc6 Merge the "regparm" attribute from a previous declaration of a
function to redeclarations of that function. Fixes PR7025.

llvm-svn: 106317
2010-06-18 21:30:25 +00:00
Gabor Greif 11614bcfe2 John called for a less surprising cast
llvm-svn: 106277
2010-06-18 10:11:35 +00:00
Charles Davis 108f5a2748 Mangle tag types (unions, structs, classes, enums) in the Microsoft C++ Mangler.
Also, test that static members with default visibility in a struct have the
right mangling.

llvm-svn: 106276
2010-06-18 07:51:00 +00:00
Tom Care 6e4ea2db7f Printf format strings: Added some more tests and fixed some minor bugs.
- Precision toStrings shouldn't print a dot when they have no value.
- Length of char length modifier is now returned correctly.
- Added several fixit tests.

Note: fixit tests are currently broken due to a bug in HighlightRange. Marking as XFAIL for now.

M    test/Sema/format-strings-fixit.c
M    include/clang/Analysis/Analyses/PrintfFormatString.h
M    lib/Analysis/PrintfFormatString.cpp

llvm-svn: 106275
2010-06-18 03:02:16 +00:00
Zhongxing Xu e96a9132b8 Add null stream check for more APIs.
llvm-svn: 106274
2010-06-18 02:47:46 +00:00
Alexis Hunt 31d8c14385 Rewrite comment to make my intentions slightly more clear.
llvm-svn: 106272
2010-06-18 02:14:45 +00:00
Ted Kremenek 520f47b66f Change two static variables into instance variables of ASTContext. This allows us to have multiple copies
of ASTContext at the same time.

llvm-svn: 106258
2010-06-18 00:31:04 +00:00
Douglas Gregor ebada077d9 Given Decl::isUsed() a flag indicating when to consider the "used"
attribute as part of the calculation. Sema::MarkDeclReferenced(), and
a few other places, want only to consider the "used" bit to determine,
e.g, whether to perform template instantiation. Fixes a linkage issue
with Boost.Serialization.

llvm-svn: 106252
2010-06-17 23:14:26 +00:00
Fariborz Jahanian 64cda8b5f3 objective-C++ IRGen: property reference as an
lvalue when performing a derived-to-base conversion.
Fixes radar 7501812. Added an executable test to
llvm-test suite.

llvm-svn: 106247
2010-06-17 23:00:29 +00:00
Tom Care 9eee328dac Bug 7394 - Fixed toString representation of Precisions in format strings.
M    include/clang/Analysis/Analyses/PrintfFormatString.h
M    lib/Analysis/PrintfFormatString.cpp

llvm-svn: 106245
2010-06-17 22:55:40 +00:00
Fariborz Jahanian 6fdb139cdd Do not treat @selector as lvalue (unlike g++).
Patch by Nico Weber (pr7390).

llvm-svn: 106242
2010-06-17 21:45:48 +00:00
Zhanyong Wan cae2ea48fe Improves RecursiveASTVisitor:
* refactors code in DEF_TRAVERSE_DECL() into
  TraverseDeclContextHelper() to reduce code bloat and facilitate
  reuse.
* makes the order of traversing a FunctionDecl (including its
  subclasses)'s children more natural: before the function parameters
  are visited after the function body; now they are visited after the
  function type and before the function body.
* fixes a double count for function return type and arguments.

Reviewed by chandlerc and csilvers.

llvm-svn: 106236
2010-06-17 20:56:31 +00:00
Fariborz Jahanian 9240f3dac7 Objective-c++ IRGen. Support for @selector expression as
an lvalue. Fixes PR7390.

llvm-svn: 106235
2010-06-17 19:56:20 +00:00
Tom Care b49ec6907b Bug 7377: Fixed several bad printf format string bugs.
- Added warning for undefined behavior when using field specifier
- Added warning for undefined behavior when using length modifier
- Fixed warnings for invalid flags
- Added warning for ignored flags
- Added fixits for the above warnings
- Fixed accuracy of detecting several undefined behavior conditions
- Receive normal warnings in addition to security warnings when using %n
- Fix bug where '+' flag would remain on unsigned conversion suggestions

Summary of changes:
- Added expanded tests
- Added/expanded warnings
- Added position info to OptionalAmounts for fixits
- Extracted optional flags to a wrapper class with position info for fixits
- Added several methods to validate a FormatSpecifier by component, each checking for undefined behavior
- Fixed conversion specifier checking to conform to C99 standard
- Added hooks to detect the invalid states in CheckPrintfHandler::HandleFormatSpecifier

Note: warnings involving the ' ' (space) flag are temporarily disabled until whitespace highlighting no longer triggers assertions. I will make a post about this on cfe-dev shortly.

M    test/Sema/format-strings.c
M    include/clang/Basic/DiagnosticSemaKinds.td
M    include/clang/Analysis/Analyses/PrintfFormatString.h
M    lib/Analysis/PrintfFormatString.cpp
M    lib/Sema/SemaChecking.cpp

llvm-svn: 106233
2010-06-17 19:00:27 +00:00
Douglas Gregor ffa20398a6 When pushing a copy of the TypeLoc information for a dependent
template specialization type, copy the location information but use
the new type. Fixes PR7385.

llvm-svn: 106224
2010-06-17 16:03:49 +00:00
Douglas Gregor 630dec57a2 Use UnaryOperator as the representation of dependent expressions when
no overloaded operators were found in scope, mirroring what we already
do for BinaryOperator.

llvm-svn: 106222
2010-06-17 15:46:20 +00:00
Douglas Gregor 0552291859 Update CMake build system for ARM NEON generation.
llvm-svn: 106220
2010-06-17 15:17:41 +00:00
Craig Silverstein 8985debaaf Some fixes to type-visiting -- a few places where the type-name was
explicitly typed in the source, but we weren't recursing on it.  One
is new <type>, the other is <type>() (eg int()).

I also fixed the initializer parsing to parse on the syntactic
initializer list, not the semantic.  Usually they'll be identical, so
this won't affect much in practice, but keeps the AST as a syntax-tree
visitor.

Reviewed by chandlerc.

llvm-svn: 106218
2010-06-17 13:40:37 +00:00
Peter Collingbourne 49e7de1ff1 Fix typo (test commit)
llvm-svn: 106217
2010-06-17 12:39:05 +00:00
Gabor Greif 2cd6c7bd70 fix some more gcc3.4 constness warnings
llvm-svn: 106216
2010-06-17 11:29:31 +00:00
Gabor Greif ccd89b4419 use typedef to make hack more transparent and also appease gcc3.4 constness warning
llvm-svn: 106215
2010-06-17 10:59:08 +00:00
Argyrios Kyrtzidis e9b76afe4f Make sure the caching mechanism in Parser::ParseLexedMethodDefs is robust against the parser reading too few tokens.
llvm-svn: 106214
2010-06-17 10:52:22 +00:00
Argyrios Kyrtzidis 355094ef06 Make sure parens/braces/brackets are correctly balanced.
In a line like:

(;

the semicolon leaves Parser:ParenCount unbalanced (it's 1 even though we stopped looking for a right paren).
This may affect later parsing and result in bad recovery for parsing errors.

llvm-svn: 106213
2010-06-17 10:52:18 +00:00
Argyrios Kyrtzidis fa533e7652 Don't ast-print the builtin __[u]int128_t.
llvm-svn: 106212
2010-06-17 10:52:11 +00:00
Charles Davis 8c02c13e19 Mangle operator names in the Microsoft C++ Mangler.
llvm-svn: 106211
2010-06-17 06:47:31 +00:00
Ted Kremenek 5df037e808 Tweak stack address checker to report multiple cases where globals may reference stack memory.
Also refactor the diagnostics so that we print out the kind of stack memory returned.

llvm-svn: 106210
2010-06-17 04:21:37 +00:00
Ted Kremenek 35bf264f00 Include the bug description in the report hash so that we can emit multiple bugs of the same
type at the same location.

llvm-svn: 106209
2010-06-17 04:21:27 +00:00
Nate Begeman 35f4c1c6b1 Generate arm_neon.inc in include/clang/Basic, which provides:
1. builtins definitions for BuiltinsARM.def
2. intrinsic validation code for SemaChecking

Unsure as to whether this is the best way to handle the make dependencies or not.

llvm-svn: 106208
2010-06-17 04:17:01 +00:00
Nate Begeman dbafec1f3e Remove last of the bool shifts for MS VC++, patch by dimitry andric
llvm-svn: 106206
2010-06-17 02:26:59 +00:00
Alexis Hunt 9fcdabe20f Comment Attr.td so people have a better understanding of what goes on.
Also removed the unused Aliases member.

llvm-svn: 106202
2010-06-17 01:51:32 +00:00
Ted Kremenek 98008a47a0 Fix format string checking of '%c' by treating it as an integer conversion. Fixes PR 7391.
llvm-svn: 106196
2010-06-17 01:12:20 +00:00
Ted Kremenek 24c8e4f245 Per conversation with Doug, remove two assertions in ParseLexedMethodDefs() that
didn't indicate violated invariants but that we weren't recovering well.

llvm-svn: 106195
2010-06-17 00:59:17 +00:00
Alexis Hunt 849bccafe0 Fix yet another CMake typo. I'm not quite sure how this succeeded locally now.
llvm-svn: 106193
2010-06-17 00:51:27 +00:00
Alexis Hunt 367f638f04 Fix a typo in the previous commit I thought I'd fixed, but apparently didn't.
llvm-svn: 106189
2010-06-17 00:42:32 +00:00
Alexis Hunt c675ec09f0 Update CMake build for new attribute changes.
llvm-svn: 106188
2010-06-17 00:37:02 +00:00
Ted Kremenek 17504bea33 Rework StackAddrLeakChecker to find stores of stack memory addresses to global variables
by inspecting the Store bindings instead of iterating over all the global variables
in a translation unit.  By looking at the store directly, we avoid cases where we cannot
directly load from the global variable, such as an array (which can result in an assertion failure)
and it also catches cases where we store stack addresses to non-scalar globals.
Also, but not iterating over all the globals in the translation unit, we maintain cache
locality, and the complexity of the checker becomes restricted to the complexity of the
analyzed function, and doesn't scale with the size of the translation unit.

This fixes PR 7383.

llvm-svn: 106184
2010-06-17 00:24:44 +00:00
Ted Kremenek 648ef7a2d7 Implement RegionStoreManager::iterBindings(). This implementation only returns the base region in
the binding key instead of the region + offset.  It isn't clear if this is the best semantics, but most
clients will likely only care about simple bindings, or bindings to a particular variable.  We can
refine later if necessary.

llvm-svn: 106183
2010-06-17 00:24:42 +00:00
Ted Kremenek 70c090822d Correctly return early from BasicStoreManager::iterBindings() when the BindingsHandler returns false.
llvm-svn: 106182
2010-06-17 00:24:37 +00:00
Douglas Gregor 428119e39a When parsing cached C++ method declarations/definitions, save the
"previous token" location at the end of the class definition. This
eliminates a badly-placed error + Fix-It when the ';' following a
class definition is missing. Fixes <rdar://problem/8066414>.

llvm-svn: 106175
2010-06-16 23:45:56 +00:00
Alexis Hunt 344393e9cf Implement first TD-based usage of attributes.
Currently, there are two effective changes:

 - Attr::Kind has been changed to attr::Kind, in a separate namespace
   rather than the Attr class. This is because the enumerator needs to
   be visible to parse.
 - The class definitions for the C++0x attributes other than aligned are
   generated by TableGen.

The specific classes generated by TableGen are controlled by an array in
TableGen (see the accompanying commit to the LLVM repository). I will be
expanding the amount of code generated as I develop the new attributes system
while initially keeping it confined to these attributes.

llvm-svn: 106172
2010-06-16 23:43:53 +00:00
Douglas Gregor 13d0568ecc Make the "extra ';' inside a struct or union" diagnostic more
precise. Fixes PR7336.

llvm-svn: 106170
2010-06-16 23:08:59 +00:00
Douglas Gregor bb1196534c When we see a 'template' disambiguator that marks the next identifier
(or operator-function-id) as a template, but the context is actually
non-dependent or the current instantiation, allow us to use knowledge
of what kind of template it is, e.g., type template vs. function
template, for further syntactic disambiguation. This allows us to
parse properly in the presence of stray "template" keywords, which is
necessary in C++0x and it's good recovery in C++98/03.

llvm-svn: 106167
2010-06-16 23:00:59 +00:00
Douglas Gregor f7d7771812 Fix the recently-added warning about 'typename' and 'template'
disambiguation keywords outside of templates in C++98/03. Previously,
the warning would fire when the associated nested-name-specifier was
not dependent, but that was a misreading of the C++98/03 standard:
now, we complain only when we're outside of any template.

llvm-svn: 106161
2010-06-16 22:31:08 +00:00
Ted Kremenek 64c235e4c6 Extend format string type-checking to include '%p'. Fixes remaining cases PR 4468.
llvm-svn: 106151
2010-06-16 21:23:04 +00:00
Douglas Gregor 7dbfb46163 Canonicalize template template parameters when canonicalizing a
template name that refers to such a parameter. It's amazing that this
problem didn't surface earlier. Fixes PR7387.

llvm-svn: 106147
2010-06-16 21:09:37 +00:00
Daniel Dunbar aa2d0ceaa9 tests: Update Frontend config to actually run ir-support tests.
llvm-svn: 106144
2010-06-16 20:04:36 +00:00
Fariborz Jahanian 18e0275033 C return types must be complete as well.
Moved check before we build the ObjCMessageExpr node.
(PR7386 related).

llvm-svn: 106139
2010-06-16 19:56:08 +00:00
Rafael Espindola 23a8a06554 Change the test for which ABI/CC to use on ARM to be base on the environment
(the last argument of the triple).

llvm-svn: 106131
2010-06-16 19:01:17 +00:00
Fariborz Jahanian 1d44608cc1 Make sure result type of objc++ message expression is
complete before attempting to bind it to a temporary.
Fixes PR7386.

llvm-svn: 106130
2010-06-16 18:56:04 +00:00
Rafael Espindola ad64acde72 A a new test for my previous patch.
llvm-svn: 106120
2010-06-16 18:02:31 +00:00
Rafael Espindola b35e7b8659 Fix tests that I missed from my previous commit.
llvm-svn: 106118
2010-06-16 17:49:52 +00:00
Zhanyong Wan 644346b182 Test commit by adding a blank comment line.
llvm-svn: 106114
2010-06-16 17:21:03 +00:00
Daniel Dunbar 7c995e8fac Frontend: Allow passing -cc1 level arguments to plugins. Patch by Troy Straszheim!
llvm-svn: 106113
2010-06-16 16:59:23 +00:00
Daniel Dunbar 26036fd722 Driver: Ignore -ffast-math and -f[no-]finite-math-only.
llvm-svn: 106112
2010-06-16 16:59:17 +00:00
Douglas Gregor 94584683fa Don't poke at an undefined class type of a field. Fixes PR7355.
llvm-svn: 106111
2010-06-16 16:54:04 +00:00
Douglas Gregor 010815a20b Downgrade the error when using a typedef in the nested-name-specifier
of an explicit instantiation to an ExtWarn, since nobody else seems to
diagnose this problem.

llvm-svn: 106109
2010-06-16 16:26:47 +00:00
Douglas Gregor f56055aee3 Add Cygwin C++ header search path.
llvm-svn: 106108
2010-06-16 16:24:51 +00:00
Fariborz Jahanian 4a30307840 Fixed conflict between objc_memmove_collectable builtin
decl. and one ddefined in darwin header file.

llvm-svn: 106107
2010-06-16 16:22:04 +00:00
Rafael Espindola a92c442437 Don't set the calling convention for ARM if it is already the default.
llvm-svn: 106106
2010-06-16 16:13:39 +00:00
Douglas Gregor 1c69bf00ae If a non-dependent base class initializer fails to match any direct or
virtual base class, but the class still has dependent base classes,
then don't diagnose the failed match as an error: the right base class
might magically appear. Fixes PR7259.

llvm-svn: 106103
2010-06-16 16:03:14 +00:00
Douglas Gregor 9938e3b11b Add some missing parentheses, from Anton Yartsev
llvm-svn: 106101
2010-06-16 15:28:57 +00:00
Douglas Gregor 2ebcae1931 Revert r106099; it broke self-host.
llvm-svn: 106100
2010-06-16 15:23:05 +00:00
Abramo Bagnara bec18dbb88 Added TemplateTypeParmType::getDecl().
llvm-svn: 106099
2010-06-16 14:59:30 +00:00
John McCall be829868e1 Rework the unqualified-lookup-in-templates section of the compatibility
document.  jyasskin, let me know if this meets your needs.

llvm-svn: 106098
2010-06-16 10:48:16 +00:00
John McCall 38e5f433b2 Fix the build. Using declarations should not be considering when looking
for overridden virtual methods.

llvm-svn: 106096
2010-06-16 09:33:39 +00:00
John McCall 89d57ae436 Some more nods to HTML well-formedness.
llvm-svn: 106094
2010-06-16 08:48:08 +00:00
John McCall e9cccd86da Fix a point of semantics with using declaration hiding: method templates
introduced by using decls are hidden even if their template parameter lists
or return types differ from the "overriding" declaration.

Propagate using shadow declarations around more effectively when looking up
template-ids.  Reperform lookup for template-ids in member expressions so that
access control is properly set up.

Fix some number of latent bugs involving template-ids with totally invalid
base types.  You can only actually get these with a scope specifier, since
otherwise the template-id won't parse as a template-id.

Fixes PR7384.

llvm-svn: 106093
2010-06-16 08:42:20 +00:00
Zhongxing Xu abd60dd1fc We return Loc where we know.
llvm-svn: 106087
2010-06-16 06:16:46 +00:00
Zhongxing Xu 7880db8a89 Typo.
llvm-svn: 106086
2010-06-16 05:58:35 +00:00
Zhongxing Xu b4126ee133 Although arguments can not be undefined when we get here, they can still be
unknown.

llvm-svn: 106085
2010-06-16 05:56:39 +00:00
Zhongxing Xu 9fe7e9129b Cast earlier. We know we can get a DefinedSVal.
llvm-svn: 106084
2010-06-16 05:52:03 +00:00
Zhongxing Xu 8225bda0d5 Register CallAndMessageChecker before AttrNonNullChecker. Then we can assume
arguments are not undefined.

llvm-svn: 106083
2010-06-16 05:45:09 +00:00
Zhongxing Xu 0fa7cddbab Add StreamChecker. This checker models and checks stream manipulation functions.
This is the start.

llvm-svn: 106082
2010-06-16 05:38:05 +00:00
Charles Davis 89338af1ff Start mangling function types in the Microsoft C++ Mangler.
llvm-svn: 106081
2010-06-16 05:33:16 +00:00
Jeffrey Yasskin babff2ce56 Fix template ordering compatibility docs. I missed another section that covered
the same thing.

llvm-svn: 106076
2010-06-16 01:12:12 +00:00
Douglas Gregor 6972a62c8f Give Type::isIntegralType() an ASTContext parameter, so that it
provides C "integer type" semantics in C and C++ "integral type"
semantics in C++. 

Note that I still need to update isIntegerType (and possibly other
predicates) using the same approach I've taken for
isIntegralType(). The two should have the same meaning, but currently
don't (!).

llvm-svn: 106074
2010-06-16 00:35:25 +00:00
Douglas Gregor b90df60b3b Introduce Type::isIntegralOrEnumerationType(), to cover those places
in C++ that involve both integral and enumeration types. Convert all
of the callers to Type::isIntegralType() that are meant to work with
both integral and enumeration types over to
Type::isIntegralOrEnumerationType(), to prepare to eliminate
enumeration types as integral types.

llvm-svn: 106071
2010-06-16 00:17:44 +00:00
Fariborz Jahanian 00bdca561a Workaround a possible VS C++ bug.
llvm-svn: 106070
2010-06-16 00:16:38 +00:00
Jeffrey Yasskin 0952ea77ee Describe a gcc compatibility problem that occurs when a template calls a
function defined between its declaration and an instantiation, and that
function isn't findable through ADL.

llvm-svn: 106068
2010-06-15 23:50:08 +00:00
Fariborz Jahanian 56d3b8c578 Moved objective-c++ code gen. tests to their own directory and
added a new test case (related to radar 8070772).

llvm-svn: 106067
2010-06-15 23:49:10 +00:00
Chandler Carruth 8509824cdb Move CodeGenOptions.h *back* into Frontend. This should have been done when the
dependency edge was reversed such that CodeGen depends on Frontend.

llvm-svn: 106065
2010-06-15 23:19:56 +00:00
Fariborz Jahanian 021510e96f Patch adds support for copying of those
objective-c++ class objects which have GC'able objc object
pointers and need to use ObjC's objc_memmove_collectable
API (radar 8070772). 

llvm-svn: 106061
2010-06-15 22:44:06 +00:00
Douglas Gregor f267edd8ac Update equality and relationship comparisons of pointers to reflect
C++ semantics, eliminating an extension diagnostic that doesn't match
C++ semantics (ordered comparison with NULL) and tightening some
extwarns to errors in C++ to match GCC and maintain conformance in
SFINAE contexts. Fixes <rdar://problem/7941392>.

llvm-svn: 106050
2010-06-15 21:38:40 +00:00
Chris Lattner bba37f4dea fix the various buildbot failures by ensuring that tokens are really completely initialized.
llvm-svn: 106043
2010-06-15 21:06:38 +00:00
Douglas Gregor c4827d31aa Remove a completely useless and utterly incorrect assertion.
llvm-svn: 106040
2010-06-15 20:38:36 +00:00
Daniel Dunbar 3648ba756f Driver: Support -Wp,-MMD,FOO, which I found an instance of. :(
llvm-svn: 106039
2010-06-15 20:30:18 +00:00
Douglas Gregor 9858ed5b69 Teach code completion not to ignore data members when performing code
completion for expressions.

llvm-svn: 106037
2010-06-15 20:26:51 +00:00
Chris Lattner 58efac6120 add a testcase, from Michael Spencer
llvm-svn: 106026
2010-06-15 18:56:20 +00:00
Chris Lattner 4e18a2bc97 fix an uninitialized variable, patch by Michael Spencer!
llvm-svn: 106025
2010-06-15 18:55:23 +00:00
Chris Lattner c548be9ab3 Remove a dead argument to ProcessUCNEscape.
Fix string concatenation to treat escapes in concatenated strings that
are wide because of other string chunks to process the escapes as wide
themselves.  Before we would warn about and miscompile the attached testcase.

This fixes rdar://8040728 - miscompile + warning: hex escape sequence out of range

llvm-svn: 106012
2010-06-15 18:06:43 +00:00
Chris Lattner a8687ae490 tidy up
llvm-svn: 106011
2010-06-15 18:05:34 +00:00
Daniel Dunbar c1b1729b66 Break Frontend's dependency on Rewrite, Checker and CodeGen in shared library configuration
Currently, all AST consumers are located in the Frontend library,
meaning that in a shared library configuration, Frontend has a
dependency on Rewrite, Checker and CodeGen.  This is suboptimal for
clients which only wish to make use of the frontend.  CodeGen in
particular introduces a large number of unwanted dependencies.

This patch breaks the dependency by moving all AST consumers with
dependencies on Rewrite, Checker and/or CodeGen to their respective
libraries.  The patch therefore introduces dependencies in the other
direction (i.e. from Rewrite, Checker and CodeGen to Frontend).

After applying this patch, Clang builds correctly using CMake and
shared libraries ("cmake -DBUILD_SHARED_LIBS=ON").

N.B. This patch includes file renames which are indicated in the
patch body.

Changes in this revision of the patch:
 - Fixed some copy-paste mistakes in the header files
 - Modified certain aspects of the coding to comply with the LLVM
   Coding Standards

llvm-svn: 106010
2010-06-15 17:48:49 +00:00
Douglas Gregor 20527e2c83 Allocate template parameter lists for out-of-line definitions via the
ASTContext rather than via the normal heap.

llvm-svn: 106008
2010-06-15 17:44:38 +00:00
Douglas Gregor 0832963acd Implement -fvisibility-inlines-hidden. <rdar://problem/7819834>
llvm-svn: 106003
2010-06-15 17:05:35 +00:00
Daniel Dunbar e9c5e2cc71 Driver/FreeBSD: Add libexec to program search paths, to workaround some build
problem; patch by Ed Schouten.

llvm-svn: 105996
2010-06-15 15:03:31 +00:00
Daniel Dunbar be65fe860b Add <cstddef> include to get ptrdiff_t, for gcc-4.6; patch by Dimitry Andric.
llvm-svn: 105995
2010-06-15 14:50:52 +00:00
Benjamin Kramer ad36eb2911 Fix typo.
llvm-svn: 105993
2010-06-15 08:21:35 +00:00
Nick Lewycky a2fb98bfda When analyzing for member self-assignment, don't attempt to dereference null
Stmt* such as those which occur in ?: . Fixes PR7378.

Also, generally whip the code into shape fixing several coding style violations.

llvm-svn: 105992
2010-06-15 07:32:55 +00:00
Alexis Hunt 0684e33ba5 MinGW requires that wint_t be defined in stddef.h. In order to accomodate, we
won't define it unless specifically requested via the use of __need_wint_t.

llvm-svn: 105985
2010-06-15 02:36:48 +00:00
Ted Kremenek 4c721bf892 Change AnalysisConsumer to analyze functions created by instantiantiating a macro. Fixes PR 7361.
llvm-svn: 105984
2010-06-15 00:55:40 +00:00
Chris Lattner c7ed7ea390 fix the inline asm diagnostics to emit the error on the primary
source code location instead of on the note.  Previously we generated:

<inline asm>:1:2: error: unrecognized instruction
        barf
        ^
t.c:4:8: note: generated from here
  asm ("barf");
       ^

Now we generate:

t.c:4:8: error: unrecognized instruction
  asm ("barf");
       ^
<inline asm>:1:2: note: instantated into assembly here
        barf
        ^

llvm-svn: 105978
2010-06-15 00:03:12 +00:00
Douglas Gregor 4f6e8deec4 Make sure to set the visible on a vtable; VTTs and typeinfo already
handle visibility properly. Fixes <rdar://problem/8091955>. 

llvm-svn: 105977
2010-06-14 23:41:45 +00:00
Douglas Gregor 1726d1517e Add name mangling for address spaces. We use the vendor-extension
mangling for types, where the <source-name> is ASxxx (xxx is the
address-space number).

llvm-svn: 105975
2010-06-14 23:15:08 +00:00
Douglas Gregor c9d2682df3 Warn when a 'typename' or a 'template' keyword refers to a
non-dependent type or template name, respectively, in C++98/03. Fixes
PR7111 and <rdar://problem/8002682>.

llvm-svn: 105968
2010-06-14 22:07:54 +00:00
Daniel Dunbar 5a9d1835be Driver: Fix PR4062 by dissecting one particular -Wp, form.
llvm-svn: 105966
2010-06-14 21:37:09 +00:00
Daniel Dunbar fb3d747fc6 Driver: Dissect -Wl, and -Xlinker arguments to remove --no-demangle, which was a
collect2 option that is passed by some projects (notably WebKit).

llvm-svn: 105964
2010-06-14 21:23:12 +00:00
Daniel Dunbar 3f1a1ffd95 Driver: Eliminate uses of Arg::getIndex.
Also, fix a memory leak.

llvm-svn: 105963
2010-06-14 21:23:08 +00:00
Douglas Gregor 067ad670b1 Put warnings about designated initializations overridding prior
initializations into their own warning group, initializer-overrides,
which is part of -Wextra. Patch by william@25thandClement.com, fixes
PR6934!

llvm-svn: 105961
2010-06-14 21:15:09 +00:00
Daniel Dunbar 5714fc5e8b Driver: Fix refacto in DerivedArgList::MakeSeparateArg.
llvm-svn: 105958
2010-06-14 20:20:44 +00:00
Daniel Dunbar 2d6e9ee033 Driver: Add DerivedArgList::AddFOOArg helper functions, and switch to using them.
llvm-svn: 105957
2010-06-14 20:20:41 +00:00
Douglas Gregor 7d14ffc6ef Teach TemplateDecl::getSourceRange() to cover the entire declaration,
from Peter Collingbourne!

llvm-svn: 105951
2010-06-14 20:02:51 +00:00
Chris Lattner 48eb14dd79 Fix:
Decl.cpp:716:28: warning: initialization of pointer of type 'clang::VarDecl *' from literal 'false' [-Wbool-conversions]
  VarDecl *LastTentative = false;
                           ^
RewriteRope.cpp:535:12: warning: initialization of pointer of type '<anonymous>::RopePieceBTreeNode *' from literal 'false'
      [-Wbool-conversions]
    return false;
           ^

llvm-svn: 105946
2010-06-14 18:31:46 +00:00
Benjamin Kramer c0b8f3bc53 Enable basic testing of __builtin_fpclassify.
llvm-svn: 105937
2010-06-14 10:41:45 +00:00
Benjamin Kramer 7039fcbc5d An implementation of __builtin__fpclassify the way Chris Lattner described by Jörg Blank.
llvm-svn: 105936
2010-06-14 10:30:41 +00:00
Charles Davis 2d7b10cc97 Microsoft C++ Mangler:
- Mangle qualifiers.
- Start mangling variables' types into the name. A variable declared with a
  builtin type should now mangle properly.

llvm-svn: 105931
2010-06-14 05:29:01 +00:00
Nate Begeman 91e1feab7a Add some missing shifts
Fix multiplies by scalar
Add SemaChecking code for all immediates
Add SemaChecking-gen support to arm_neon.td

llvm-svn: 105930
2010-06-14 05:21:25 +00:00
Daniel Dunbar 9886f71db7 www: Swap external coverage & spec references links.
llvm-svn: 105925
2010-06-13 21:07:10 +00:00
Anders Carlsson cc59cc5d80 Do the same short-circuit optimization when laying out bases.
llvm-svn: 105920
2010-06-13 18:00:18 +00:00
Anders Carlsson ae111dc821 Implement part of the EmptySubobjectMap optimization described in PR6998. We still need to do this for bases.
llvm-svn: 105919
2010-06-13 17:49:16 +00:00
John McCall 30576cdce3 TemplateSpecializationType's isCurrentInstantiation bit can be derived
from its canonical type.

llvm-svn: 105912
2010-06-13 09:25:03 +00:00
Chris Lattner f3d3b36870 Allow an asm label specifier on C++ methods, like GCC does.
Patch by David Majnemer!

llvm-svn: 105909
2010-06-13 05:34:18 +00:00
Nate Begeman d773fe67dd Most of NEON sema checking & fix to polynomial type detection
llvm-svn: 105908
2010-06-13 04:47:52 +00:00
Chris Lattner fa04338f38 don't make libclang depend on codegen. Patch by Peter Collingbourne!
llvm-svn: 105901
2010-06-12 22:54:45 +00:00
Charles Davis 63c0a744f7 Really make the Itanium C++ ABI the default.
llvm-svn: 105893
2010-06-12 16:58:00 +00:00
Chris Lattner bc6bcabc61 fix PR7360: -P mode turns off line markers, but not blank space.
Apparently some programs which abuse the preprocessor depend 
on this.

llvm-svn: 105889
2010-06-12 16:20:56 +00:00
Abramo Bagnara da41d0cf5b Added template parameters info for out-of-line definitions of class template methods.
llvm-svn: 105882
2010-06-12 08:15:14 +00:00
Charles Davis 7dacc95299 Microsoft C++ Mangler:
- Don't mangle static variables at global scope.
- Add support for mangling builtin types. This will be used later.

llvm-svn: 105881
2010-06-12 08:11:16 +00:00
Abramo Bagnara 8075c85230 Don't omit class explicit instantiation from AST.
llvm-svn: 105880
2010-06-12 07:44:57 +00:00
Nate Begeman c6ac0ce89f Shifts complete. Only vld & sema checking of constants remain.
llvm-svn: 105879
2010-06-12 06:06:07 +00:00
Nate Begeman dd715805ab vbsl, vrev* is implemented via arm_neon.h
llvm-svn: 105875
2010-06-12 03:11:41 +00:00
John McCall 45d30c3e36 When deciding whether an expression has the boolean nature, don't look through
explicit casts.  Fixes PR7359.

llvm-svn: 105871
2010-06-12 01:56:02 +00:00
Argyrios Kyrtzidis 9116717189 Fix PCH issue. Attributes of a declaration were truncated to just one when the decl was read from a PCH file.
llvm-svn: 105852
2010-06-11 23:09:25 +00:00
Nate Begeman 8ed060b95a Most of remaining builtins, 2 generics, vld, and rounding shfits remain.
llvm-svn: 105848
2010-06-11 22:57:12 +00:00
Daniel Dunbar af8decbde0 Driver: Switch Compilation to return the translated arguments by default.
llvm-svn: 105844
2010-06-11 22:43:38 +00:00
Chris Lattner d0df9a40a3 add a -W flag.
llvm-svn: 105843
2010-06-11 22:10:09 +00:00
Daniel Dunbar 775d406043 Driver: Add an explicit argument translation phase to the driver itself. We are going to need this to handle things like -Xassembler, -Xpreprocessor, and -Xlinker which we might have to introspect.
llvm-svn: 105842
2010-06-11 22:00:26 +00:00
Daniel Dunbar 5c5d30b03a Driver: Get rid of the proxy support in DerivedArgList.
llvm-svn: 105841
2010-06-11 22:00:22 +00:00
Daniel Dunbar 18974bdc68 Fix a couple comments.
llvm-svn: 105840
2010-06-11 22:00:19 +00:00
Daniel Dunbar 7c9e4306af Driver: Change OptTable::ParseArg to take any ArgList.
llvm-svn: 105839
2010-06-11 22:00:17 +00:00
Daniel Dunbar a442fd5da6 Driver: Fix arg_iterator typing to reflect that it is really an iterator over Arg*s.
llvm-svn: 105838
2010-06-11 22:00:13 +00:00
Daniel Dunbar d839e77b12 Preprocessor: Ignore unknown pragmas in -E -dM and -Eonly modes.
llvm-svn: 105830
2010-06-11 20:10:12 +00:00
Chris Lattner 90987eebfd preprocessor directives in macro arguments aren't standard,
hopefully this unbreaks msvc

llvm-svn: 105826
2010-06-11 19:50:37 +00:00
Craig Silverstein 0ea0b0a7ea Add a few FIXMEs: recursing over shadow decls, and semantics vs
syntactic iterating over initializer exprs.  No functional change.

llvm-svn: 105825
2010-06-11 18:08:47 +00:00
John McCall 875679eea0 Fix the constant evaluator for AltiVec-style vector literals so that the
vector is filled with the given constant;  we were just initializing the
first element.

llvm-svn: 105824
2010-06-11 17:54:15 +00:00
John McCall b86a6b830e Allow pseudo-destructors to be called on qualified pointers. Patch by
Troy Straszheim!

llvm-svn: 105823
2010-06-11 17:36:40 +00:00
John McCall 773cc98c3a Don't store ASTContext references in the TST nodes just to support profiling.
llvm-svn: 105820
2010-06-11 11:07:21 +00:00
John McCall dad856dba3 Provide an Objective C mangling for wchar_t. Patch by Nico Weber!
llvm-svn: 105818
2010-06-11 10:11:05 +00:00
John McCall 6d1116ac49 Conversions from Objective C object pointers to bool are "pointer conversions
to bool" in the sense of C++ [over.ics.rank]p4 bullet 1.  I have decreed it.

llvm-svn: 105817
2010-06-11 10:04:22 +00:00
Jeffrey Yasskin 5d474d0a96 Fix the 64-bit build. operator<<(DiagnosticBuilder, long) doesn't exist, so
ptrdiff_t (long on 64-bit, apparently) is ambiguous between the int and
unsigned int overloads.

llvm-svn: 105816
2010-06-11 06:58:43 +00:00
Jeffrey Yasskin 2b99c6fc4f Add an option -fshow-overloads=best|all to limit the number of overload
candidates printed.  We default to 'all'.  At the moment, 'best' prints only
the first 4 overloads, but we'll improve that over time.

llvm-svn: 105815
2010-06-11 05:57:47 +00:00
Charles Davis b6a5a0d9e1 When mangling for the Microsoft C++ ABI, mangle variables in the global
namespace, too.

llvm-svn: 105809
2010-06-11 04:25:47 +00:00
Tom Care 00554634db Small fixes regarding printf fix suggestions.
- Added some handling of flags that become invalid when changing the conversion specifier.
- Changed fixit behavior to remove unnecessary length modifiers.
- Separated some tests out and added some comments.

modified:
  lib/Analysis/PrintfFormatString.cpp
  test/Sema/format-strings-fixit.c

llvm-svn: 105807
2010-06-11 04:22:02 +00:00
Charles Davis 9af2d4a614 Start implementing the Microsoft-style name mangler. Mangle simple names
(but not their types; that's later).

NOTE: Right now, variables in the global namespace don't get mangled, even
though they're supposed to be. This is because the default mangler
implements the shouldMangleDeclName() method that tells clang not to mangle
them. This will be fixed in a later patch.

llvm-svn: 105805
2010-06-11 03:07:32 +00:00
Charles Davis 95a546ee4d Add an option to specify the target C++ ABI to the frontend. Use it to
select either the default Itanium ABI or the new, experimental Microsoft ABI.

llvm-svn: 105804
2010-06-11 01:06:47 +00:00
Chandler Carruth 437416c06b Improve readability with TRY_TO, remove a redundant comment, and fix one aspect
of the recursion on VarDecls. Patch by Craig Silverstein.

llvm-svn: 105803
2010-06-11 01:00:06 +00:00
John McCall c392f37ae8 Split DependentNameType into two types. DependentNameType represents the
case of an elaborated-type-specifier like 'typename A<T>::foo', and
DependentTemplateSpecializationType represents the case of an
elaborated-type-specifier like 'typename A<T>::template B<T>'.  The TypeLoc
representation of a DependentTST conveniently exactly matches that of an
ElaboratedType wrapping a TST.

Kill off the explicit rebuild methods for RebuildInCurrentInstantiation;
the standard implementations work fine because the nested name specifier
is computable in the newly-entered context.

llvm-svn: 105801
2010-06-11 00:33:02 +00:00
John McCall d85248be7a Provide a method to clear the current state of a TypeLocBuilder.
llvm-svn: 105800
2010-06-11 00:26:38 +00:00
Chandler Carruth c27ee0fd29 Avoid repeating the list of operators twice in RecursiveASTVisitor through
a set of preprocessor macros. Patch by Zhanyong Wan.

llvm-svn: 105796
2010-06-10 23:29:40 +00:00
Chandler Carruth 6c816770db Tweak a comment on the visitor to clarify one order of visit issue. Patch from
Zhanyong Wan.

llvm-svn: 105795
2010-06-10 23:27:51 +00:00
Nate Begeman e0935ffa50 Multiplies, some shifts, set_lane
llvm-svn: 105793
2010-06-10 18:11:55 +00:00
Daniel Dunbar 40e640c8df www: Add note on running clang tests from a CMake build, patch by Peter Collingbourne
llvm-svn: 105791
2010-06-10 17:01:45 +00:00
Daniel Dunbar 1d3c2fa9be Driver: Also mark -F as RenderJoined, the linker doesn't like "-F FOO" either.
llvm-svn: 105789
2010-06-10 15:53:17 +00:00
Chandler Carruth c65667c8ba Another chunk of the new RecursiveASTVisitor implementation: switch the return
value semantics such that we recurse while the visitors return true, and halt
as soon as one returns false. Patch by csilvers.

llvm-svn: 105787
2010-06-10 10:31:57 +00:00
Rafael Espindola ad8fed53ff Create a LinuxTargetInfo on ARM. This make clang correctly expand
__USER_LABEL_PREFIX__.

llvm-svn: 105771
2010-06-10 00:46:51 +00:00
Nate Begeman 4a04b467d9 support _lane ops, and multiplies by scalar.
llvm-svn: 105770
2010-06-10 00:17:56 +00:00
Charles Davis 74ce85980b Add a stub Microsoft Visual C++ ABI class (with stub mangler).
llvm-svn: 105767
2010-06-09 23:25:41 +00:00
Daniel Dunbar ed8f06e860 tests: Update test for previous change.
llvm-svn: 105766
2010-06-09 23:24:59 +00:00
Daniel Dunbar ca1282b971 Driver: -L should be marked as RenderJoined, the linker doesn't like "-L FOO".
llvm-svn: 105765
2010-06-09 23:20:37 +00:00
Daniel Dunbar 89cad2309b Driver: Eliminate flags on aliases, they are unnecessary (and unused).
llvm-svn: 105764
2010-06-09 23:20:34 +00:00
Daniel Dunbar bfe71f2416 Driver: Change Option parsing to always create arguments referring to unaliased
options.
 - This matches the intent of the .td files, and will simplify alias handling.
 - PR7321.

llvm-svn: 105763
2010-06-09 22:44:34 +00:00
Daniel Dunbar 35cbfeba8f Driver: Eliminate Arg subclasses, which are now unnecessary.
llvm-svn: 105762
2010-06-09 22:31:08 +00:00
Daniel Dunbar 8b77f73314 Driver: Keep the rendering style in the option, instead of as part of the Arg.
llvm-svn: 105761
2010-06-09 22:31:04 +00:00