lazy PCH deserialization. Propagate that argument wherever it needs to
be. No functionality change, except that I've tightened up a few PCH
tests in preparation.
llvm-svn: 69406
compiler to dump random stuff from the build into the file. Right now this
amounts to dumping command line arguments and diagnostics to the file.
The idea is that you can set an envvar, do a world build of an OS, then grep
through all the logs for interesting things or something.
Daniel, please wire the driver up to do something with this.
llvm-svn: 69386
- Cover your eyes...
- This is a simple but effective way to allow developers to build a
project with clang while manipulating the command line, without
having to edit the project itself.
llvm-svn: 69342
with other diagnostic mapping. In the new scheme, -Wfoo or -Wno-foo or
-Werror=foo all override the -pedantic options, and __extension__
robustly silences all extension diagnostics in their scope.
An added bonus of this change is that MAP_DEFAULT goes away, meaning that
per-diagnostic mapping information can now be stored in 2 bits, doubling
the density of the Diagnostic::DiagMapping array. This also
substantially simplifies Diagnostic::getDiagnosticLevel.
OTOH, this temporarily introduces some "macro intensive" code in
Diagnostic.cpp. This will be addressed in a later patch.
llvm-svn: 69154
kind PCH handles that has an expression as an operand, so most of this
work is in the infrastructure to rebuild expression trees from the
serialized representation. We now store expressions in post-order
(e.g., Reverse Polish Notation), so that we can easily rebuild the
appropriate expression tree.
llvm-svn: 69101
This allows it to accurately measure tokens, so that we get:
t.cpp:8:13: error: unknown type name 'X'
static foo::X P;
~~~~~^
instead of the woefully inferior:
t.cpp:8:13: error: unknown type name 'X'
static foo::X P;
~~~~ ^
Most of this is just plumbing to push the reference around.
llvm-svn: 69099
wrap-up (e.g., turning tentative definitions into definitions). Also,
very that, when we actually use the PCH file, we get the ride code
generation for tentative definitions and definitions that show up in
the PCH file.
llvm-svn: 69043
buffer generated for the current translation unit. If they are
different, complain and then ignore the PCH file. This effectively
checks for all compilation options that somehow would affect
preprocessor state (-D, -U, -include, the dreaded -imacros, etc.).
When we do accept the PCH file, throw away the contents of the
predefines buffer rather than parsing them, since all of the results
of that parsing are already stored in the PCH file. This eliminates
the ugliness with the redefinition of __builtin_va_list, among other
things.
llvm-svn: 68838
PCH. This works now, except for limitations not being able to do things
with identifiers. The basic example in the testcase works though.
llvm-svn: 68832
into clang-cc.cpp. This makes it so clang-cc constructs the *entire* predefines
buffer, not just half of it. A bonus of this is that we get to kill a copy
of DefineBuiltinMacro.
llvm-svn: 68830
- Patch by Shantonu Sen (with a minor tweak to split out
getDarwin{OSX,IPhoneOS}Defines)!
- <rdar://problem/6776277> Need clang-cc/ccc-analyzer support for
-miphoneos-version-min
llvm-svn: 68815
improvement, source locations read from the PCH file will properly
resolve to the source files that were used to build the PCH file
itself.
Once we have the preprocessor state stored in the PCH file, source
locations that refer to macro instantiations that occur in the PCH
file should have the appropriate instantiation information.
llvm-svn: 68758
de-serialization of abstract syntax trees.
PCH support serializes the contents of the abstract syntax tree (AST)
to a bitstream. When the PCH file is read, declarations are serialized
as-needed. For example, a declaration of a variable "x" will be
deserialized only when its VarDecl can be found by a client, e.g.,
based on name lookup for "x" or traversing the entire contents of the
owner of "x".
This commit provides the framework for serialization and (lazy)
deserialization, along with support for variable and typedef
declarations (along with several kinds of types). More
declarations/types, along with important auxiliary structures (source
manager, preprocessor, etc.), will follow.
llvm-svn: 68732
- Otherwise paths will be resolved relative to the main input file,
which is incorrect.
- I don't know how to make a reasonable test case for this with our
testing infrastructure.
- PR3395
llvm-svn: 68665
- Add -static-define option driver can use when __STATIC__ should be
defined (instead of __DYNAMIC__).
- Don't set __OPTIMIZE_SIZE__ on Os, __OPTIMIZE_SIZE__ is tied to Oz.
- Set __NO_INLINE__ following GCC 4.2.
- Set __GNU_GNU_INLINE__ or __GNU_STDC_INLINE__ following GCC 4.2.
- Set __EXCEPTIONS for Objective-C NonFragile ABI.
- Set __STRICT_ANSI__ for standard conforming modes.
- I added a clang style test case in utils for this, but its not
particularly portable and I don't think it belongs in the test
suite.
llvm-svn: 68621
- This is pretty ugly, but the most obvious solution. Chime in if you
have a nicer one.
- The problem is that with -save-temps, clang-cc has no idea what the
name of the original input file is. However, the user expects to be
able to set breakpoints based on the input file name.
- We support this by providing a new option -main-file-name (similar
to -dumpbase used by gcc) which allows the driver to pass in the
original file name.
- <rdar://problem/6753383> building with clang using --save-temps
gets the compile unit name from the .i file...
llvm-svn: 68595
- Add -pic-level clang-cc option to specify the value for the define,
updated driver to pass this.
- Added __pic__
- Added OBJC_ZEROCOST_EXCEPTIONS define while I was here (to match gcc).
llvm-svn: 68584
clang.
- We will eventually want some more driver infrastructre for this
probably.
- For now, the clang-cc interface stays relatively the same, but we
don't accept multiple instances anymore, or the [no-] variants
directly.
llvm-svn: 68550
better name) is the option that SmallTalk can use to intercept all
overflows, including unsigned. I added some testcases so we don't
break anything.
Also included is another patch from David for += and friends.
llvm-svn: 68267
- <rdar://problem/6741594> [pth] don't abuse -x to drive pth
generation
- Simpler, and fixes PR3915.
Cleanup test cases for PTH:
- Update to use -emit-pth
- Removed PTH test of carbon.c and cocoa.mm; these didn't actually
verify anything, and since PTH is token based the extra coverage
(over cocoa.m) isn't particularly helpful.
- Split PTH tests in cocoa.m to cocoa-pth.m, solely to increase
available parallelism when running tests.
Ted, could you update the PTH test cases (include-pth.c and
cocoa-pth.m) to have some sort of positive check that the PTH is
getting used? "# of PTH cache hits" or "tokens read from PTH cache"
statistics would work great. :)
llvm-svn: 68189
to generate PTH files. Soon we will remove from clang-cc the GCC-style '-x
c-header' interface for generating PTH files and push this logic to 'clang'.
llvm-svn: 68164
- Rip out various bits of logic from clang-cc's dependency file gen,
force driver to provide instead.
- -MD output now goes to proper location
<rdar://problem/6723948> clang -MD puts dep file in /tmp with wrong name
- -M and -MM still don't work correctly.
llvm-svn: 68022
productions (except the already broken ObjC cases like @class X,Y;) in
the parser that can produce more than one Decl return a DeclGroup instead
of a Decl, etc.
This allows elimination of the Decl::NextDeclarator field, and exposes
various clients that should look at all decls in a group, but which were
only looking at one (such as the dumper, printer, etc). These have been
fixed.
Still TODO:
1) there are some FIXME's in the code about potentially using
DeclGroup for better location info.
2) ParseObjCAtDirectives should return a DeclGroup due to @class etc.
3) I'm not sure what is going on with StmtIterator.cpp, or if it can
be radically simplified now.
4) I put a truly horrible hack in ParseTemplate.cpp.
I plan to bring up #3/4 on the mailing list, but don't plan to tackle
#1/2 in the short term.
llvm-svn: 68002
pointer. Its purpose in life is to be a glorified void*, but which does not
implicitly convert to void* or other OpaquePtr's with a different UID.
Introduce Action::DeclPtrTy which is a typedef for OpaquePtr<0>. Change the
entire parser/sema interface to use DeclPtrTy instead of DeclTy*. This
makes the C++ compiler enforce that these aren't convertible to other opaque
types.
We should also convert ExprTy, StmtTy, TypeTy, AttrTy, BaseTy, etc,
but I don't plan to do that in the short term.
The one outstanding known problem with this patch is that we lose the
bitmangling optimization where ActionResult<DeclPtrTy> doesn't know how to
bitmangle the success bit into the low bit of DeclPtrTy. I will rectify
this with a subsequent patch.
llvm-svn: 67952
- <rdar://problem/6669441> ccc doesn't handle assembler-with-cpp
semantics correctly (but clang supports it)
- This is sad, because it requires a fairly useless target
hook. C'est la vie.
llvm-svn: 67418
diagnostics. This builds on the patch that Sebastian committed and
then revert. Major differences are:
- We don't remove or use the current ".def" files. Instead, for now,
we just make sure that we're building the ".inc" files.
- Fixed CMake makefiles to run TableGen and build the ".inc" files
when needed. Tested with both the Xcode and Makefile generators
provided by CMake, so it should be solid.
- Fixed normal makefiles to handle out-of-source builds that involve
the ".inc" files.
I'll send a separate patch to the list with Sebastian's changes that
eliminate the use of the .def files.
llvm-svn: 67058
- Still need code for determining proper output location.
- Doesn't work yet, of course, as the host isn't providing real
tool chains.
- Interface still has a few warts, but has gotten a nice bit of
polish during the rewrite.
llvm-svn: 67038
- Add Options.def file, collects option information.
- Actual option instantiation is handled lazily by OptTable to allow
the driver to not need to instantiate all options.
- cast<> support for Option, other minor tweaks.
llvm-svn: 66028
- Move all analyzer options logic to AnalysisConsumer.cpp.
- Unified specification of stores/constraints/output to be:
-analyzer-output=...
-analyzer-store=...
-analyzer-constraints=...
instead of -analyzer-range-constraints, -analyzer-store-basic, etc.
- Updated drivers (ccc-analyzer, scan-builds, new ccc) to obey this new
interface
- Updated test cases to conform to new driver options
llvm-svn: 64737
This redoes the default mode that ccc runs in w.r.t. using clang. Now
ccc defaults to always using clang for any task clang can
handle. However, the following options exist to tweak this behavior:
-ccc-no-clang: Don't use clang at all for compilation (still used for
static analysis).
-ccc-no-clang-cxx: Don't use clang for C++ and Objective-C++ inputs.
-ccc-no-clang-cpp: Don't use clang as a preprocessor.
-ccc-clang-archs <archs>: If present, only use clang for the given
comma separated list of architectures. This only works on Darwin for
now.
Note that all -ccc options must be first on the command line.
llvm-svn: 63346
- However, these last ones do not actually work; the issue is that
they translate to batches of options and need to be reparsed. For
now we just give an unsupported error on them.
llvm-svn: 62872
--assert, --classpath).
- Requires providing some option parameters to over-ride rendering in
order to match gcc. There may be a cleaner way to do this (probably
by introducing a new option type for long JoinedOrSeparate forms).
llvm-svn: 62825
- Unlike groups (which gather distinct but related options), aliases
are for options like '--all-warnings' which are effectively treated
like some other option ('-Wall') both in the driver logic and when
passing to tools.
llvm-svn: 62820
- Toolchain is responsible for providing list of prefixes to search.
- Implement -print-file-name=xxx and -print-prog-name=xxx driver options.
llvm-svn: 62659
- For now forces generation of plist files, need to think about the
right interface.
- Changed -fsyntax-only mode to be its own phase (more consistent).
- Add -WA, for passing options verbatim to analyzer.
llvm-svn: 62649
- This is a hack to allow the Darwin linker to get -final_output when
doing universal builds; the mechanism should be generalized.
- Handle multiple redundant -arch arguments correctly.
- Forward -arch_multiple and -final_output to gcc when necessary.
- Simplified implementation of derived gcc tools.
llvm-svn: 62618
- Add Darwin_X86_CC1Tool which is shared by Darwin/x86/Compile and
Darwin/x86/Preprocess tools.
- Minor bug fixes (CmpDriver exit code, -x cpp-output handling, some
linker argument translation).
llvm-svn: 62551
- This doesn't follow normal installation procedure of python
code, but no sense trying too hard since ccc will be moved to
C++.
- Entry point is now tools/ccc.
llvm-svn: 62517
translation.
- As is my general strategy, this is initially pedantically
compatible with gcc and can be cleaned up later. So, for example,
we still pass -static to collect2 4 times if you say '-mkernel
-fapple-kext'. ;)
llvm-svn: 62353
This requires some hackery, as gcc's PCH mechanism changes behavior,
whereas while PTH is simply a cache. Notably:
- Automatically cause clang to load a .pth file if we find one that
matches a command line -include argument (similar to how gcc
looks for .gch files).
- When generating precompiled headers, translate the suffix from .gch
to .pth (so we do not conflict with actual gcc PCH files).
- When generating precompiled headers, copy the input header to the
same location as the output PTH file. This is necessary because gcc
supports -include xxx.h even if xxx.h doesn't exist, but for clang
we need to actually have the contents of this file available.
llvm-svn: 62246
for the Darwin tool chain.
- Ideally we would localize these to tool specific argument
processing but for now this matches gcc closely.
llvm-svn: 62181
- Pulled -Xarch processing into this.
- Get rid of manual creation of forwarding arg array.
- Use Darwin/CC1 instead of generic GCC cc1 on X86.
llvm-svn: 62172
- --gstabs only goes to Darwin/Assembler when dealing with an
assembly file from the command line.
- Relative placement of -o option for cc1 moves depending on
-fsyntax-only/-S, how quaint.
llvm-svn: 62152
- Simple mechanism for group together sets of options so the driver
can efficiently deal with them as a group (i.e., for forwarding -i*
to cc1).
- Use to finish off the major missing pieces of Darwin/CC1 support.
llvm-svn: 62149
- Support comma joined options which magically turn into multiple
value arguments (e.g., -Wl,)
- Split out separate Arg::render routine for when an argument is
being rendered as an input (as opposed to in its original form).
- Add option flag for options which should be rendered without the
option when they are used as an input (e.g., -Xlinker or -o).
- Support -weak-l..., -weak_framework, and -weak_library.
llvm-svn: 62075
- Some things are still hardcoded, and macosx-version-min comparison
isn't implemented, but otherwise this very closely matches gcc.
- The one exception is that arguments (like -framework or -Wl,) which are
treated as linker inputs instead of options are not being
forwarded yet.
llvm-svn: 62059
- Also, fix bug in MultipleValuesOption which was accepting joined
arguments.
- Add ArgList::getArgs, provides iterator over all arg instances for a
given option.
- Option definition is very much in need of cleaning...
llvm-svn: 62054
perform them.
- A ToolChain is a coherent set of tools use in a compilation
process. The idea is that a ToolChain holds roughly the information
(specs, search paths, etc.) that is in a single gcc binary.
- The default ToolChain is selected by the host and will generally
correspond to what the default system compiler would do. However,
this can be over-riden for a variety of purposes, for example the
by the driver driver or for testing.
llvm-svn: 62021
- For use by the driver in places where the host alters driver
behavior (for example, running as a driver driver on darwin).
- Allow user override for testing purposes.
llvm-svn: 61967
"fake" options, allowing Tools to be oblivious to whether an argument
is real or synthetic. This kills off DerivedArg & a number of FIXMEs.
llvm-svn: 61871
- Entry point is tools/ccc/xcc until we are a functional replacement
for ccc.
This is highly experimental (FIXME/LOC ratio of 3.4%), quite crufty,
and barely usable (and then only on my specific Darwin). However, many
of the right ideas are present, and it already fixes a number of
things gcc gets wrong.
The major missing component is argument translation for tools
(translating driver arguments into cc1/ld/as/etc. arguments). This is
a large part of the driver functionality and will probably double the
LOC, but my hope is that the current architecture is relatively
stable.
Documentation & motivation to follow soon...
llvm-svn: 61739
of the details of HTML rendering of form parameters, and also us with the
ability to delegate other actions (such as in the filling in of default values)
to specific parameter objects.
llvm-svn: 56851
Give more meaningful error messages / fail gracefully on bad form
input or SMTP errors.
Use button for Report Bug link (where available).
llvm-svn: 56420
- Update for scan-build table change.
- Add --auto-reload option (for development, avoids need to restart
server).
- Always send Last-Modified, with a reasonable value for dynamic content.
llvm-svn: 56409