summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/PrintPreprocessedOutput.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Preprocessor] Support for '-dI' flagBruno Cardoso Lopes2016-11-171-8/+26
| | | | | | | | | | | | | | | | | Re-introduce r285411. Implement the -dI as supported by GCC: Output ‘#include’ directives in addition to the result of preprocessing. This change aims to add this option, pass it through to the preprocessor via the options class, and when inclusions occur we output some information (+ test cases). Patch by Steve O'Brien! Differential Revision: https://reviews.llvm.org/D26089 llvm-svn: 287275
* Revert "[Preprocessor] Support for '-dI' flag"Bruno Cardoso Lopes2016-10-281-26/+8
| | | | | | | This reverts r285411. Tests failing on http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/141 llvm-svn: 285416
* [Preprocessor] Support for '-dI' flagBruno Cardoso Lopes2016-10-281-8/+26
| | | | | | | | | | | | | | | Implement the -dI as supported by GCC: Output ‘#include’ directives in addition to the result of preprocessing. This change aims to add this option, pass it through to the preprocessor via the options class, and when inclusions occur we output some information (+ test cases). Patch by Steve O'Brien! Differential Revision: https://reviews.llvm.org/D25153 llvm-svn: 285411
* [modules] Add a comment to explain why -E leaves some #includes in the ↵Richard Smith2016-04-081-1/+3
| | | | | | preprocessed output. llvm-svn: 265766
* [modules] Don't write @import in -E output if the current language mode doesn'tRichard Smith2016-04-081-2/+12
| | | | | | support @import; use the form as written instead. llvm-svn: 265756
* Remove use of builtin comma operator.Richard Trieu2016-02-181-2/+4
| | | | | | Cleanup for upcoming Clang warning -Wcomma. No functionality change intended. llvm-svn: 261271
* Reduce the number of implicit StringRef->std::string conversions by ↵Benjamin Kramer2016-02-131-12/+10
| | | | | | | | threading StringRef through more APIs. No functionality change intended. llvm-svn: 260815
* Simplify EnterTokenStream API to make it more robust for memory managementDavid Blaikie2016-02-091-4/+3
| | | | | | | | | | | | | | | While this won't help fix things like the bug that r260219 addressed, it seems like good tidy up to have anyway. (it might be nice if "makeArrayRef" always produced a MutableArrayRef & let it decay to an ArrayRef when needed - then I'd use that for the MutableArrayRefs in this patch) If we had std::dynarray I'd use that instead of unique_ptr+size_t, ideally (but then it'd have to be threaded down through the Preprocessor all the way - no idea how painful that would be) llvm-svn: 260246
* Fix possible OOB access found by buildbotAlexey Bataev2016-02-091-7/+8
| | | | llvm-svn: 260219
* Fixed preprocessed output of the first token for pragmas.Alexey Bataev2016-02-091-0/+9
| | | | | | | Clang did not expanded macros in the very first token of the pragmas during preprocessed output llvm-svn: 260211
* According to the OpenMP spec, all the preprocessor macros should be Samuel Antao2015-06-151-10/+42
| | | | | | expanded in OpenMP pragmas. This patch adds support for that in -E. llvm-svn: 239784
* Replace a few std::string& with StringRef. NFC.Rafael Espindola2015-06-011-3/+3
| | | | | | Patch by Косов Евгений! llvm-svn: 238774
* Refactor MacroInfo so range for loops can be used to iterate its tokens.Daniel Marjamaki2015-05-111-4/+3
| | | | | | Differential Revision: http://reviews.llvm.org/D9079 llvm-svn: 236975
* Switch PPCallbacks to take the new MacroDefinition instead of ↵Richard Smith2015-05-041-2/+2
| | | | | | MacroDirective*, in order to preserve full information on module macro expansion. llvm-svn: 236404
* [modules] Stop trying to fake up a linear MacroDirective history.Richard Smith2015-04-291-3/+3
| | | | | | | | | | | | | | Modules builds fundamentally have a non-linear macro history. In the interest of better source fidelity, represent the macro definition information faithfully: we have a linear macro directive history within each module, and at any point we have a unique "latest" local macro directive and a collection of visible imported directives. This also removes the attendent complexity of attempting to create a correct MacroDirective history (which we got wrong in the general case). No functionality change intended. llvm-svn: 236176
* [modules] Determine the set of macros exported by a submodule at the end of ↵Richard Smith2015-04-231-1/+2
| | | | | | | | | | | that submodule. Previously we'd defer this determination until writing the AST, which doesn't allow us to use this information when building other submodules of the same module. This change also allows us to use a uniform mechanism for writing module macro records, independent of whether they are local or imported. llvm-svn: 235614
* Add -fuse-line-directive flag to control usage of #line with -EReid Kleckner2015-02-261-13/+9
| | | | | | | | | | | | | | | | | | Currently -fms-extensions controls this behavior, which doesn't make much sense. It means we can't identify what is and isn't a system header when compiling our own preprocessed output, because #line doesn't represent this information. If someone is feeding Clang's preprocessed output to another compiler, they can use this flag. Fixes PR20553. Reviewers: rsmith Differential Revision: http://reviews.llvm.org/D5217 llvm-svn: 230587
* Avoid a couple of assertions when preprocessing with modulesBen Langmuir2014-09-101-0/+3
| | | | | | | | | | | | | | | | 1. We were hitting the NextIsPrevious assertion because we were trying to merge decl chains that were independent of each other because we had no Sema object to allow them to find existing decls. This is fixed by delaying loading the "preloaded" decls until Sema is available. 2. We were trying to get identifier info from an annotation token, which asserts. The fix is to special-case the module annotations in the preprocessed output printer. Fixed in a single commit because when you hit 1 you almost invariably hit 2 as well. llvm-svn: 217550
* Unique_ptrify PPCallbacks ownership.Craig Topper2014-09-101-1/+1
| | | | | | Unique_ptr creation stil needs to be moved earlier at some of the call sites. llvm-svn: 217474
* Complete the switch from mappings to declarative diagnostic severitiesAlp Toker2014-06-121-5/+5
| | | | | | | | | This begins to address cognitive dissonance caused by treating the Note diagnostic level as a severity in the diagnostic engine. No change in functionality. llvm-svn: 210758
* Improve diagnostic mapping terminologyAlp Toker2014-06-101-4/+5
| | | | | | | | | | | | Diagnostic mappings are used to calculate the final severity of diagnostic instances. Detangle the implementation to reflect the terminology used in documentation and bindings. No change in functionality. llvm-svn: 210518
* [C++11] Use 'nullptr'. Frontend edition.Craig Topper2014-05-221-2/+3
| | | | llvm-svn: 209389
* do not warn about unknown pragmas in modes that do not handle them (pr9537)Lubos Lunak2014-05-011-1/+1
| | | | | | | And refactor to have just one place in code that sets up the empty pragma handlers. llvm-svn: 207758
* Remove unreachable PragmaCaptured method. It's not a real PPCallback.Craig Topper2014-03-131-10/+0
| | | | llvm-svn: 203759
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-131-31/+27
| | | | | | class. llvm-svn: 203758
* [C++11] Revert uses of lambdas with array_pod_sort.Benjamin Kramer2014-03-071-5/+6
| | | | | | Looks like GCC implements the lambda->function pointer conversion differently. llvm-svn: 203293
* [C++11] Convert sort predicates into lambdas.Benjamin Kramer2014-03-071-6/+5
| | | | | | No functionality change. llvm-svn: 203289
* Add 'remark' diagnostic type in 'clang'Tobias Grosser2014-02-281-0/+3
| | | | | | | | | | | | | | | | | | | | | | | A 'remark' is information that is not an error or a warning, but rather some additional information provided to the user. In contrast to a 'note' a 'remark' is an independent diagnostic, whereas a 'note' always depends on another diagnostic. A typical use case for remark nodes is information provided to the user, e.g. information provided by the vectorizer about loops that have been vectorized. This patch provides the initial implementation of 'remarks'. It includes the actual definiton of the remark nodes, their printing as well as basic parameter handling. We are reusing the existing diagnostic parameters which means a remark can be enabled with normal '-Wdiagnostic-name' flags and can be upgraded to an error using '-Werror=diagnostic-name'. '-Werror' alone does not upgrade remarks. This patch is by intention minimal in terms of parameter handling. More experience and more discussions will most likely lead to further enhancements in the parameter handling. llvm-svn: 202475
* If preprocessing results in a token with leading whitespace that was expandedRichard Smith2014-02-241-0/+7
| | | | | | | from a macro in column 0, ensure that we print whitespace before it in the -E output. Patch by Harald van Dijk! llvm-svn: 202070
* Expand macros in pragmas with -fms-extensions and -EReid Kleckner2014-02-201-36/+7
| | | | | | | | | | | | | | gcc never expands macros in pragmas and MSVC always expands macros before processing pragmas. Clang usually allows macro expansion, except in a handful of pragmas, most of which are handled by the lexer. Also remove PPCallbacks for pragmas that are currently handled in the parser. Without a Parser, such as with clang -E, these callbacks would never be called. Fixes PR18576. llvm-svn: 201821
* Revert "Fix assertion failures on annot_* tokens in clang -E"Ben Langmuir2014-01-301-4/+5
| | | | | | | This is causing a failure in the msan buildbot that I am having trouble reproducing. Reverting until I can figure out what went wrong. llvm-svn: 200492
* Fix assertion failures on annot_* tokens in clang -EBen Langmuir2014-01-301-5/+4
| | | | | | | In particular, #pragma clang __debug, and #include implicitly changed into @import were causing assertion failures. llvm-svn: 200475
* Revert r196372, "do not warn about unknown pragmas in modes that do not ↵NAKAMURA Takumi2013-12-041-1/+1
| | | | | | | | handle them (pr9537)" It broke clang tests on some hosts with +Asserts. Seems "STDC" clashes. llvm-svn: 196376
* do not warn about unknown pragmas in modes that do not handle them (pr9537)Lubos Lunak2013-12-041-1/+1
| | | | | | | And refactor to have just one place in code that sets up the empty pragma handlers. llvm-svn: 196372
* Generate a marker token when entering or leaving a submodule when building aRichard Smith2013-11-231-1/+3
| | | | | | | | | module. Use the marker to diagnose cases where we try to transition between submodules when not at the top level (most likely because a closing brace was missing at the end of a header file, but is also possible if submodule headers attempt to do something fundamentally non-modular, like our .def files). llvm-svn: 195543
* When we hit a #include directive that maps to a module import, emit a tokenRichard Smith2013-11-151-0/+5
| | | | | | | | | | | | representing the module import rather than making the module immediately visible. This serves two goals: * It avoids making declarations in the module visible prematurely, if we walk past the #include during a tentative parse, for instance, and * It gives a diagnostic (although, admittedly, not a very nice one) if a header with a corresponding module is included anywhere other than at the top level. llvm-svn: 194782
* Accept #pragma warning(push, 0) without warningReid Kleckner2013-10-021-1/+1
| | | | | | | | This partially addresses PR17435, but it doesn't actually implement the pragma. If we implement it, we should map levels 1-4 to something like -Wall and level 0 to something like -w. llvm-svn: 191833
* Fix array_pod_sort predicates after LLVM change.Benjamin Kramer2013-09-221-3/+1
| | | | llvm-svn: 191176
* Lex and ignore Microsoft's #pragma warning(...)Reid Kleckner2013-09-131-0/+34
| | | | | | | | | | | | | | | | | Summary: This fixes PR17145 and avoids unknown pragma warnings. This change does not attempt to map MSVC warning numbers to clang warning flags. Perhaps in the future we will implement a mapping for some common subset of Microsoft warnings, but for now we don't. Reviewers: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1652 llvm-svn: 190726
* Properly escape filenames in line directives.Eli Friedman2013-08-291-3/+2
| | | | | | | Fixes PR17018. Only partial test coverage because I don't want to try to write a test which generates a file whose name contains a newline. llvm-svn: 189557
* Adding support for MSVC #pragma detect_mismatch functionality by emitting a ↵Aaron Ballman2013-06-041-19/+30
| | | | | | FAILIFMISMATCH linker command into the object file. llvm-svn: 183178
* When emitting a preprocessed file with implicit module imports, make sure ↵Argyrios Kyrtzidis2013-04-291-0/+1
| | | | | | | | line directives are emitted in the next line. rdar://13722737 llvm-svn: 180718
* Keep the parentheses in #pragma message (partial revert of r179771).Andy Gibbs2013-04-191-1/+3
| | | | llvm-svn: 179862
* Dropped the parentheses for #pragma message and its kin in the -E output ↵Andy Gibbs2013-04-181-5/+3
| | | | | | | | generator. This was a suggestion by Jordan Rose since the documented format for these pragmas is without the parentheses. At the same time, I've increased test coverage too for the preprocessed output. llvm-svn: 179771
* Fix off-by-one error in #pragma clang system_header.Jordan Rose2013-04-171-5/+6
| | | | | | | | | | | The system_header pragma (from GCC) is implemented using line notes in the source manager. However, a line note's line number specifies the number not for the current line, but for the next line. This was making all line numbers appear off by one after the pragma. Reported by Andy Gibbs, uncovered during r179677. llvm-svn: 179709
* Implemented #pragma GCC warning/error in the same mould as #pragma message.Andy Gibbs2013-04-171-4/+18
| | | | llvm-svn: 179687
* Sema for Captured StatementsTareq A. Siraj2013-04-161-0/+10
| | | | | | | | | | | | | Add CapturedDecl to be the DeclContext for CapturedStmt, and perform semantic analysis. Currently captures all variables by reference. TODO: templates Author: Ben Langmuir <ben.langmuir@intel.com> Differential Revision: http://llvm-reviews.chandlerc.com/D433 llvm-svn: 179618
* Parser support for #pragma clang __debug capturedTareq A. Siraj2013-04-161-0/+12
| | | | | | | | | | | | | | | This patch implements parsing ‘#pragma clang __debug’ as a first step for implementing captured statements. Captured statements are a mechanism for doing outlining in the AST. see http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-January/027540.html. Currently returns StmtEmpty Author: Andy Zhang <andy.zhang@intel.com> Differential Revision: http://llvm-reviews.chandlerc.com/D369 llvm-svn: 179614
* [frontend] When preprocessing, turn implicit module imports into @imports.Argyrios Kyrtzidis2013-04-101-0/+29
| | | | | | part of rdar://13610250 llvm-svn: 179144
* [Preprocessor/Modules] Separate the macro directives kinds into their own ↵Argyrios Kyrtzidis2013-03-261-2/+2
| | | | | | | | | | | | | | | | MacroDirective's subclasses. For each macro directive (define, undefine, visibility) have a separate object that gets chained to the macro directive history. This has several benefits: -No need to mutate a MacroDirective when there is a undefine/visibility directive. Stuff like PPMutationListener become unnecessary. -No need to keep extra source locations for the undef/visibility locations for the define directive object (which is the majority of the directives) -Much easier to hide/unhide a section in the macro directive history. -Easier to track the effects of the directives across different submodules. llvm-svn: 178037
OpenPOWER on IntegriCloud