Commit Graph

20218 Commits

Author SHA1 Message Date
Ted Kremenek 9fcd8305c0 Alternate format string checking: check if the number of format specifiers exceeds the number of arguments.
llvm-svn: 94785
2010-01-29 01:43:31 +00:00
Ted Kremenek 559d89a02a Move definition of FormatStringHandler::~FormatStringHandler() within namespace directives. Hopefully this will make the Linux buildbots happy.
llvm-svn: 94784
2010-01-29 01:37:52 +00:00
Ted Kremenek d5fd0fac38 Alternate format string checking: warn of '%n' as being potentially insecure.
llvm-svn: 94782
2010-01-29 01:35:25 +00:00
Ted Kremenek 5739de77fa Add precision/field width checking to AlternateCheckPrintfString().
llvm-svn: 94774
2010-01-29 01:06:55 +00:00
Douglas Gregor 69ff5dc0cb Harden the CIndex implementation a bit, so that it does not assert
when given bad inputs.

llvm-svn: 94769
2010-01-29 00:47:48 +00:00
Douglas Gregor 60b11f6dfd When printing diagnostics in c-index-test, also print source ranges
and fix-it information, so we can see everything in one place. Along
the way, fix a few bugs with deserialization and query of diagnostics
in CIndex.

llvm-svn: 94768
2010-01-29 00:41:11 +00:00
Ted Kremenek b5c98ef61e Fix off-by-one error in ParseFormatSpecifier() when reporting the location of a null character.
llvm-svn: 94762
2010-01-28 23:56:52 +00:00
Ted Kremenek ab278de2d1 Start fleshing out Sema::AlternateCheckPrintfString():
- Add an anonymous class 'CheckPrintfHandler' which will do the
  checking of specific format specifiers
- Add checking for using the '@' conversion specifier outside
  an ObjC string literal
- Add checking for null characters within the string

llvm-svn: 94761
2010-01-28 23:39:18 +00:00
Devang Patel 7bfc596fcf s/CGDebugInfo::getContext/CGDebugInfo::getContextDescriptor/g to avoid confusion.
llvm-svn: 94760
2010-01-28 23:15:27 +00:00
Devang Patel 128aa9d176 Fix indentation.
llvm-svn: 94758
2010-01-28 21:54:15 +00:00
Devang Patel 4c3e7e99ca Static methods do not need "this" pointer argument.
llvm-svn: 94756
2010-01-28 21:43:50 +00:00
Devang Patel 946edc1aa6 Emit base classes info first, as expected by the debugger.
llvm-svn: 94755
2010-01-28 21:41:35 +00:00
Anders Carlsson b1ef991097 Fix an incorrect union layout assert. Fixes PR6164.
llvm-svn: 94754
2010-01-28 18:22:03 +00:00
Devang Patel 0d61eebd81 s/FunctionNames/DebugInfoNames/g
llvm-svn: 94753
2010-01-28 18:21:00 +00:00
Devang Patel 84033fb240 Emit vtable info.
llvm-svn: 94751
2010-01-28 18:11:52 +00:00
John McCall 2cb941642e Access control for surrogate function calls. Required a moderately gross hack
to get the access bits set properly in conversion sets.

llvm-svn: 94744
2010-01-28 07:38:46 +00:00
Douglas Gregor ac0605e927 Introduce serialization and deserialization of diagnostic information
so that CIndex can report diagnostics through the normal mechanisms
even when executing Clang in a separate process. This applies both
when performing code completion and when using ASTs as an intermediary
for clang_createTranslationUnitFromSourceFile().

The serialized format is not perfect at the moment, because it does
not encapsulate macro-instantiation information. Instead, it maps all
source locations back to the instantiation location. However, it does
maintain source-range and fix-it information. To get perfect fidelity
from the serialized format would require serializing a large chunk of
the source manager; at present, it isn't clear if this code will live
long enough for that to matter.

llvm-svn: 94740
2010-01-28 06:00:51 +00:00
Ted Kremenek fee0e96c82 Add position of conversion specifier character to 'ConversionSpecifier'.
llvm-svn: 94739
2010-01-28 02:46:17 +00:00
Ted Kremenek 08ad1cceb3 Rename namespace clang::printf to clang::analyze_printf to avoid problems where the reference to 'printf' is ambiguous.
llvm-svn: 94733
2010-01-28 02:02:59 +00:00
John McCall 49ec2e694c Access control for overloaded call operators. Not for surrogates yet,
mostly because we're going to want a better diagnostic for conversions.

Also this API needs to go back to sanity.

llvm-svn: 94730
2010-01-28 01:54:34 +00:00
John McCall b3a4400554 Access checking for overloaded operators.
llvm-svn: 94725
2010-01-28 01:42:12 +00:00
Fariborz Jahanian 81310810bd Fixes a rewrite bug rewriting nested ivars reference.
(Radar 7583971).

llvm-svn: 94724
2010-01-28 01:41:20 +00:00
Ted Kremenek c70ee8610d Add placeholder function in Sema for new format string checking logic.
This function will use the format string parsing logic in libAnalysis,
and once it is shown to be better than the current implementation it
will replace AlternateCheckPrintfString() entirely.

llvm-svn: 94721
2010-01-28 01:18:22 +00:00
Ted Kremenek e4fd3300c9 Fix 80 col violation.
llvm-svn: 94717
2010-01-28 01:04:48 +00:00
Ted Kremenek bcbdaea703 Allow HandleFormatSpecifier() to indicate that no more processing of the format string is desired.
llvm-svn: 94715
2010-01-28 01:00:59 +00:00
Douglas Gregor ba965fb2a7 Switch the remaining diagnostic printing in CIndex over to the
diagnostic callback mechanism, so all diagnostics now go through that
callback. Also, eliminate the displayDiagnostics flag to
clang_createIndex(), since it is no longer necessary: the client
determines whether to display diagnostics or not.

llvm-svn: 94714
2010-01-28 00:56:43 +00:00
Ted Kremenek c06ead62f0 Add '@' conversion specifier.
llvm-svn: 94713
2010-01-28 00:55:28 +00:00
Devang Patel abb4413728 While emitting debugging infor for a C++ class, identify the holder of class's vtable, if any.
llvm-svn: 94712
2010-01-28 00:54:21 +00:00
Devang Patel 3d4e6d9dd0 Include "this" pointer argument while emitting debug info for a C++ method.
llvm-svn: 94710
2010-01-28 00:28:01 +00:00
Douglas Gregor 4f9c376570 Implement a diagnostics callback for the C interface to Clang, so that
clients can format diagnostics as they wish rather than having to
parse standard error. All of the important parts of the front end's
diagnostics are exposed: text, severity, location, source ranges, and
fix-its. The diagnostics callback is now available with
clang_createTranslationUnitFromSource() and
clang_createTranslationUnit().

As part of this change, CXSourceLocation and CXSourceRange got one
pointer larger, since we need to hold on to the SourceManager and
LangOptions structures in the source location. This is the minimum
amount of information needed for the functions that operate on source
locations and ranges (as implemented now). Previously we held on to
the ASTContext, but the diagnostics callback can end up with source
locations when there is no ASTContext (or preprocessor).

Still to do:
  - Code completion needs to support the diagnostics callback, once we
  have the ability to (de-)serialize diagnostics.
  - Eliminate the "displayDiagnostics" argument to createIndex; we'll
  always pass diagnostics to the callback and let it deal with display.

llvm-svn: 94709
2010-01-28 00:27:43 +00:00
Ted Kremenek fa784e88e8 Remove invalid conversion specifiers from format string checking.
llvm-svn: 94707
2010-01-28 00:17:51 +00:00
Ted Kremenek c8d9c01f04 Add a few more conversion specifiers to ParseFormatSpecifier (these appear in SemaChecking).
llvm-svn: 94704
2010-01-28 00:02:05 +00:00
Ted Kremenek a2e77b41f3 Add skeleton for a more structured way to analyzing pring format
strings than what we currently have in Sema.  This is both an
experiment and a WIP.

The idea is simple: parse the format string incrementally,
constructing a well-structure representation of each format specifier.
Each format specifier is then handed back one-by-one to a client via a
callback.  Malformed format strings are also handled with callbacks.
The idea is to separate the parsing of the format string from the
emission of diagnostics.  Currently what we have in Sema for handling
format strings is a mongrel of both that is hard to follow and
difficult to modify (I can apply this label since I'm the original
author of that code).

This is in libAnalysis as it is reasonable generic and can potentially
be used both by libSema and libChecker.

Comments welcome.

llvm-svn: 94702
2010-01-27 23:43:25 +00:00
Jeffrey Yasskin 3f565ae2dd Remove ModuleProviders from clang after r94686 removed them from LLVM.
llvm-svn: 94688
2010-01-27 21:12:04 +00:00
Daniel Dunbar 377dc2f91f ARM/APCS: Fix alignment of long double.
llvm-svn: 94685
2010-01-27 20:23:08 +00:00
Ted Kremenek e9918356b2 Move more naming conventions logic out of the retain/release checker to CocoaConventions.h.
llvm-svn: 94682
2010-01-27 18:00:17 +00:00
Ken Dyck 160146eba2 Change the return type of ASTContext::getDeclAlignInBytes() to CharUnits and,
now that the "InBytes" part of the name is implied by the return type, rename
it to getDeclAlign().

llvm-svn: 94681
2010-01-27 17:10:57 +00:00
Benjamin Kramer b925f7707e Use raw_ostreams in Preprocessor::ExpandBuiltinMacro. Still not nice but less fragile than the old code.
llvm-svn: 94679
2010-01-27 16:38:22 +00:00
Ted Kremenek 968999b5f6 Add missing call to Optional<...>.getValue() that was pointed out by Chandler.
llvm-svn: 94678
2010-01-27 16:31:37 +00:00
Ken Dyck 2c229a7c17 Use getTypeAlignInChars() for alignment in VisitSizeOfAlignOfExpr().
llvm-svn: 94677
2010-01-27 12:54:25 +00:00
David Chisnall 358e751a7b Unique ObjC strings (GNU Runtime); fix for PR6142. Note: Doing this in the runtime-specific code is a bit ugly. It would be a good idea to hoist all of the string / protocol uniqueing code up into CGObjCRuntime or CodeGenModule and only handle emitting the original versions in the runtime-specific code.
llvm-svn: 94676
2010-01-27 12:49:23 +00:00
Chandler Carruth f6442e7b2e Silence a GCC warning about uninitialized variables. The first user of this
showed up with a primitive type.

llvm-svn: 94674
2010-01-27 10:28:04 +00:00
Chris Lattner 0afd3a23cd fix a bug in the _MM_TRANSPOSE4_PS definition, patch by Brian Sumner from
PR6138

llvm-svn: 94669
2010-01-27 07:54:50 +00:00
Chandler Carruth 2370ec6513 Fix libCIndex.so's lookup of the clang executable on CMake out-of-tree builds.
llvm-svn: 94668
2010-01-27 07:37:16 +00:00
Ted Kremenek d5e27af60a Remove unnecessary ASTContext* argument from isRefType().
llvm-svn: 94665
2010-01-27 06:45:10 +00:00
Ted Kremenek 49c0d89a10 Update CMake build.
llvm-svn: 94663
2010-01-27 06:14:12 +00:00
Ted Kremenek db1832d928 Start pulling out pieces of the monolithic retain/release checker into
reusable and modular API pieces.

Start by pulling the logic for deriving the Cocoa naming convention
into a separate API, header, and source file.

llvm-svn: 94662
2010-01-27 06:13:48 +00:00
Daniel Dunbar a9fdb83ec4 Set -ccc-host-triple in these tests.
llvm-svn: 94661
2010-01-27 04:03:51 +00:00
Douglas Gregor 3edc4d5ec3 Fix a major oversight in the comparison of standard conversion
sequences, where we would occasionally determine (incorrectly) that
one standard conversion sequence was a proper subset of another when,
in fact, they contained completely incomparable conversions. 

This change records the types in each step within a standard
conversion sequence, so that we can check the specific comparison
types to determine when one sequence is a proper subset of the
other. Fixes this testcase (thanks, Anders!), which was distilled from
PR6095 (also thanks to Anders).

llvm-svn: 94660
2010-01-27 03:51:04 +00:00
John McCall 86121519ca Implement access-check delays for out-of-line member definitions
using the same framework we use for deprecation warnings.

llvm-svn: 94659
2010-01-27 03:50:35 +00:00
Anders Carlsson e437c6870a Add support for 3dnow and 3dnowa, and define the target macros accordingly. (This is needed in order to build Qt).
llvm-svn: 94658
2010-01-27 03:47:49 +00:00
Anders Carlsson 673d1401c5 It's not Explicit anymore.
llvm-svn: 94657
2010-01-27 03:27:53 +00:00
Anders Carlsson 40446e8a0a Structs and classes with non-trivial destructors or copy constructors should be passed indirectly in the 32-bit ABI. Fixes PR6094.
llvm-svn: 94656
2010-01-27 03:25:19 +00:00
Anders Carlsson 0af6ac417f Update the xcode project for real and don't check in a failing test.
llvm-svn: 94655
2010-01-27 03:24:27 +00:00
Anders Carlsson 26809837b9 Update xcode project.
llvm-svn: 94654
2010-01-27 03:22:55 +00:00
Anders Carlsson 2a58948dc9 XFAIL this for now.
llvm-svn: 94653
2010-01-27 03:06:00 +00:00
Anders Carlsson 29f899dc6f Fix test/CodeGenCXX/default-destructor-synthesis.cpp not to rely on asm output.
llvm-svn: 94652
2010-01-27 03:03:08 +00:00
Anders Carlsson 483d08a25a Fix attr.cpp by not checking the generated assembler output.
llvm-svn: 94651
2010-01-27 02:49:52 +00:00
John McCall 58cc69d4c1 Implement access control for overloaded functions. Suppress access control
diagnostics in "early" lookups, such as during typename checks and when building
unresolved lookup expressions.

llvm-svn: 94647
2010-01-27 01:50:18 +00:00
Owen Anderson 029eb7d243 Clarify the documentation of ext_vector, and add a small example. Hopefully
this will alleviate some confusion about the existence of this feature.

Comments/improvements welcome.

llvm-svn: 94645
2010-01-27 01:22:36 +00:00
Daniel Dunbar b473083fcd Support -marm by treating it as an alias for -mno-thumb.
llvm-svn: 94644
2010-01-27 01:06:14 +00:00
Daniel Dunbar f48d51d693 Driver/Darwin: Eliminate invalid uses of DarwinVersion -- this fixes a number of
defaults when targetting iPhoneOS (blocks, non-fragile ABI, stack protector).

llvm-svn: 94642
2010-01-27 00:57:11 +00:00
Daniel Dunbar 6d23b2f503 Driver/Darwin: Simplify target version checks.
llvm-svn: 94641
2010-01-27 00:57:03 +00:00
Daniel Dunbar 8360803a8a Driver/Darwin: Fix a few link arguments when targetting different iPhoneOS
versions to match gcc (which is matching linker changes).

llvm-svn: 94640
2010-01-27 00:56:56 +00:00
Daniel Dunbar b73bb5d085 Driver/Darwin: Switch clang -triple synthesis to use computed target information.
llvm-svn: 94639
2010-01-27 00:56:49 +00:00
Daniel Dunbar 7c870175eb Driver/Darwin: Eliminate confusing IsIPhoneOS parameter -- this was actually
just indicating whether the default target should be iPhoneOS.

llvm-svn: 94638
2010-01-27 00:56:44 +00:00
Daniel Dunbar 15c8942baf Driver/Darwin: Switch to using isTargetIPhoneOS where appropriate.
llvm-svn: 94637
2010-01-27 00:56:37 +00:00
Daniel Dunbar b92d12622c Driver/Darwin: Disallow -m{macosx,iphoneos}-version-min as -Xarch arguments.
llvm-svn: 94636
2010-01-27 00:56:31 +00:00
Daniel Dunbar 3b8e50d0ed Driver/Darwin: Track target platform more explicitly in tool chain, eventually
this should just be part of the tool chain itself once we have eliminated
argument translation.

llvm-svn: 94635
2010-01-27 00:56:25 +00:00
Ted Kremenek 7ad29c72e3 Add const version of ObjCMethodDecl::getCanonicalDecl().
llvm-svn: 94633
2010-01-27 00:37:54 +00:00
Ted Kremenek e36bceb97d Teach RegionStore to handle initialization of incomplete arrays in structures using a compound value. Fixes <rdar://problem/7515938>.
llvm-svn: 94622
2010-01-26 23:51:00 +00:00
Ted Kremenek 6296e0990b Move 'LocalCheckers.h' to the 'Checkers' subdirectory.
llvm-svn: 94609
2010-01-26 22:59:55 +00:00
Ted Kremenek b29faead69 Move 'include/Checkers/PathSensitive/Checkers' directory to 'include/Checkers'.
llvm-svn: 94608
2010-01-26 22:56:15 +00:00
Fariborz Jahanian d59baba9fd Patch to add 'volatile' to first argument of all
sync compare_and_swap to match them with gcc.
It also fixes a few incorrect argument defitions.
(fixes radar 7540291).

llvm-svn: 94607
2010-01-26 22:48:42 +00:00
Mike Stump ded0a406b4 Refine the non-virtual this adjustments for thunks by using the offset
to the declaring class from the nearest virtual base class.  WIP.

llvm-svn: 94606
2010-01-26 22:44:01 +00:00
Sebastian Redl 833ef45b1d Bring some semblance of order into Decl.h and Decl.cpp. While at it, fix some typo comments and remove an unused and unimplemented function prototype. No functionality change.
llvm-svn: 94599
2010-01-26 22:01:41 +00:00
Mike Stump a04ecfb701 Refine the non-virtual this adjustments for thunks by using the offset
to the declaring class from the nearest virtual base class.  WIP.

This fixes 40% of all the problems remaining in one of my testcases.

llvm-svn: 94592
2010-01-26 21:35:27 +00:00
Fariborz Jahanian f0ed69cb5b Added assert to the rewrite.
llvm-svn: 94584
2010-01-26 20:37:44 +00:00
Ken Dyck 7df3cbeb01 Convert one last size variable to CharUnits (follow-on to 94577).
llvm-svn: 94579
2010-01-26 19:59:28 +00:00
Ken Dyck 3eb55cfe8a Use CharUnits for sizes, offsets, alignments, and padding amounts for values
that are in character units.

llvm-svn: 94577
2010-01-26 19:44:24 +00:00
Douglas Gregor 64213261b4 Fix typo in comment
llvm-svn: 94576
2010-01-26 19:43:43 +00:00
Ted Kremenek 0b86e3a72d Implement 'clang_getInclusions()' in CIndex. This API allows clients to walk the set of files included in a translation unit via the C API.
llvm-svn: 94575
2010-01-26 19:31:51 +00:00
Douglas Gregor 9bd6db5834 Eliminate clang_getInstantiationLocationOffset(), and instead add an
offset parameter to clang_getInstantiationLocation(). 

llvm-svn: 94573
2010-01-26 19:19:08 +00:00
Ken Dyck 5262b11962 Use CharUnits for alignments in character units.
llvm-svn: 94571
2010-01-26 19:13:33 +00:00
Sebastian Redl 497c0a418d Fix two redefinitions in test cases that weren't diagnosed yet, but will be soon.
llvm-svn: 94565
2010-01-26 18:52:33 +00:00
Ken Dyck a0f99ff230 Use CharUnits for alignment of UTF16 string in GetAddrOfConstantCFString().
llvm-svn: 94564
2010-01-26 18:46:23 +00:00
Ken Dyck e5402e4749 Use CharUnits for alignment in EmitNullInitializationLValue().
llvm-svn: 94563
2010-01-26 18:35:11 +00:00
Douglas Gregor 6165611986 Implement clang_annotateTokens(), which associates cursors with each
of the tokens within a raw token stream. This does not even attempt to
handle macros yet.

llvm-svn: 94561
2010-01-26 18:31:56 +00:00
Fariborz Jahanian f9e8c2b759 Refix rewriting of an ivar access when it is
type-cast to its sub-class (radar 7575882).

llvm-svn: 94559
2010-01-26 18:28:51 +00:00
Ted Kremenek b478ff4efc Add 'PostVisitTU' callback hook to 'perform_test_load()' to allow a special callback after the translation unit has been loaded (and streamed).
llvm-svn: 94557
2010-01-26 17:59:48 +00:00
Ted Kremenek a97a5cd59e Allow the 'visitor' argument to 'perform_test_load()' to be NULL. The
utility of this change will be made clearer in a subsequent patch when
perform_test_load()' does more than stream the AST.

llvm-svn: 94556
2010-01-26 17:55:33 +00:00
Anders Carlsson ca4a5459d8 Use the right definition when emitting a global variable. Fixes PR5564.
llvm-svn: 94555
2010-01-26 17:43:42 +00:00
Anders Carlsson 7228117108 Change getUnique to return a GlobalDecl. Fixes PR6147.
llvm-svn: 94554
2010-01-26 17:36:47 +00:00
Ken Dyck a6046ab82b Correct cut-and-paste error in doxygen comment for newly introduced
getTypeAlignInChars().  

llvm-svn: 94553
2010-01-26 17:25:18 +00:00
Ken Dyck 24d28d6cde Add getTypeAlignInChars() for use in code that works in alignments in character
units.

llvm-svn: 94552
2010-01-26 17:22:55 +00:00
Douglas Gregor 27b4fa994d Introduce a CIndex API for lexing the raw tokens within a given source
range. The token-annotation function does nothing, yet.

llvm-svn: 94551
2010-01-26 17:06:03 +00:00
Ken Dyck 86a8c957da Replace inheritance of RegionRawOffset from std::pair with two private member
variables to improve readability and encapsulation.

llvm-svn: 94550
2010-01-26 17:01:47 +00:00
Ken Dyck 98ca79435a Introduce CodeGenModule::GetTargetTypeStoreSize() to calculate the store size
of LLVM types in character units.

llvm-svn: 94542
2010-01-26 13:48:07 +00:00
John McCall 1f6386b79b Avoid some unnecessary copying of unresolved lookup results.
llvm-svn: 94531
2010-01-26 07:37:41 +00:00
John McCall 8fe6808de0 Handle redeclarations found by ADL deterministically and reasonably.
This solution relies on an O(n) scan of redeclarations, which means it might
scale poorly in crazy cases with tons of redeclarations brought in by a ton
of distinct associated namespaces.  I believe that avoiding this
is not worth the common-case cost.

llvm-svn: 94530
2010-01-26 07:16:45 +00:00
Chandler Carruth 72343706c1 Correctly treat 64 bit integers specified via the mode attribute as the 'long'
type when that type is 64 bits wide, and the 'long long' type when 'long' is
only 32 bits wide. This fixes PR6108.

Also adds a bunch of test cases to ensure proper conversion between equally
sized standard types and mode-specified types on both 32 and 64 bit targets.

llvm-svn: 94527
2010-01-26 06:39:24 +00:00
Anders Carlsson d6b21e4842 If a global variable has an initializer with side effects, it can never be deferred (even if it's in an anonymous namespace).
llvm-svn: 94525
2010-01-26 06:15:16 +00:00
John McCall 91f61fc921 Allow ADL to find functions imported by using decls. Leave wordy comment
about interaction between ADL and default arguments.  Shrug shoulders, commit.

llvm-svn: 94524
2010-01-26 06:04:06 +00:00
Chandler Carruth 0354bf4405 Remove a few more references to index-test; this was killed in r94210.
llvm-svn: 94522
2010-01-26 05:36:44 +00:00
Anders Carlsson 0b5f1ddf0a Fix another debug info crash with virtual bases.
llvm-svn: 94520
2010-01-26 05:26:39 +00:00
Anders Carlsson 17ed0496c5 Fix the test I broke, and also fix a crash when declaring a virtual destructor. Add debug info support for pure virtual member functions.
llvm-svn: 94519
2010-01-26 05:19:50 +00:00
Anders Carlsson b85f0ab976 Factor creating the DISubprogram for a member function out into a separate function.
llvm-svn: 94513
2010-01-26 04:49:33 +00:00
Anders Carlsson c1821155bf Simplify CGDebugInfo::CollectCXXMemberFunctions a little. More to come.
llvm-svn: 94511
2010-01-26 04:40:11 +00:00
Anders Carlsson 20bbbd489b Make sure to always mark a global variable as not being constant if it has a C++ initializer.
llvm-svn: 94504
2010-01-26 04:02:23 +00:00
Daniel Dunbar 19afd61201 Simplify.
llvm-svn: 94503
2010-01-26 03:56:40 +00:00
Mike Stump 77537b136e Be sure to track the non-virtual part of the vcall offset in complex
multiple inheritance cases.  WIP.

This fixes 20% of the outstanding problems found by the randomized
tester.

llvm-svn: 94499
2010-01-26 03:42:22 +00:00
John McCall 4c4c1dfc2b Preserve access bits through overload resolution much better. Some
general refactoring in operator resolution.

llvm-svn: 94498
2010-01-26 03:27:55 +00:00
Douglas Gregor 47751d6c21 Introduce clang_getInstantiationLocationOffset(), which decomposes a
source location in file + offset.

llvm-svn: 94497
2010-01-26 03:07:15 +00:00
Daniel Dunbar d54669d30b Driver/Darwin: Honor IPHONEOS_DEPLOYMENT_TARGET.
llvm-svn: 94488
2010-01-26 01:45:19 +00:00
Daniel Dunbar d86666ffd7 Driver/Darwin: Stuff iPhoneOS into environment portion of the (llvm/clang) triple instead of keying off architecture. Also, fix version define to properly include the revision/micro component of the version number.
llvm-svn: 94487
2010-01-26 01:44:04 +00:00
John McCall b89836b6db Pass access specifiers around in overload resolution.
llvm-svn: 94485
2010-01-26 01:37:31 +00:00
Fariborz Jahanian 7b99f27392 Fix a regression caused by my rewriting of cast of ivar
access (was radar 7575882).

llvm-svn: 94481
2010-01-26 00:29:22 +00:00
Mike Stump 90181eb294 Fixup a missing vcall entry. WIP.
llvm-svn: 94478
2010-01-26 00:05:04 +00:00
Devang Patel c54353d935 First cut at emitting inheritance info.
llvm-svn: 94473
2010-01-25 23:32:18 +00:00
Devang Patel 7af03fb4f0 Emit debug info for virtual functions.
llvm-svn: 94467
2010-01-25 23:17:15 +00:00
John McCall 5cb5287467 Fixit to remove 'volatile' in file-scope 'asm volatile'.
llvm-svn: 94466
2010-01-25 23:12:50 +00:00
Daniel Dunbar 4e29505a95 Driver: Fix fallback to gcc to -c instead of -S if trying to generate an LLVM bc
file.

llvm-svn: 94463
2010-01-25 22:35:08 +00:00
Ted Kremenek 97a4537138 Pull functions that translate from CXSourceLocation to SourceLocation (and back) to a separate header file.
llvm-svn: 94462
2010-01-25 22:34:44 +00:00
John McCall 9dfb16210e Warn on top-level 'asm volatile' (instead of misparsing it).
"Fixes" rdar://problem/7574870

llvm-svn: 94458
2010-01-25 22:27:48 +00:00
Fariborz Jahanian 5cda92820f global variable that binds reference to a non-lvalue reproted
as NYI now.

llvm-svn: 94453
2010-01-25 21:40:39 +00:00
Ted Kremenek 6dc73bc183 Fix include guard.
llvm-svn: 94447
2010-01-25 21:09:34 +00:00
Fariborz Jahanian d360ce9d57 Fixes a rewriting bug of access ivar of a variable cast
to subclass. (Fixes radar 7575882).

llvm-svn: 94444
2010-01-25 20:50:02 +00:00
Fariborz Jahanian 210031b79c Fix a code gen. bug involving compiling global references.
(fixes radar 7574896).

llvm-svn: 94434
2010-01-25 18:30:26 +00:00
Douglas Gregor e391b01a3a Add test case for ? : crasher
llvm-svn: 94429
2010-01-25 17:48:13 +00:00
Ted Kremenek fe0fc40c3b Move BugReporter.h, PathDiagnostic.h, and BugType.h to 'include/Checker/BugReporter'
llvm-svn: 94428
2010-01-25 17:10:22 +00:00
Eli Friedman 673f94a0c9 Code simplification; this should have no visible effects.
llvm-svn: 94427
2010-01-25 17:04:54 +00:00
Douglas Gregor 5bce76cd53 Loosen preconditions for clang_getCursorSpelling(), returning an empty
string when given a cursor that does not have a name. Also, don't give
silly names for statements and non-reference expressions.

llvm-svn: 94426
2010-01-25 16:56:17 +00:00
Douglas Gregor 33f1685607 Expect the impossible
llvm-svn: 94425
2010-01-25 16:45:46 +00:00
Douglas Gregor 7210063126 Move the type specifier location for elaborated-type-specifiers from
the tag kind (union, struct, class, enum) over to the name of the tag,
if there is a name, since most clients want to point at the name.

llvm-svn: 94424
2010-01-25 16:33:23 +00:00
Douglas Gregor 7201f9f6b8 Visit the condition variables of while and for loops; also, visit the
condition even when we've visited the condition variable, so that
we'll see implicit conversions there.

llvm-svn: 94423
2010-01-25 16:12:32 +00:00
Benjamin Kramer ea9f3f240c Update C++ include paths for Exherbo, by Ingmar Vanhassel.
llvm-svn: 94420
2010-01-25 12:20:15 +00:00
Daniel Dunbar f91a8d64d4 cindex/Python: Move translation unit load functions to Index, there isn't a good reason to have separate static methods for this.
llvm-svn: 94419
2010-01-25 09:16:55 +00:00
Daniel Dunbar dacede8349 cindex/Python: Support file objects as unsaved_files, albeit inefficiently.
llvm-svn: 94418
2010-01-25 09:16:41 +00:00
Ted Kremenek b2c9aa6cbc Add missing header.
llvm-svn: 94409
2010-01-25 05:19:37 +00:00
Ted Kremenek 0a4546b6fc Add missing file.
llvm-svn: 94407
2010-01-25 04:48:38 +00:00
Ted Kremenek d6b8708643 Split libAnalysis into two libraries: libAnalysis and libChecker.
(1) libAnalysis is a generic analysis library that can be used by
    Sema.  It defines the CFG, basic dataflow analysis primitives, and
    inexpensive flow-sensitive analyses (e.g. LiveVariables).

(2) libChecker contains the guts of the static analyzer, incuding the
    path-sensitive analysis engine and domain-specific checks.

Now any clients that want to use the frontend to build their own tools
don't need to link in the entire static analyzer.

This change exposes various obvious cleanups that can be made to the
layout of files and headers in libChecker.  More changes pending.  :)

This change also exposed a layering violation between AnalysisContext
and MemRegion.  BlockInvocationContext shouldn't explicitly know about
BlockDataRegions.  For now I've removed the BlockDataRegion* from
BlockInvocationContext (removing context-sensitivity; although this
wasn't used yet).  We need to have a better way to extend
BlockInvocationContext (and any LocationContext) to add
context-sensitivty.

llvm-svn: 94406
2010-01-25 04:41:41 +00:00
Chris Lattner 1df52e7d6a merge another one in.
llvm-svn: 94404
2010-01-25 03:38:26 +00:00
Chris Lattner fe28ef686e consolidate two testcases.
llvm-svn: 94403
2010-01-25 03:37:52 +00:00
Chris Lattner 83b0dd16c3 fix rdar://7556129 a crash in blocks debug info codegen.
llvm-svn: 94402
2010-01-25 03:34:56 +00:00
Chris Lattner bf78478d35 simplify code.
llvm-svn: 94401
2010-01-25 03:29:35 +00:00
Daniel Dunbar 90986f5d3f cindex/Python: Add Cursor test.
llvm-svn: 94397
2010-01-25 00:44:21 +00:00
Daniel Dunbar 9ad194dc18 cindex/Python: Implement support for unsaved/remapped files.
llvm-svn: 94396
2010-01-25 00:44:11 +00:00
Daniel Dunbar fcf2d428e4 ASTUnit: Don't check that input files exist when parsing ASTs from the command
line -- they may be remapped (fake) files. This is useful for testing parsing
entirely from memory.

llvm-svn: 94395
2010-01-25 00:44:02 +00:00
Daniel Dunbar 7baaee93e7 cindex/Python: Fix/simplify Index.parse() passing command line arguments.
llvm-svn: 94394
2010-01-25 00:43:31 +00:00
Daniel Dunbar d01592617f Update comment.
llvm-svn: 94393
2010-01-25 00:43:14 +00:00
Daniel Dunbar 36104a8665 cindex/Python: Update comments, add module docstrings, add LLVM headers.
llvm-svn: 94392
2010-01-25 00:43:08 +00:00
Daniel Dunbar 2def7eb3ca CIndex: Don't crash when visitor passes null child statements, and sprinkle some
asserts in cursor construction functions to make this more obvious.

Doug, please check. c-index-test would previously crash on this code:
--
for(;;) {}
--
Do we need a custom visit of the for statement to cover the variable
declarations?

llvm-svn: 94391
2010-01-25 00:40:30 +00:00
Daniel Dunbar 3e555fd85f cindex/Python: Move Cursor.is_ methods to CursorKind, and add test.
Also, add CursorKind.get_all_kinds().

llvm-svn: 94389
2010-01-24 21:20:39 +00:00
Daniel Dunbar 195cdeceaf cindex/Python: Implement explicit objects for CursorKind enumeration values.
llvm-svn: 94388
2010-01-24 21:20:29 +00:00
Daniel Dunbar 55d6964e28 cindex/Python: Fetch SourceLocation instantiation location information on lazily, it isn't free.
Also, add repr() support to SourceRange.

llvm-svn: 94387
2010-01-24 21:20:21 +00:00
Daniel Dunbar aca5acfd01 cindex/Python: Add Cursor.get_usr().
Also, change Cursor.spelling to return None for non-decls, for consistency with get_usr().

llvm-svn: 94386
2010-01-24 21:20:13 +00:00
Daniel Dunbar 501e91f3b7 cindex/Python: Return null cursors as None instead of exposing this notion.
llvm-svn: 94385
2010-01-24 21:20:05 +00:00
Daniel Dunbar 942453284f cindex/Python: Convert CXString objects to regular Python strings below API.
llvm-svn: 94384
2010-01-24 21:19:57 +00:00
Daniel Dunbar 322be3a46e Simplify.
llvm-svn: 94383
2010-01-24 21:19:48 +00:00
Daniel Dunbar 18b75a4f10 cindex/Python: Remove Cursor.file forwarding method, this doesn't really fit the API.
llvm-svn: 94382
2010-01-24 21:19:40 +00:00
Chris Lattner 0bcc858a2b -fno-rtti is now the default.
llvm-svn: 94379
2010-01-24 20:43:31 +00:00
Fariborz Jahanian 734e95e05c Enhance test to check on expected rewritten output.
llvm-svn: 94368
2010-01-24 18:40:06 +00:00
Anders Carlsson 6515d877c0 Fix a pretty bad bug where if a constructor (or conversion function) was marked as 'explicit', but then defined out-of-line, we would not treat it as being explicit.
llvm-svn: 94366
2010-01-24 17:15:04 +00:00
Anders Carlsson 77babdb99a Implement [dcl.fct.spec]p6.
llvm-svn: 94365
2010-01-24 16:49:46 +00:00
Mike Stump 20a2c618f2 Ok, turn back off -Wunreachable-code by default.
llvm-svn: 94364
2010-01-24 16:16:01 +00:00
Sebastian Redl 0432dcd15c Mark PartialDiagnostic.h as a C++ header
llvm-svn: 94363
2010-01-24 10:02:25 +00:00
Anders Carlsson c0ebb9412c Land test case.
llvm-svn: 94362
2010-01-24 05:50:37 +00:00
Anders Carlsson aaeef07280 Implement instantiation of AsmStmts (Crazy, I know)
llvm-svn: 94361
2010-01-24 05:50:09 +00:00
Daniel Dunbar b9999fdc67 Tweak clang_visitChildren comment.
llvm-svn: 94360
2010-01-24 04:10:31 +00:00
Daniel Dunbar fd7caa25a6 cindex/Python: Add Cursor.get_children()
llvm-svn: 94359
2010-01-24 04:10:22 +00:00
Daniel Dunbar 7bcfd6eb6d cindex/Python: Remove Declaration class, this has been removed from the API.
llvm-svn: 94358
2010-01-24 04:10:06 +00:00
Daniel Dunbar 8f8f35bd6c cindex/Python: Eliminate Entity class, it has been removed from CIndex.
llvm-svn: 94357
2010-01-24 04:09:58 +00:00
Daniel Dunbar b34dde72e3 Simplify.
llvm-svn: 94356
2010-01-24 04:09:51 +00:00
Daniel Dunbar e79aba4c72 cindex/Python: Add TranslationUnit.cursor.
llvm-svn: 94355
2010-01-24 04:09:43 +00:00
Daniel Dunbar 3615fd27f2 cindex/Python: Tweak Source{Location,Range}
- Add __repr__ on SourceLocation.

 - Fix File object construction to use c_object_p type, and use None instead of
   invalid File objects.

 - Make SourceRange.{start,end} properties.

llvm-svn: 94354
2010-01-24 04:09:34 +00:00
Daniel Dunbar 3cdcfe03bf cindex/Python: Make Cursor.is_... functions not properties.
Also, add ValueError check before calling Cursor_spelling.

llvm-svn: 94353
2010-01-24 04:09:23 +00:00
Alexis Hunt aecc45cb3c Mangle static variables with an extra name to distinguish them from non-static variables in the same TU.
Fixes PR5966 for real this time; also reverts r92911, which had a incorrect fix.

llvm-svn: 94352
2010-01-24 03:04:27 +00:00
Daniel Dunbar 62ebf25f44 Index.h: Tweak comments, delete trailing whitespace, fix a few typos, etc.
llvm-svn: 94351
2010-01-24 02:54:26 +00:00
Daniel Dunbar 74716e5ebd Initial checkin of CIndex Python bindings, by Andrew Sutton!
- Some tweaks by me for API changes, Darwin, and x86_64 support. Still needs
   substantial updating to match recent CIndex API changes.

llvm-svn: 94349
2010-01-24 02:02:07 +00:00
Chris Lattner 8fd2d01118 fix PR6034, a crash on invalid where the switch stack would get
unbalanced.

llvm-svn: 94347
2010-01-24 01:50:29 +00:00
Chris Lattner 11092645da add a prototype for __builtin_fpclassify. We don't know how to
codegen it, so we get 'cannot compile this builtin function yet'
errors, just like we do currently for __builtin_isinf.  However,
this should let us parse headers that use it without barfing,
which should help PR6083.

llvm-svn: 94346
2010-01-24 01:30:04 +00:00
Chris Lattner d3637edc4c disable this test, it is failing sporadically.
llvm-svn: 94344
2010-01-24 00:30:31 +00:00
Anders Carlsson 60ddba67a8 Fix a nasty bug where temporaries weren't marked as being conditional in some cases.
llvm-svn: 94341
2010-01-24 00:20:05 +00:00
Anders Carlsson 0bd52403d4 Use new initialization code when dealing with [dcl.init.aggr]p12. This fixes the bug where array elements and member initializers weren't copied correctly.
llvm-svn: 94340
2010-01-24 00:19:41 +00:00
Anders Carlsson 6cabf318c9 Change all InitializedEntity pointers over to be references.
llvm-svn: 94335
2010-01-23 23:23:01 +00:00
Anders Carlsson 3fa93b7e54 Start passing InitializedEntity to CheckDesignatedInitializer.
llvm-svn: 94334
2010-01-23 22:49:02 +00:00
John McCall f9b528c7cf Preserve access for enum constants during template instantiation.
llvm-svn: 94333
2010-01-23 22:37:59 +00:00
Anders Carlsson dbb25a38b9 More init work, adding more entity parameters.
llvm-svn: 94332
2010-01-23 20:47:59 +00:00
Mike Stump 38013e109e Temporary flip default for -Wunreachable-code so some bots can test it
out.  They should all be done later tonight, but if something bad
happens, feel free to revert sooner.

llvm-svn: 94330
2010-01-23 20:23:40 +00:00
Anders Carlsson 73eb7cd351 Use the new init code for member subobjects.
llvm-svn: 94329
2010-01-23 20:20:40 +00:00
Anders Carlsson 0cf999b663 Switch some array initialization over to the new init code.
llvm-svn: 94327
2010-01-23 20:13:41 +00:00
Mike Stump 0978af83b3 Insulate these from changes to the default for -Wunreachable-code.
llvm-svn: 94326
2010-01-23 20:12:18 +00:00
Anders Carlsson d0849254de Baby steps towards migrating the InitListChecker over to the new initialization code. Pass an InitializedEntity pointer through to most init checker functions. Right now, it's ignored everywhere except when initializing vectors in C++.
llvm-svn: 94325
2010-01-23 19:55:29 +00:00
Anders Carlsson 3cc795ae8d When an InitializedEntity is passed to CheckSingleInitializer, call the new Sema::PerformCopyInitialization overload.
llvm-svn: 94324
2010-01-23 19:22:30 +00:00
Eli Friedman d6ef69a7db Add bzero builtin; this should help codegen quality for code using this
function.

llvm-svn: 94320
2010-01-23 19:00:10 +00:00
Anders Carlsson 26d0564fd1 Change CheckSingleInitializer to take/return OwningExprResults instead. No functionality change.
llvm-svn: 94316
2010-01-23 18:35:41 +00:00
Anders Carlsson 7802f31bfc Fix typo.
llvm-svn: 94315
2010-01-23 18:26:49 +00:00
Benjamin Kramer 12a6ce7cad Simplify code with StringRef.
llvm-svn: 94314
2010-01-23 18:16:35 +00:00
Benjamin Kramer 8f8f405c71 No need to terminate this buffer.
llvm-svn: 94313
2010-01-23 18:16:07 +00:00
Ted Kremenek 3e315a28b1 Add doxygen comment to clang_getClangVersion().
llvm-svn: 94311
2010-01-23 17:51:23 +00:00