Commit Graph

1438 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis e862cbc5f6 Don't try to install the __[u]int128_t identifier if it is already installed by PCHReader.
Currently, adding it to visible decls of a PCH'ed translation unit has no effect because
adding visible decls before deserialization has no effect (the decls won't be visible).
This will be fixed in a future commit; then it will force deserialization of visible decls, so avoid pointlessly installing it.

llvm-svn: 107595
2010-07-04 21:44:19 +00:00
Argyrios Kyrtzidis ccde6a02c8 Write/read ParmVarDecl's UninstantiatedDefaultArg for PCH.
llvm-svn: 107594
2010-07-04 21:44:07 +00:00
Argyrios Kyrtzidis cdb8b3f7ec Read/write specialization info of static data members for PCH.
llvm-svn: 107593
2010-07-04 21:44:00 +00:00
Argyrios Kyrtzidis dae2a1607e When setting the anonymous namespace at PCH reading, it may still be initializing so avoid
the invariant checks at NamespaceDecl::setAnonymousNamespace().

llvm-svn: 107566
2010-07-03 07:57:53 +00:00
Douglas Gregor 9672f92f7f Lazily declare default constructors. We now delay the construction of
declarations for implicit default constructors, copy constructors,
copy assignment operators, and destructors. On a "simple" translation
unit that includes a bunch of C++ standard library headers, we
generate relatively few of these implicit declarations now:

  4/159 implicit default constructors created
  18/236 implicit copy constructors created
  70/241 implicit copy assignment operators created
  0/173 implicit destructors created

And, on this translation unit, this optimization doesn't really
provide any benefit. I'll do some more performance measurements soon,
but this completes the implementation work for <rdar://problem/8151045>.

llvm-svn: 107551
2010-07-03 00:47:00 +00:00
Douglas Gregor a6d695057c Lazily declare implicit copy constructors.
llvm-svn: 107543
2010-07-02 23:41:54 +00:00
Argyrios Kyrtzidis 3701fcd759 Read/write CastExpr's CXXBaseSpecifierArray for PCH.
llvm-svn: 107542
2010-07-02 23:30:27 +00:00
Argyrios Kyrtzidis 4259ebcdac Fix broken PCH support for CXXDefaultArgExpr.
llvm-svn: 107541
2010-07-02 23:30:15 +00:00
Douglas Gregor 330b9cff74 Lazily declare copy-assignment operators.
llvm-svn: 107521
2010-07-02 21:50:04 +00:00
Douglas Gregor 7454c563f1 Lazily declare the implicitly-declared destructor in a C++ class.
llvm-svn: 107510
2010-07-02 20:37:36 +00:00
Argyrios Kyrtzidis 335751610e Handle CXXConstructorDecl, CXXDestructorDecl, and CXXConversionDecl for PCH.
<vector> header can be used correctly through PCH now.

llvm-svn: 107483
2010-07-02 15:58:43 +00:00
Argyrios Kyrtzidis 373a83abdc Fix reading FunctionDecls from PCH.
llvm-svn: 107477
2010-07-02 11:55:40 +00:00
Argyrios Kyrtzidis e23371e71d Fix reading ClassTemplateDecl's ClassTemplateSpecializationDecls and ClassTemplatePartialSpecializationDecls.
Store/read also their template arguments because they may be initializing and not be able to provide them.

llvm-svn: 107476
2010-07-02 11:55:37 +00:00
Argyrios Kyrtzidis 2c2167ac3d Fully read/write CXXRecordDecl for PCH.
llvm-svn: 107475
2010-07-02 11:55:32 +00:00
Argyrios Kyrtzidis e929095f4a Fix reading of DependentNameType.
llvm-svn: 107474
2010-07-02 11:55:24 +00:00
Argyrios Kyrtzidis dab33c5d33 Allow reading of InjectedClassNameType from PCH even when its decl is currently initializing.
llvm-svn: 107473
2010-07-02 11:55:20 +00:00
Argyrios Kyrtzidis ee776bcb7a Fix broken reading of member pointer from PCH.
llvm-svn: 107472
2010-07-02 11:55:15 +00:00
Argyrios Kyrtzidis 45a83f9acc - Allow a typedef type to be read from PCH even if its decl is currently initializing.
- Fix creation of TemplateSpecializationType.

llvm-svn: 107471
2010-07-02 11:55:11 +00:00
Argyrios Kyrtzidis e3029a7e7b Fix broken reading of "#lines" from PCH.
llvm-svn: 107470
2010-07-02 11:55:05 +00:00
Argyrios Kyrtzidis 318b0e78c6 Generally types expect an initialized TypeDecl; its safer and less complicated to delay PCH reading the type of a TypeDecl.
llvm-svn: 107469
2010-07-02 11:55:01 +00:00
Argyrios Kyrtzidis 39f0e308c4 Add some side-effect free Create methods for TypeDecl subclasses and use them for PCH reading.
llvm-svn: 107468
2010-07-02 11:54:55 +00:00
Daniel Dunbar bb7ac52e02 Driver/IRgen: Add support for -momit-leaf-frame-pointer.
llvm-svn: 107367
2010-07-01 01:31:45 +00:00
Argyrios Kyrtzidis bd8ac8cf07 Fix PCH support for UnresolvedUsingTypenameDecl and UnresolvedUsingValueDecl.
llvm-svn: 107268
2010-06-30 08:49:30 +00:00
Argyrios Kyrtzidis 4a57bd0d62 Support DependentSizedArrayType for PCH.
llvm-svn: 107267
2010-06-30 08:49:25 +00:00
Argyrios Kyrtzidis f9f47c8e54 Support ParenListExpr for PCH.
llvm-svn: 107266
2010-06-30 08:49:18 +00:00
Daniel Dunbar 120a1e9d0f Headers: Define __INT64_TYPE__ in terms of getInt64Type(), which isn't always
'long'. The practical upshot is so that the uint64_t we define in our stdint.h
ends up being compatible with that defined by gcc (at least on Darwin), which
otherwise could lead to type incompatibilities with other system headers.

llvm-svn: 107255
2010-06-30 06:30:56 +00:00
Argyrios Kyrtzidis 74d28bd084 Support C++ friend declarations for PCH.
This commit 'introduces' a slightly different way to restore the state of the AST object.
It makes PCHDeclReader/PCHDeclWriter friends and gives them access to the private members of the object.
The rationale is to avoid using/modifying the AST interfaces for PCH read/write so that to:

-Avoid complications with objects that have side-effects during creation or when using some setters.
-Not 'pollute' the AST interface with methods only used by the PCH reader/writer
-Allow AST objects to be read-only.

llvm-svn: 107219
2010-06-29 22:47:00 +00:00
Argyrios Kyrtzidis 26d7201d5d When we know that we are at sub-statement reading (which is all of PCHStmtReader) use the "faster" ReadSubStmt. No functionality change.
llvm-svn: 107218
2010-06-29 22:46:25 +00:00
Argyrios Kyrtzidis d0795b2d78 Modify the way sub-statements are stored and retrieved from PCH.
Before this commit, sub-stmts were stored as encountered and when they were placed in the Stmts stack we had to know what index
each stmt operand has. This complicated supporting variable sub-stmts and sub-stmts that were contained in TypeSourceInfos, e.g.

x = sizeof(int[1]);

would crash PCH.

Now, sub-stmts are stored in reverse order, from last to first, so that when reading them, in order to get the next sub-stmt we just
need to pop the last stmt from the stack. This greatly simplified the way stmts are written and read (just use PCHWriter::AddStmt and
 PCHReader::ReadStmt accordingly) and allowed variable stmt operands and TypeSourceInfo exprs.

llvm-svn: 107087
2010-06-28 22:28:35 +00:00
Ted Kremenek e60d304d13 Remove state assertion.
llvm-svn: 107064
2010-06-28 20:44:49 +00:00
Ted Kremenek ea78375ed4 Don't crash in InitializePreprocessor() when there is no valid PTHManager. Fixes <rdar://problem/8098441>.
llvm-svn: 107061
2010-06-28 20:32:40 +00:00
Argyrios Kyrtzidis 99a226dde4 Support CXXPseudoDestructorExpr for PCH.
llvm-svn: 106999
2010-06-28 09:32:03 +00:00
Argyrios Kyrtzidis cd444d1af7 Support DependentScopeDeclRefExpr for PCH.
llvm-svn: 106998
2010-06-28 09:31:56 +00:00
Argyrios Kyrtzidis b5288de67c Refactor PCH reading/writing of template arguments passed to expressions.
llvm-svn: 106997
2010-06-28 09:31:48 +00:00
Argyrios Kyrtzidis ddf5f211d0 Fix PCH emitting/reading for template arguments that contain expressions.
llvm-svn: 106996
2010-06-28 09:31:42 +00:00
Argyrios Kyrtzidis 0b0369a6b3 Fix various bugs in recent commits for C++ PCH.
llvm-svn: 106995
2010-06-28 09:31:34 +00:00
Chris Lattner 51924e517b Implement support for -fwrapv, rdar://7221421
As part of this, pull together trapv handling into the same enum.

This also add support for NSW multiplies.

This also makes PCH disagreement on overflow behavior silent, since it
really doesn't matter except for warnings and codegen (no macros get 
defined etc).

llvm-svn: 106956
2010-06-26 21:25:03 +00:00
Chris Lattner 30c924b3e8 Implement support for #pragma message, patch by Michael Spencer!
llvm-svn: 106950
2010-06-26 17:11:39 +00:00
Argyrios Kyrtzidis b1d38e3f4a Support NonTypeTemplateParmDecl for PCH.
llvm-svn: 106860
2010-06-25 16:25:09 +00:00
Argyrios Kyrtzidis 03e5e0467c Make PCHWriter::FlushStmts() robust. If we added null Stmts, reading them back got messed up.
llvm-svn: 106859
2010-06-25 16:25:02 +00:00
Argyrios Kyrtzidis f0f7a792d7 Support DependentTemplateSpecializationType and ElaboratedType for PCH.
llvm-svn: 106858
2010-06-25 16:24:58 +00:00
Argyrios Kyrtzidis dc9ca0afa8 Add forgotten breaks in case statements.
llvm-svn: 106857
2010-06-25 16:24:51 +00:00
Argyrios Kyrtzidis 58e01ad26f Support UnresolvedLookupExpr for PCH.
llvm-svn: 106832
2010-06-25 09:03:34 +00:00
Argyrios Kyrtzidis b8d3c63820 Support UnresolvedMemberExpr for PCH.
llvm-svn: 106831
2010-06-25 09:03:26 +00:00
Argyrios Kyrtzidis 6ba1bb5dec Print source location when we encounter unhandled statement during PCH writing.
llvm-svn: 106830
2010-06-25 09:03:12 +00:00
Eric Christopher ca10da8839 Remove HAS_TLS define.
llvm-svn: 106786
2010-06-24 20:41:41 +00:00
Argyrios Kyrtzidis bfcacee9b3 Support a couple more C++ Exprs for PCH.
llvm-svn: 106727
2010-06-24 08:57:31 +00:00
Argyrios Kyrtzidis 30d98f3d9e Fix broken de/serialization for a couple of C++ Exprs.
llvm-svn: 106726
2010-06-24 08:57:09 +00:00
Eric Christopher 03256c32ff More clang support for darwin tls. Add a __has_feature macro and
target specific preprocessor define as well.

llvm-svn: 106715
2010-06-24 02:02:00 +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
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
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
Argyrios Kyrtzidis 6e57c35513 Read/write CXXDeleteExpr from/to PCH.
llvm-svn: 106552
2010-06-22 17:07:59 +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
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
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
Argyrios Kyrtzidis a35c8e4092 Combine ClassTemplateDecl's PreviousDeclaration with CommonPtr, as in FunctionTemplateDecl.
llvm-svn: 106412
2010-06-21 10:57:41 +00:00
Argyrios Kyrtzidis 41d4562da2 Support PCH emitting/reading of using declarations.
llvm-svn: 106404
2010-06-20 14:40:59 +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
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 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
Alexis Hunt c675ec09f0 Update CMake build for new attribute changes.
llvm-svn: 106188
2010-06-17 00:37:02 +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
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
Douglas Gregor f56055aee3 Add Cygwin C++ header search path.
llvm-svn: 106108
2010-06-16 16:24:51 +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
Chris Lattner 4e18a2bc97 fix an uninitialized variable, patch by Michael Spencer!
llvm-svn: 106025
2010-06-15 18:55:23 +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 0832963acd Implement -fvisibility-inlines-hidden. <rdar://problem/7819834>
llvm-svn: 106003
2010-06-15 17:05:35 +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
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
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
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
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 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
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
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
Daniel Dunbar 0bcb62dc30 Frontend: Fix crashes on error paths.
llvm-svn: 105759
2010-06-09 22:30:54 +00:00
Chandler Carruth af80f66997 Major redesign of the RecursiveASTVisitor. This implements the majority of the
new design discussed on cfe-dev, with further steps in that direction to come.
It is already much more complete than the previous visitor.

Patch by Zhanyong and Craig with 80 column wraps and one missing declaration
added by me.

llvm-svn: 105709
2010-06-09 08:17:30 +00:00
Daniel Dunbar ee6b692551 Makefiles: Set Clang CPP compiler flags in a single location, instead of scattered throughout the project Makefiles.
llvm-svn: 105638
2010-06-08 20:44:43 +00:00
Daniel Dunbar e6c1daa8fd Makefile: Switch Clang Makefiles to always include the top-level Clang Makefile.
- This eliminates most dependencies on how Clang is installed relative to LLVM.

llvm-svn: 105637
2010-06-08 20:34:18 +00:00
Daniel Dunbar 6f8362c6bf Frontend: Add CodeGenAction support for handling LLVM IR.
- This magically enables using 'clang -cc1' as a replacement for most of 'llvm-as', 'llvm-dis', 'llc' and 'opt' functionality.

For example, 'llvm-as' is:
  $ clang -cc1 -emit-llvm-bc FOO.ll -o FOO.bc
and 'llvm-dis' is:
  $ clang -cc1 -emit-llvm    FOO.bc -o -
and 'opt' is, e.g.:
  $ clang -cc1 -emit-llvm -O3 -o FOO.opt.ll FOO.ll
and 'llc' is, e.g.:
  $ clang -cc1 -S -o - FOO.ll

The nice thing about using the backend tools this way is that they are guaranteed to exactly match how the compiler generates code (for example, setting the same backend options).

llvm-svn: 105583
2010-06-07 23:27:59 +00:00
Daniel Dunbar 9507f9cc05 Frontend: Add FrontendAction support for handling LLVM IR inputs.
- These inputs follow an abbreviated execution path, but are still worth handling by FrontendAction so they reuse all the other clang -cc1 features.

llvm-svn: 105582
2010-06-07 23:26:47 +00:00
Daniel Dunbar fcb2e6ddea FrontendAction: Track active file kind.
llvm-svn: 105581
2010-06-07 23:25:49 +00:00
Daniel Dunbar fa6214c952 Frontend: Rename hasASTSupport to hasASTFileSupport, which is more accurate.
llvm-svn: 105580
2010-06-07 23:24:43 +00:00
Daniel Dunbar aed46fcbe9 Frontend: Move some initialization from CompilerInstance to FrontendAction, to parallel what is done for AST inputs.
llvm-svn: 105579
2010-06-07 23:23:50 +00:00
Daniel Dunbar 8654638b23 Frontend: Change FrontendAction::BeginSourceFile to take the input kind instead of an IsAST bool.
llvm-svn: 105578
2010-06-07 23:23:06 +00:00
Daniel Dunbar 9b491e79fc Frontend: Lift InputKind enumeration to top level.
llvm-svn: 105577
2010-06-07 23:22:09 +00:00
Daniel Dunbar 3e11152de3 Frontend: Drop unnecessary TargetData argument to EmitBackendOutput, we always
create modules which have target data strings.

llvm-svn: 105576
2010-06-07 23:21:04 +00:00
Daniel Dunbar f976d1b205 Frontend: Factor clang::EmitBackendOutput out of CodeGenAction.
llvm-svn: 105575
2010-06-07 23:20:08 +00:00
Daniel Dunbar 6d5824f5bf Frontend: Add CodeGenOptions::SimplifyLibCalls, and eliminate LangOptions argument to BackendConsumer.
llvm-svn: 105574
2010-06-07 23:19:17 +00:00
Abramo Bagnara d73405829b Added AccessSpecDecl node.
llvm-svn: 105525
2010-06-05 05:09:32 +00:00
John McCall 339bb66246 Remember type source information for Objective C property declarations.
llvm-svn: 105484
2010-06-04 20:50:08 +00:00
Fariborz Jahanian 9643399ef0 Added a field to BlockDeclRefExpr for future use.
No functionality change yet.

llvm-svn: 105479
2010-06-04 19:06:53 +00:00
Rafael Espindola 92eb2cbbef Add ARM paths for debian. Not enough to bootstrap on a beagle board, but
moves us further.

llvm-svn: 105468
2010-06-04 14:28:10 +00:00
John McCall a3ccba0417 Restructure how we interpret block-literal declarators. Correctly handle
the case where we pick up block arguments from a typedef.  Save the block
signature as it was written, and preserve same through PCH.

llvm-svn: 105466
2010-06-04 11:21:44 +00:00
John McCall 1c70e99a2c Hack in some really terrible C++ record PCH support that I need right now.
This is required in order to test:

The ASTImporter should set base classes after formally entering the definition.

llvm-svn: 105401
2010-06-03 19:28:45 +00:00
Daniel Dunbar 6d3bc0898e Fix undefined behavior, noticed by GCC 4.5. Patch by Dimitry Andric!
llvm-svn: 105329
2010-06-02 15:47:10 +00:00
John McCall 75b960e5ee Alter the ExternalASTSource interface to permit by-name lookups. PCH continues to
bring in the entire lookup table at once.

Also, give ExternalSemaSource's vtable a home.  This is important because otherwise
any reference to it will cause RTTI to be emitted, and since clang is compiled
with -fno-rtti, that RTTI will contain unresolved references (to ExternalASTSource's
RTTI).  So this change makes it possible to subclass ExternalSemaSource from projects
compiled with RTTI, as long as the subclass's home is compiled with -fno-rtti.

llvm-svn: 105268
2010-06-01 09:23:16 +00:00
Alexis Hunt ed05325dbe Convert DeclNodes to use TableGen.
The macros required for DeclNodes use have changed to match the use of
StmtNodes. The FooFirst enumerator constants have been named firstFoo
to match usage elsewhere.

llvm-svn: 105165
2010-05-30 07:21:58 +00:00
Douglas Gregor 117ef277cb More PowerPC paths on Darwin
llvm-svn: 105084
2010-05-29 01:21:11 +00:00
Douglas Gregor eb0bdf08dc Add C++ include paths for Darwin PowerPC
llvm-svn: 105083
2010-05-29 01:15:12 +00:00
Chris Lattner 2304c4d0ff add fedora 13 paths, patch by Hendrik Richter.
llvm-svn: 105082
2010-05-29 01:01:38 +00:00
John McCall 61d8258fa3 Roll back r104941.
llvm-svn: 104990
2010-05-28 18:25:28 +00:00
Jakob Stoklund Olesen f298e02c9d Let the backend decide which scheduler and register allocator to use.
Currently, the backend uses the same policy, but it will soon switch to
-regalloc=fast for -O0.

llvm-svn: 104984
2010-05-28 18:13:31 +00:00
John McCall 2177a9b65a Add a new attribute on records, __attribute__((adl_invisible)), and define
the x86-64 __va_list_tag with this attribute.  The attribute causes the
affected type to behave like a fundamental type when considered by ADL.

(x86-64 is the only target we currently provide with a struct-based
__builtin_va_list)

Fixes PR6762.

llvm-svn: 104941
2010-05-28 08:20:36 +00:00
Daniel Dunbar eaff5fa30a Frontend: Sprinkle in some C++ header paths for ARM/Darwin. Also, don't add x86
paths on non-x86.

I really detest this file.

llvm-svn: 104921
2010-05-28 01:54:31 +00:00
Dan Gohman 04f8720118 Add several more predefines from modern versions of GCC.
llvm-svn: 104906
2010-05-28 00:27:15 +00:00
Dan Gohman cab4933f95 MemoryBuffer::getSTDIN may return a null pointer if an error occurs.
llvm-svn: 104856
2010-05-27 17:33:40 +00:00
Daniel Dunbar c43b6b20d5 Driver: Add clang -cc1 -mrelax-all option, which sets relaxes all instructions when using -integrated-as.
llvm-svn: 104807
2010-05-27 05:39:39 +00:00
Daniel Dunbar fc6507ef58 AST: Add AlignMac68kAttr, not yet used.
llvm-svn: 104800
2010-05-27 02:25:39 +00:00
Daniel Dunbar 401304462a AST: Rename PragmaPackAttr to MaxFieldAlignmentAttr, which is more accurate.
llvm-svn: 104795
2010-05-27 01:12:46 +00:00
Ted Kremenek 34ddec630c Predefine the '__clang_analyzer__' macro when using '-analyze'.
llvm-svn: 104742
2010-05-26 21:36:54 +00:00
Douglas Gregor f64acca2f5 Only enable code patterns (e.g., try { statements } catch (...) {
statements }) in the code-completion results if explicitly requested.

llvm-svn: 104637
2010-05-25 21:41:55 +00:00
Daniel Dunbar 4c77a64391 Driver/Frontend: Add -emit-codegen-only, for running irgen + codegen but not the
.s printer or .o writer.

llvm-svn: 104623
2010-05-25 18:41:01 +00:00
Fariborz Jahanian 31b8a9d83f Refactoring of block-pointer type rewrite.
llvm-svn: 104614
2010-05-25 17:12:52 +00:00
Fariborz Jahanian 19c6240713 Patch to rewrite block pointers as arguments to
methods. (Radar 7987817).

llvm-svn: 104608
2010-05-25 15:56:08 +00:00
Chris Lattner 787aef9aed when too many errors are emitted, and we produce:
fatal error: too many errors emitted, stopping now [-ferror-limit=]

Tell the user that this is controlled with -ferror-limit=, like above.

llvm-svn: 104528
2010-05-24 18:37:03 +00:00
Fariborz Jahanian 36680dd751 Fix a rewriting bug where a local static objective-c
pointer is copied into a block. Fixes radar 7924024.

llvm-svn: 104526
2010-05-24 18:32:56 +00:00
Fariborz Jahanian 427ee8b5f3 Fix an objective-c rewriter bug when pre-processed file's
class declaration's @end is not followed by a new-line.
(radar 7946975).

llvm-svn: 104512
2010-05-24 17:22:38 +00:00
John McCall b54367d2f8 Propagate access specifiers to anonymous union members nested within classes.
Fixes <rdar://problem/7987650>.

llvm-svn: 104376
2010-05-21 20:45:30 +00:00
Daniel Dunbar 3730048129 Driver: Move some argument lookup utilities into driver::ArgList.
llvm-svn: 104237
2010-05-20 16:54:55 +00:00
Abramo Bagnara d754848f10 Added basic source locations to Elaborated and DependentName types.
llvm-svn: 104169
2010-05-19 21:37:53 +00:00
Ted Kremenek 26bde774df Add clang support for IBOutletCollection.
llvm-svn: 104135
2010-05-19 17:38:06 +00:00
Douglas Gregor a941dcae16 Add support for Microsoft's __thiscall, from Steven Watanabe!
llvm-svn: 104026
2010-05-18 16:57:00 +00:00
Douglas Gregor 923d2252dc "The attached patch allows clang to find the headers
for Visual Studio 2010.  It also adds a registry search
for the Express edition,", from Steven Watanabe!

llvm-svn: 104015
2010-05-18 05:47:04 +00:00
Zhongxing Xu b013b0bc04 Add option '-analyzer-max-loop', which specifies the maximum
number of times the analyzer will go through a loop.

llvm-svn: 104007
2010-05-18 00:28:37 +00:00
John McCall 96fa4845f7 Clean up some more uses of getAs<ObjCInterfaceType>() that Fariborz pointed
out.  The remaining ones are okay.

llvm-svn: 103973
2010-05-17 21:00:27 +00:00
mike-m c6da261fb4 Moved clang-builtin include dir position to immediately precede C includes.
This aligns with how gcc compiler does things.

llvm-svn: 103912
2010-05-16 19:03:52 +00:00
John McCall 94f619ac2b Emit a type record for TYPE_OBJC_OBJECT in the PCH file. I'm not
entirely sure what this does, to be honest.

llvm-svn: 103895
2010-05-16 02:12:35 +00:00
John McCall 8b07ec253d Substantially alter the design of the Objective C type AST by introducing
ObjCObjectType, which is basically just a pair of
  one of {primitive-id, primitive-Class, user-defined @class}
with
  a list of protocols.
An ObjCObjectPointerType is therefore just a pointer which always points to
one of these types (possibly sugared).  ObjCInterfaceType is now just a kind
of ObjCObjectType which happens to not carry any protocols.

Alter a rather large number of use sites to use ObjCObjectType instead of
ObjCInterfaceType.  Store an ObjCInterfaceType as a pointer on the decl rather
than hashing them in a FoldingSet.  Remove some number of methods that are no
longer used, at least after this patch.

By simplifying ObjCObjectPointerType, we are now able to easily remove and apply
pointers to Objective-C types, which is crucial for a certain kind of ObjC++
metaprogramming common in WebKit.

llvm-svn: 103870
2010-05-15 11:32:37 +00:00
Douglas Gregor 6fd1b1802f Implement semantic analysis and an AST representation for the named
return value optimization. Sema marks return statements with their
NRVO candidates (which may or may not end up using the NRVO), then, at
the end of a function body, computes and marks those variables that
can be allocated into the return slot.

I've checked this locally with some debugging statements (not
committed), but there won't be any tests until CodeGen comes along.

llvm-svn: 103865
2010-05-15 06:01:05 +00:00
Douglas Gregor 222cf0efbc Recognize when the named return value optimization applies in a
"return" statement and mark the corresponding CXXConstructExpr as
elidable. Teach CodeGen that eliding a temporary is different from
eliding an object construction.

This is just a baby step toward NRVO.

llvm-svn: 103849
2010-05-15 00:13:29 +00:00
Daniel Dunbar 4707cef758 Revert r103770, "Added basic source locations to Elaborated and DependentName
types.", it is breaking Clang bootstrap.

llvm-svn: 103775
2010-05-14 16:34:09 +00:00
Abramo Bagnara e9f4d6ed7d Added basic source locations to Elaborated and DependentName types.
llvm-svn: 103770
2010-05-14 14:14:23 +00:00
Douglas Gregor 88d292ccb8 Rework when and how vtables are emitted, by tracking where vtables are
"used" (e.g., we will refer to the vtable in the generated code) and
when they are defined (i.e., because we've seen the key function
definition). Previously, we were effectively tracking "potential
definitions" rather than uses, so we were a bit too eager about emitting
vtables for classes without key functions. 

The new scheme:
  - For every use of a vtable, Sema calls MarkVTableUsed() to indicate
  the use. For example, this occurs when calling a virtual member
  function of the class, defining a constructor of that class type,
  dynamic_cast'ing from that type to a derived class, casting
  to/through a virtual base class, etc.
  - For every definition of a vtable, Sema calls MarkVTableUsed() to
  indicate the definition. This happens at the end of the translation
  unit for classes whose key function has been defined (so we can
  delay computation of the key function; see PR6564), and will also
  occur with explicit template instantiation definitions.
 - For every vtable defined/used, we mark all of the virtual member
 functions of that vtable as defined/used, unless we know that the key
 function is in another translation unit. This instantiates virtual
 member functions when needed.
  - At the end of the translation unit, Sema tells CodeGen (via the
  ASTConsumer) which vtables must be defined (CodeGen will define
  them) and which may be used (for which CodeGen will define the
  vtables lazily). 

From a language perspective, both the old and the new schemes are
permissible: we're allowed to instantiate virtual member functions
whenever we want per the standard. However, all other C++ compilers
were more lazy than we were, and our eagerness was both a performance
issue (we instantiated too much) and a portability problem (we broke
Boost test cases, which now pass).

Notes:
  (1) There's a ton of churn in the tests, because the order in which
  vtables get emitted to IR has changed. I've tried to isolate some of
  the larger tests from these issues.
  (2) Some diagnostics related to
  implicitly-instantiated/implicitly-defined virtual member functions
  have moved to the point of first use/definition. It's better this
  way.
  (3) I could use a review of the places where we MarkVTableUsed, to
  see if I missed any place where the language effectively requires a
  vtable.

Fixes PR7114 and PR6564.

llvm-svn: 103718
2010-05-13 16:44:06 +00:00
Chris Lattner bf5c83745a "this patch properly addresses escaping < and > which might appear
(e.g. for C++ operators) in the xml dump.

I also re-enabled the unit test for ast-print-xml (or so I think)
at least, make test didn't fail..."

patch by Sebastien Binet!

llvm-svn: 103671
2010-05-12 23:27:11 +00:00
Abramo Bagnara 6150c884df Merged Elaborated and QualifiedName types.
llvm-svn: 103517
2010-05-11 21:36:43 +00:00
Ted Kremenek a9084c1fb1 Convert CXXTempory[] in CXXExprWithTemporaries to be allocated using ASTContext's allocator. Fixes <rdar://problem/7961605>.
llvm-svn: 103421
2010-05-10 20:06:30 +00:00
Douglas Gregor e5279cea49 Improved -ast-print-xml for C++, from Sebastien Binet!
llvm-svn: 103412
2010-05-10 17:43:18 +00:00
Chris Lattner abfb58d1d2 pch'ify CXXNewExpr and CXXZeroInitValueExpr
llvm-svn: 103390
2010-05-10 01:22:27 +00:00
Chris Lattner cba86142a4 pchify CXXTemporary, CXXBindTemporaryExpr, and
CXXExprWithTemporaries.

llvm-svn: 103387
2010-05-10 00:25:06 +00:00
Chris Lattner e2437f4538 pch'ify default argument definitions and uses.
llvm-svn: 103376
2010-05-09 06:40:08 +00:00
Chris Lattner 9826733963 pch'ify 'this' and 'throw'
llvm-svn: 103375
2010-05-09 06:15:05 +00:00