Commit Graph

23658 Commits

Author SHA1 Message Date
Daniel Dunbar 08748457b9 Tweak tests to hopefully fix include of limits.h on win32.
llvm-svn: 106639
2010-06-23 18:06:20 +00:00
Sebastian Redl 1fc3bdc61e Add isArrayType() to CanProxy's forwarders.
llvm-svn: 106629
2010-06-23 15:57:03 +00:00
Argyrios Kyrtzidis 818c5db054 Support C++ class template specializations and partial specializations for PCH.
llvm-svn: 106625
2010-06-23 13:48:30 +00:00
Argyrios Kyrtzidis fe6ba881b6 Modify ClassTemplateSpecializationDecl and ClassTemplatePartialSpecializationDecl to allow PCH read/write.
llvm-svn: 106624
2010-06-23 13:48:23 +00:00
Chris Lattner 37141f4fb4 improve altivec vector bool/pixel support, patch by Anton Yartsev
with several tweaks by me.

llvm-svn: 106619
2010-06-23 06:00:24 +00:00
Chris Lattner b48a2d5d2f polish the -finstrument-functions implementation, patch by Nelson Elhage!
llvm-svn: 106618
2010-06-23 05:21:28 +00:00
Zhongxing Xu 2213aa360a add comments.
llvm-svn: 106617
2010-06-23 02:12:00 +00:00
Zhongxing Xu 93cef8665c add comments.
llvm-svn: 106616
2010-06-23 02:06:56 +00:00
Ted Kremenek 2a33a0deef Correctly construct an ElementRegion for alloca() + pointer arithmetic. Fixes analyzer
crash reported in PR 7450.

llvm-svn: 106609
2010-06-22 23:58:31 +00:00
Douglas Gregor 689999da1f String literals enclosed in parentheses are still string
literals. Fixes PR7488.

llvm-svn: 106607
2010-06-22 23:47:37 +00:00
Douglas Gregor 769ba3e50c Make c++ and C++ valid extensions for C++ source files, from Seth Cantrell!
llvm-svn: 106602
2010-06-22 23:43:22 +00:00
Douglas Gregor a3208f9e7c Vector types are not arithmetic types, either. Note that we now ban
__real myvec and __imag myvec, since they aren't all that useful (it's
just an identity function) but we might want to use them in more
restricted cases in the future (e.g., "__real mycomplexvec" could
extract the real parts of a vector of complex numbers).

llvm-svn: 106601
2010-06-22 23:41:02 +00:00
Fariborz Jahanian 3bf0ded346 Patch to provide separate ASTs for multiple ObjC class extension
declarations (implements radar 7928731).

llvm-svn: 106597
2010-06-22 23:20:40 +00:00
Douglas Gregor c646d13054 Teach Type::isRealType() that vector types are never real types. All
of the callers of isRealType() already assumed this, and one of them
(increment/decrement) mistakenly permitted increments of vector types
because of it.

llvm-svn: 106596
2010-06-22 23:13:52 +00:00
Douglas Gregor 49b4d73451 Type Type::isRealFloatingType() that vectors are not floating-point
types, updating callers of both isFloatingType() and
isRealFloatingType() accordingly. Caught at least one issue where we
allowed one to declare a vector of vectors (!), along with cleaning up
the standard-conversion logic for C++.

llvm-svn: 106595
2010-06-22 23:07:26 +00:00
Daniel Dunbar adef9327fe Support -mios-version-min= as an alias for -miphoneos-version-min=.
llvm-svn: 106587
2010-06-22 22:27:12 +00:00
Douglas Gregor 4ffbad1904 Change Type::isFloatingType() to reflect the actual definition of a
"floating type" in C, which does not include vector types. Introduce
Type::hasFloatingRepresentation() for the places where we want to know
whether the underlying representation is one or more floating-point
values. Remove some hacks we had where the former behavior of
Type::isFloatingType() was at odds with the language definition of the
term.

llvm-svn: 106584
2010-06-22 22:12:46 +00:00
Daniel Dunbar a91c0ba88a Driver: Remove some dead code left around after a refactoring. Found by the
Clang static analyzer!

llvm-svn: 106568
2010-06-22 20:18:18 +00:00
Ted Kremenek 55081f9317 Don't assert on C++ casts that are currently not handled by the static analyzer.
Instead, halt the analysis of the current path, which is what we do in GRExprEngine::ProcessStmt
for all other C++ constructs not currently handled by the analyzer.

llvm-svn: 106561
2010-06-22 19:05:10 +00:00
Fariborz Jahanian a9f90275cc Trying to make BuildBot happy again (related to PR7431).
llvm-svn: 106553
2010-06-22 17:08:32 +00:00
Argyrios Kyrtzidis 6e57c35513 Read/write CXXDeleteExpr from/to PCH.
llvm-svn: 106552
2010-06-22 17:07:59 +00:00
Douglas Gregor db48cf3c31 Don't allow vector conversions to sneak in under the guise of
floating-point conversions or floating-integral conversions. We
really, really, really need to make isFloatingType() and friends not
apply to vector types.

llvm-svn: 106551
2010-06-22 16:52:27 +00:00
Fariborz Jahanian 7966aff294 Fixes a problem in generation of meta-data for
category implementation whereby property list was missing.
NeXt ObjC runtime (radar 8093297).

llvm-svn: 106550
2010-06-22 16:33:55 +00:00
Anders Carlsson ea836bc41c Switch over to the new caching version of getMangledName.
llvm-svn: 106549
2010-06-22 16:16:50 +00:00
Anders Carlsson 2e2f4d2e6d Add a new variant of getMangledName that caches the mangling for decls.
llvm-svn: 106547
2010-06-22 16:05:32 +00:00
Anders Carlsson 16d9f1788e Add GlobalDecl::getCanonicalDecl.
llvm-svn: 106546
2010-06-22 16:00:14 +00:00
Douglas Gregor a46d66122f When we ask for the enumerators of an EnumDecl, make sure we get them even if we have a EnumDecl that is not the definition of the enumeration
llvm-svn: 106541
2010-06-22 14:45:56 +00:00
Douglas Gregor c9ea2d5a67 In C++, allow a declaration of an enum to follow a definition of that
enum as a GNU extension.

llvm-svn: 106540
2010-06-22 14:26:35 +00:00
Argyrios Kyrtzidis 75000b6814 Fix PR7180.
For

void f( a:🅱️:c );

we would cache the tokens "a:🅱️:" but then we would try to annotate them using the range "a::".
Before annotating them with the (invalid) C++ scope spec, set it to the range of "a:🅱️:".

llvm-svn: 106536
2010-06-22 11:30:04 +00:00
Argyrios Kyrtzidis 69da4a8f07 Support emitting/reading function templates to/from PCH.
llvm-svn: 106534
2010-06-22 09:55:07 +00:00
Argyrios Kyrtzidis ae85e2414c -Introduce PCHReader::ReadTemplateArgumentLoc()
-Introduce PCHWriter::AddTemplateArgumentLocInfo()
-Modify PCHWriter::AddTemplateArgumentLoc() to also write TemplateArgumentLoc's TemplateArgument
  and move the existing calls of AddTemplateArgumentLoc() to AddTemplateArgumentLocInfo().

llvm-svn: 106533
2010-06-22 09:54:59 +00:00
Argyrios Kyrtzidis cb6f346873 Make it easier to read/write the template part of FunctionDecl.
Introduce:
-FunctionDecl::getTemplatedKind() which returns an enum signifying what kind of templated
  FunctionDecl it is.
-An overload of FunctionDecl::setFunctionTemplateSpecialization() which accepts arrays of
  TemplateArguments and TemplateArgumentLocs
-A constructor to TemplateArgumentList which accepts an array of TemplateArguments.

llvm-svn: 106532
2010-06-22 09:54:51 +00:00
Benjamin Kramer 1e63c74f60 Silence warning about C++-style comments.
llvm-svn: 106531
2010-06-22 09:29:44 +00:00
Zhongxing Xu 4505747979 Add a bunch of stream APIs to SteamChecker.
llvm-svn: 106530
2010-06-22 07:50:21 +00:00
Douglas Gregor ef4a2a2b54 Apply array-to-pointer decay when instantiating a MemberExpr. Fixes
PR7405, patch by Kyle Lippincott!

llvm-svn: 106523
2010-06-22 02:41:05 +00:00
Douglas Gregor de049cdbe6 Attempt to fix test
llvm-svn: 106522
2010-06-22 02:17:07 +00:00
Fariborz Jahanian 469b200321 Per Chris's comment, remove another static (this one
is a static comparator operator).

llvm-svn: 106511
2010-06-22 00:23:08 +00:00
Chris Lattner 3c77a355e0 implement support for -finstrument-functions, patch by Nelson
Elhage!

llvm-svn: 106507
2010-06-22 00:03:40 +00:00
Douglas Gregor 27b98eae80 Alter the internal representation of the condition variable in
if/while/switch/for statements to ensure that walking the children of
these statements actually works. Previously, we stored the condition
variable as a VarDecl. However, StmtIterator isn't able to walk from a
VarDecl to a set of statements, and would (in some circumstances) walk
beyond the end of the list of statements, cause Bad Behavior.

In this change, we've gone back to representing the condition
variables as DeclStmts. While not as memory-efficient as VarDecls, it
greatly simplifies iteration over the children. 

Fixes the remainder of <rdar://problem/8104754>.

llvm-svn: 106504
2010-06-21 23:44:13 +00:00
Fariborz Jahanian c9fec975e6 Avoid using a local static for providing lexical
order of priorotized global object initializations.

llvm-svn: 106503
2010-06-21 23:31:29 +00:00
Douglas Gregor 143d367ecf Zero out a stale pointer
llvm-svn: 106497
2010-06-21 22:46:46 +00:00
Douglas Gregor 9377c8230b When semantic analysis fail to introduce a class or class template,
just skip over the body of the class or class template: it's a
semantic disaster that's likely to cause invariants to break. Fixes
part of <rdar://problem/8104754>.

llvm-svn: 106496
2010-06-21 22:31:09 +00:00
Ted Kremenek e4e9941ae7 Update checker build.
llvm-svn: 106495
2010-06-21 22:25:24 +00:00
Fariborz Jahanian 2990e3a502 Test case for PR7431 by Nico Weber.
llvm-svn: 106494
2010-06-21 22:21:57 +00:00
Fariborz Jahanian 9adb2e646c In fragile-abi (32bit mode abi) generate global symbol
objc_category_name_xxx for each category implementation.
(fixes PR7431) patch by Nico Weber.

llvm-svn: 106492
2010-06-21 22:05:18 +00:00
Fariborz Jahanian 89bdd14f2f In supporting init-priority, globals with the same init_priority must be
emitted in the order in which they are seen (still radar 8076356).

llvm-svn: 106485
2010-06-21 21:27:42 +00:00
Tom Care 3f272b853f Bug 7377: printf checking fails to flag some undefined behavior
http://llvm.org/bugs/show_bug.cgi?id=7377

Updated format string highlighting and fixits to take advantage of the new CharSourceRange class.
- Change HighlightRange to allow highlighting whitespace only in a CharSourceRange (for warnings about the ' ' (space) flag)
- Change format specifier range helper function to allow for half-open ranges (+1 to end)
- Enabled previously failing tests (FIXMEs/XFAILs removed)
- Small fixes and additions to format string test cases

M       test/Sema/format-strings.c
M       test/Sema/format-strings-fixit.c
M       lib/Frontend/TextDiagnosticPrinter.cpp
M       lib/Sema/SemaChecking.cpp

llvm-svn: 106480
2010-06-21 21:21:01 +00:00
Anders Carlsson 280e61f148 Fix an Obj-C++ miscompile when calling an Obj-C method that returns a C++ reference.
llvm-svn: 106477
2010-06-21 20:59:55 +00:00
Ted Kremenek c62ab8d064 Add CXType support for querying the return type of Objective-C methods. This is done by
adding a clang_getCursorResultType() function (which complements clang_getResultType()).

llvm-svn: 106473
2010-06-21 20:48:56 +00:00
Chris Lattner b5c9a04a2c accept and ignore two more gcc warning flags.
llvm-svn: 106472
2010-06-21 20:40:48 +00:00
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