aboutsummaryrefslogtreecommitdiff
path: root/test/Modules
AgeCommit message (Collapse)Author
2012-11-07When loading a module fails because it is out of date, rebuild thatDouglas Gregor
module in place. <rdar://problem/10138913> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167539 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-06Introduce inferred framework modules into the module map file,Douglas Gregor
allowing a module map to be placed one level above the '.framework' directories to specify that all .frameworks within that directory can be inferred as framework modules. One can also specifically exclude frameworks known not to work. This makes explicit (and more restricted) behavior modules have had "forever", where *any* .framework was assumed to be able to be built as a module. That's not necessarily true, so we white-list directories (with exclusions) when those directories have been audited. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167482 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-05Have the parser initialize Sema before it consumes the firstDouglas Gregor
token. This is important because the first token could actually be after an #include that triggers a module import, which might use either Sema or the AST consumer before it would have been initialized. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167423 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-05Make cpuid.h actually work with -std=c99 <rdar://problem/12552716>.Douglas Gregor
While we're here, extend the module map to cover most of the newly-added instrinsic headers. Only wmmintrin.h is missing, because it needs to be split into AES/PCLMUL subheaders (as a separate commit). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167398 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-25Correct test inovocations to use %clang_cc1 rather than direct invocation ↵David Tweed
(so that it can have additional options set when trying to debug issues causing regressions). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166681 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-19Prior to adding the new "expected-no-diagnostics" directive to ↵Andy Gibbs
VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166280 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-15Introduce the notion of excluded headers into the module mapDouglas Gregor
description. Previously, one could emulate this behavior by placing the header in an always-unavailable submodule, but Argyrios guilted me into expressing this idea properly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165921 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-12Add missing header from 165821Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165822 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-12Sanitize the names of modules determined based on the names of headersDouglas Gregor
or directories, to make sure that they are identifiers that are not keywords in any dialect. Fixes <rdar://problem/12489495>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165821 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-12Track which particular submodule #undef's a macro, so that the actualDouglas Gregor
#undef only occurs if that submodule is imported. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165773 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-11Diagnose the expansion of ambiguous macro definitions. This can happenDouglas Gregor
only with modules, when two disjoint modules #define the same identifier to different token sequences. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165746 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-11Deserialize macro history when we deserialize an identifier that hasDouglas Gregor
macro history. When deserializing macro history, we arrange history such that the macros that have definitions (that haven't been #undef'd) and are visible come at the beginning of the list, which is what the preprocessor and other clients of Preprocessor::getMacroInfo() expect. If additional macro definitions become visible later, they'll be moved toward the front of the list. Note that it's possible to have ambiguities, but we don't diagnose them yet. There is a partially-implemented design decision here that, if a particular identifier has been defined or #undef'd within the translation unit, that definition (or #undef) hides any macro definitions that come from imported modules. There's still a little work to do to ensure that the right #undef'ing happens. Additionally, we'll need to scope the update records for #undefs, so they only kick in when the submodule containing that update record becomes visible. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165682 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-09Rework the (de-)serialization of macros, as stored inDouglas Gregor
MacroInfo*. Instead of simply dumping an offset into the current file, give each macro definition a proper ID with all of the standard modules-remapping facilities. Additionally, when a macro is modified in a subsequent AST file (e.g., #undef'ing a macro loaded from another module or from a precompiled header), provide a macro update record rather than rewriting the entire macro definition. This gives us greater consistency with the way we handle declarations, and ties together macro definitions much more cleanly. Note that we're still not actually deserializing macro history (we never were), but it's far easy to do properly now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165560 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-09When we load a function or method body from an AST file, we checkDouglas Gregor
whether that function/method already has a body (loaded from some other AST file), as introduced in r165137. Delay this check until after the redeclaration chains have been wired up. While I'm here, make the loading of method bodies lazy. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165513 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-02Add redecls into their lexical DeclContext: this is what they assert on, and ↵Axel Naumann
the merging should have set it correctly. This is especially relevant for templatedDecls that might be injected (and thus have their DeclContext set to) somewhere completely different. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165005 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-02Only those InterestingDecls that got added to the AST should be passed to ↵Axel Naumann
the ASTConsumer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165001 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-02Merge pending instantiations instead of overwriting existing ones.Axel Naumann
Check whether a pending instantiation needs to be instantiated (or whether an instantiation already exists). Verify the size of the PendingInstantiations record (was only checking size of existing PendingInstantiations). Migrate Obj-C++ part of redecl-merge into separate test, now that this is growing. templates.mm: test that CodeGen has seen exactly one definition of template instantiations. redecl-merge.m: use "@" specifier for expected-diagnostics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164993 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-01The Redeclarable part of named decls is read before their name.Axel Naumann
Lookup can nevertheless find them due to the serialized lookup table. For instance when reading a template decl's templatedDecl, it will search for existing decls that it could be a redeclaration of, and find the half-read template decl. Thus there is no point in asserting the names of decls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164932 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-01Also merge template redeclarations.Axel Naumann
Don't require specializations (of existing and read template) to be unique. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164931 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-01Bring ASTReader and Writer into sync for the case where a canonical template ↵Axel Naumann
specialization was written, which is non-canonical at the time of reading: force the reading of the ClassTemplateDecl if it was written. The easiest way out is to store whether the decl was canonical at the time of writing. Add test. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164927 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-25Introduce builtin macros to determine whether we're building aDouglas Gregor
specific module (__building_module(modulename)) and to get the name of the current module as an identifier (__MODULE__). Used to help headers behave differently when they're being included as part of building a module. Oh, the irony. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164605 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-23When disambiguating an expression-statement from a declaraton-statement, if theRichard Smith
statement starts with an identifier for which name lookup will fail either way, look at later tokens to disambiguate in order to improve error recovery. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162464 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10Update VerifyDiagnosticConsumer to only get directives during parsing.Jordan Rose
The old behavior was to re-scan any files (like modules) where we may have directives but won't actually be parsing during the -verify invocation. Now, we keep the old behavior in Debug builds as a sanity check (though modules are a known entity), and expect all legitimate directives to come from comments seen by the preprocessor. This also affects the ARC migration tool, which captures diagnostics in order to filter some out. This change adds an explicit cleanup to CaptureDiagnosticsConsumer in order to let its sub-consumer handle the real end of diagnostics. This was originally split into four patches, but the tests do not run cleanly without all four, so I've combined them into one commit. Patches by Andy Gibbs, with slight modifications from me. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161650 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-23Fix a typo (the the => the)Sylvestre Ledru
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160622 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-11Allow -verify directives to be filtered by preprocessing.Jordan Rose
This is accomplished by making VerifyDiagnosticsConsumer a CommentHandler, which then only reads the -verify directives that are actually in live blocks of code. It also makes it simpler to handle -verify directives that appear in header files, though we still have to manually reparse some files depending on how they are generated. This requires some test changes. In particular, all PCH tests now have their -verify directives outside the "header" portion of the file, using the @line syntax added in r159978. Other tests have been modified mostly to make it clear what is being tested, and to prevent polluting the expected output with the directives themselves. Patch by Andy Gibbs! (with slight modifications) The new Frontend/verify-* tests exercise the functionality of this commit, as well as r159978, r159979, and r160053 (Andy's other -verify enhancements). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160068 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-16Fix ASTReader handling of ImportDecls, from Meador Inge!Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156923 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-12There's some code in the PCH reader that looks like it's needlessly complex, butNick Lewycky
turns out that it's actually needed for C++ modules support. Since simplifying it didn't cause any test failures, I'll add a test for it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154582 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-06Added a new attribute, objc_root_class, which informs the compiler when a ↵Patrick Beard
root class is intentionally declared. The warning this inhibits, -Wobjc-root-class, is opt-in for now. However, all clang unit tests that would trigger the warning have been updated to use -Wno-objc-root-class. <rdar://problem/7446698> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154187 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13Fix PR10447: lazily building name lookup tables for DeclContexts was broken.Richard Smith
The deferred lookup table building step couldn't accurately tell which Decls should be included in the lookup table, and consequently built different tables in some cases. Fix this by removing lazy building of DeclContext name lookup tables. In practice, the laziness was frequently not worthwhile in C++, because we performed lookup into most DeclContexts. In C, it had a bit more value, since there is no qualified lookup. In the place of lazy lookup table building, we simply don't build lookup tables for function DeclContexts at all. Such name lookup tables are not useful, since they don't capture the scoping information required to correctly perform name lookup in a function scope. The resulting performance delta is within the noise on my testing, but appears to be a very slight win for C++ and a very slight loss for C. The C performance can probably be recovered (if it is a measurable problem) by avoiding building the lookup table for the translation unit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152608 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01Change @import to @__experimental_modules_import. We are not ready to ↵Ted Kremenek
commit to a particular syntax for modules, and don't have time to push it forward in the near future. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151841 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-02Use -isystem rather than relying on -isysroot to work consistentlyDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149626 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-02Yet more data from failing buildbots...Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149624 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-02Drop -verify to get better diagnostics from failing buildbots. Plus, we ↵Douglas Gregor
don't need it here git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149613 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-02Back out my heinous hack that tricked the module generation mechanismDouglas Gregor
into using non-absolute system includes (<foo>)... ... and introduce another hack that is simultaneously more heineous and more effective. We whitelist Clang-supplied headers that augment or override system headers (such as float.h, stdarg.h, and tgmath.h). For these headers, Clang does not provide a module mapping. Instead, a system-supplied module map can refer to these headers in a system module, and Clang will look both in its own include directory and wherever the system-supplied module map suggests, then adds either or both headers. The end result is that Clang-supplied headers get merged into the system-supplied module for the C standard library. As a drive-by, fix up a few dependencies in the _Builtin_instrinsics module. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149611 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-01test/Modules/compiler_builtins.m: Appease Cygwin to add -D__need_wint_t.NAKAMURA Takumi
On Cygwin, at first, <stddef.h> is included without __need_wint_t. Next, <stddef.h> is included with __need_wint_t, though Modules feature would not process <stddef.h> twice. Then, wint_t is not found in system headers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149500 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-01test/Modules/compiler_builtins.m: Mark this as XFAIL:win32. MS limits.h ↵NAKAMURA Takumi
provides size_t. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149499 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-31Split compiler builtin module into "stdlib" builtins and "intrinsic"Douglas Gregor
builds, and bring mm_alloc.h into the fold. Start playing some tricks with these builtin modules to mirror the include_next tricks that the headers already perform. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149434 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-30Remove tgmath.h from the module map for now, because it currently causes aDouglas Gregor
cyclic module dependency due to its inclusion of math.h and complex.h. I'll take another shot at it later. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149283 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-30Introduce TargetInfo::hasFeature() to query various feature names inDouglas Gregor
each of the targets. Use this for module requirements, so that we can pin the availability of certain modules to certain target features, e.g., provide a module for xmmintrin.h only when SSE support is available. Use these feature names to provide a nearly-complete module map for Clang's built-in headers. Only mm_alloc.h and unwind.h are missing, and those two are fairly specialized at the moment. Finishes <rdar://problem/10710060>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149227 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-29Just disable the compiler-builtins module test on MSVC for nowDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149214 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-29Teach tgmath.h to only include <complex.h> if it's available.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149213 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-29Try to get useful diagnostics out of the failing MSVC buildersDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149212 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-29Alternate fix to the modules failures that doesn't require us to tweak tgmath.hDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149210 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-29If there's no math.h, then tgmath.h should just be emptyDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149209 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-29Temporary disable the -verify on this test in the hope of getting some ↵Douglas Gregor
useful output from the buildbots git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149208 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-29Introduce a module map for (some of) the compiler-suppliedDouglas Gregor
headers. The remaining headers require more sophisticated requirements; they'll be handled separately. Part of <rdar://problem/10710060>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149206 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-29Test module lookup within a subdirectory of a normal include directory.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149196 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-27Introduce module attributes into the module map grammar, along with aDouglas Gregor
single attribute ("system") that allows us to mark a module as being a "system" module. Each of the headers that makes up a system module is considered to be a system header, so that we (for example) suppress warnings there. If a module is being inferred for a framework, and that framework directory is within a system frameworks directory, infer it as a system framework. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149143 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-27Reimplement (de-)serialization of Objective-C categories to eliminateDouglas Gregor
the direct serialization of the linked-list structure. Instead, use a scheme similar to how we handle redeclarations, with redeclaration lists on the side. This addresses several issues: - In cases involving mixing and matching of many categories across many modules, the linked-list structure would not be consistent across different modules, and categories would get lost. - If a module is loaded after the class definition and its other categories have already been loaded, we wouldn't see any categories in the newly-loaded module. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149112 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-25Whenever Sema attempts to look in the global method pool, try to loadDouglas Gregor
additional data from the external Sema source. This properly copes with modules that are imported after we have already searched in the global method pool for a given selector. For PCH, it's a slight pessimization to be fixed soon. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148891 91177308-0d34-0410-b5e6-96231b3b80d8