summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParsePragma.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert the removal of PPCallbacks::PragmaComment() in r201821Reid Kleckner2014-02-201-0/+9
| | | | | | | | The pp-trace clang tool was using it successfully. We can still delete the callbacks in Frontend/PrintPreprocessedOutput.cpp because they were effectively dead. llvm-svn: 201825
* Expand macros in pragmas with -fms-extensions and -EReid Kleckner2014-02-201-9/+0
| | | | | | | | | | | | | | 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
* Hide pragma handler classes in ParsePragma.cppReid Kleckner2014-02-201-1/+202
| | | | | | | | | | | | | | This reduces the number of files we need to touch to add a new pragma, and reduces the number of externally visible symbols in clang. Make the handlers structs instead of classes because the vast majority have no private members. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D2834 llvm-svn: 201820
* Fix uninitialized read in vtordisp pragma code.Reid Kleckner2014-02-131-3/+3
| | | | llvm-svn: 201280
* MS ABI: Implement #pragma vtordisp() and clang-cl /vdNReid Kleckner2014-02-121-1/+101
| | | | | | | | | | | | | | | | | These features are new in VS 2013 and are necessary in order to layout std::ostream correctly. Currently we have an ABI incompatibility when self-hosting with the 2013 stdlib in our convertible_fwd_ostream wrapper in gtest. This change adds another implicit attribute, MSVtorDispAttr, because implicit attributes are currently the best way to make sure the information stays on class templates through instantiation. Reviewers: majnemer Differential Revision: http://llvm-reviews.chandlerc.com/D2746 llvm-svn: 201274
* MS ABI: Add support for the -vm{b,g,s,m,v} flagsDavid Majnemer2014-02-111-8/+11
| | | | | | | | | These flags control the inheritance model initially used by the translation unit. Differential Revision: http://llvm-reviews.chandlerc.com/D2741 llvm-svn: 201175
* MS ABI: Add support for #pragma pointers_to_membersDavid Majnemer2014-02-101-0/+101
| | | | | | | | | | | | | | | | | | | Introduce a notion of a 'current representation method' for pointers-to-members. When starting out, this is set to 'best case' (representation method is chosen by examining the class, selecting the smallest representation that would work given the class definition or lack thereof). This pragma allows the translation unit to dictate exactly what representation to use, similar to how the inheritance model keywords operate. N.B. PCH support is forthcoming. Differential Revision: http://llvm-reviews.chandlerc.com/D2723 llvm-svn: 201105
* Basic: Clean up malformed pragma diagnosticsDavid Majnemer2014-02-101-1/+1
| | | | | | | Create a new diagnostic, -Wignored-pragmas and use it to handle any case where a pragma would have a side effect but is ignored. llvm-svn: 201102
* Support and use token kinds as diagnostic argumentsAlp Toker2013-12-241-3/+3
| | | | | | | | | | | | | | | | | | | Introduce proper facilities to render token spellings using the diagnostic formatter. Replaces most of the hard-coded diagnostic messages related to expected tokens, which all shared the same semantics but had to be multiply defined due to variations in token order or quote marks. The associated parser changes are largely mechanical but they expose commonality in whole chunks of the parser that can now be factored away. This commit uses C++11 typed enums along with a speculative legacy fallback until the transition is complete. Requires corresponding changes in LLVM r197895. llvm-svn: 197972
* Callback support for OpenCL extension pragmas.Pekka Jaaskelainen2013-10-121-0/+5
| | | | | | Patch from Rami Ylimäki and Mikael Lepistö! llvm-svn: 192531
* Adding support for MSVC #pragma detect_mismatch functionality by emitting a ↵Aaron Ballman2013-06-041-0/+57
| | | | | | FAILIFMISMATCH linker command into the object file. llvm-svn: 183178
* Forward #pragma comment(lib/linker) through as flags metadataReid Kleckner2013-05-081-7/+16
| | | | | | | | | | | | | | | | | | | | | | Summary: Most of this change is wiring the pragma all the way through from the lexer, parser, and sema to codegen. I considered adding a Decl AST node for this, but it seemed too heavyweight. Mach-O already uses a metadata flag called "Linker Options" to do this kind of auto-linking. This change follows that pattern. LLVM knows how to forward the "Linker Options" metadata into the COFF .drectve section where these flags belong. ELF support is not implemented, but possible. This is related to auto-linking, which is http://llvm.org/PR13016. CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D723 llvm-svn: 181426
* Move PragmaCommentHandler to lib/Parse in preparation for calling SemaReid Kleckner2013-05-061-0/+66
| | | | | | | | | | | | | | Summary: No functionality change. The existing tests for this pragma only verify that we can preprocess it. Reviewers: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D751 llvm-svn: 181246
* Move CapturedStmt parameters to CapturedDeclBen Langmuir2013-05-031-1/+2
| | | | | | | | | | | Move the creation of CapturedStmt parameters out of CodeGen and into Sema, making it easier to customize the outlined function. The ImplicitParamDecls are stored in the CapturedDecl using an ASTContext-allocated array. Differential Revision: http://llvm-reviews.chandlerc.com/D722 llvm-svn: 181043
* Small CapturedStmt improvementsBen Langmuir2013-04-291-2/+1
| | | | | | | | | | | | | Add a CapturedStmt.h similar to Lambda.h to reduce the typing required to get to the CapturedRegionKind enum. This also allows codegen to access this enum without including Sema/ScopeInfo.h. Also removes some duplicated code for capturing 'this' between CapturedStmt and Lambda. Differential Revision: http://llvm-reviews.chandlerc.com/D712 llvm-svn: 180710
* Sema for Captured StatementsTareq A. Siraj2013-04-161-1/+16
| | | | | | | | | | | | | 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/+15
| | | | | | | | | | | | | | | 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
* OpenMP threadprivate directive parsing and semantic analysisAlexey Bataev2013-03-221-0/+44
| | | | llvm-svn: 177705
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-1/+1
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Permanently end the whole "pragma got handled by the parser too early"Eli Friedman2012-10-041-48/+200
| | | | | | | mess by handling all pragmas which the parser touches uniformly. <rdar://problem/12248901>, etc. llvm-svn: 165195
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-2/+2
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Parse: Change PragmaPackHandler to use the preprocessor allocator.Daniel Dunbar2012-02-291-7/+16
| | | | llvm-svn: 151689
* Handle "#pragma GCC visibility" in a few more places. Switch over "#pragma ↵Eli Friedman2012-02-231-2/+32
| | | | | | | | pack" to use the same handling that gcc does. Fixes <rdar://problem/10871094> and <rdar://problem/10893316>. (Hopefully, common usage of these pragmas isn't irregular enough to break our current handling. Doug has ideas for a more crazy approach if necessary.) llvm-svn: 151307
* Implement #pragma redefine_extname.David Chisnall2012-02-181-0/+38
| | | | | | This fixes PR5172 and allows clang to compile C++ programs on Solaris using the system headers. llvm-svn: 150881
* Fix our handling of #pragma GCC visibility.Rafael Espindola2012-01-261-1/+16
| | | | | | | | | | Now the lexer just produces a token and the parser is the one responsible for activating it. This fixes problem like the one pr11797 where the lexer and the parser were not in sync. This also let us be more strict on where in the file we accept these pragmas. llvm-svn: 149014
* Remove redundant argument.Rafael Espindola2012-01-211-4/+1
| | | | llvm-svn: 148628
* Add an option to emulate the strange Apple gcc behavior of #pragma pack.Eli Friedman2011-11-021-0/+11
| | | | | | <rdar://problem/10374763> llvm-svn: 143527
* OpenCL: disallow '#pragma OPENCL EXTENSION all : enable', per OpenCL 1.1 9.1Peter Collingbourne2011-10-061-2/+5
| | | | llvm-svn: 141270
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-1/+1
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* PR10392: "#pragma GCC visibility" must not expand macros in itsJoerg Sonnenberger2011-07-201-5/+5
| | | | | | arguments. llvm-svn: 135552
* Remove unused but set variable.Benjamin Kramer2011-05-031-1/+0
| | | | llvm-svn: 130776
* Recognize gcc's ms_struct pragma (and ignore for now).Fariborz Jahanian2011-04-251-0/+32
| | | | | | This is wip. llvm-svn: 130138
* Do not expand the opencl pragma names. This is so you can also have a define ↵Tanya Lattner2011-04-141-1/+1
| | | | | | named the samed as the pragma and they do not interfere (ie. cl_khr_fp64). llvm-svn: 129549
* Rename tok::eom to tok::eod.Peter Collingbourne2011-02-281-5/+5
| | | | | | | | The previous name was inaccurate as this token in fact appears at the end of every preprocessing directive, not just macro definitions. No functionality change, except for a diagnostic tweak. llvm-svn: 126631
* OpenCL: add support for __kernel, kernel keywords and EXTENSION,Peter Collingbourne2011-02-141-0/+50
| | | | | | FP_CONTRACT pragmas. Patch originally by ARM. llvm-svn: 125475
* Move support for "#pragma STDC FP_CONTRACT" to Parser; add Sema actionsPeter Collingbourne2011-02-141-0/+11
| | | | llvm-svn: 125474
* Convert "#pragma unused(...)" into tokens for the parser.Argyrios Kyrtzidis2011-01-171-3/+25
| | | | | | | This allows us to cache a "#pragma unused" that occurs inside an inline C++ member function. Fixes rdar://8829590&8770988. llvm-svn: 123666
* When we parse a pragma, keep track of how that pragma was originallyDouglas Gregor2010-09-091-6/+18
| | | | | | | | spelled (#pragma, _Pragma, __pragma). In -E mode, use that information to add appropriate newlines when translating _Pragma and __pragma into #pragma, like GCC does. Fixes <rdar://problem/8412013>. llvm-svn: 113553
* One who seeks knowledge learns something new every day.John McCall2010-08-261-13/+12
| | | | | | | | | One who seeks the Tao unlearns something new every day. Less and less remains until you arrive at non-action. When you arrive at non-action, nothing will be left undone. llvm-svn: 112244
* OwningExprResult -> ExprResult. This patch brought to you byJohn McCall2010-08-241-1/+1
| | | | | | | M-x query-replace-regexp \(Sema::\|Action::\|Parser::\|\)Owning\(Expr\|Stmt\)Result -> \2Result llvm-svn: 111903
* Sundry incremental steps towards killing off Action.John McCall2010-08-231-1/+1
| | | | llvm-svn: 111795
* Another step in the process of making the parser depend on Sema:John McCall2010-08-201-2/+2
| | | | | | | | | - move DeclSpec &c into the Sema library - move ParseAST into the Parse library Reflect this change in a thousand different includes. Reflect this change in the link orders. llvm-svn: 111667
* Implement #pragma GCC visibility.Eli Friedman2010-08-051-0/+53
| | | | llvm-svn: 110315
* Parser: Add support for #pragma align, which is just another spelling of #pragmaDaniel Dunbar2010-07-311-13/+27
| | | | | | options align. llvm-svn: 109952
* Move the "current scope" state from the Parser into Action. ThisDouglas Gregor2010-07-021-1/+1
| | | | | | | | | | | | | | allows Sema some limited access to the current scope, which we only use in one way: when Sema is performing some kind of declaration that is not directly driven by the parser (e.g., due to template instantiatio or lazy declaration of a member), we can find the Scope associated with a DeclContext, if that DeclContext is still in the process of being parsed. Use this to make the implicit declaration of special member functions in a C++ class more "scope-less", rather than using the NULL Scope hack. llvm-svn: 107491
* Parse/Sema: Add support for '#pragma options align=packed', which, it should beDaniel Dunbar2010-05-271-0/+2
| | | | | | noted, is not the same as __attribute__((packed)). That would be ridiculous! llvm-svn: 104865
* Parse/Sema: Add support for '#pragma options align=native'.Daniel Dunbar2010-05-271-3/+5
| | | | llvm-svn: 104864
* Parse: Add support for '#pragma options align'.Daniel Dunbar2010-05-261-2/+51
| | | | | | Also, fix a source location bug with the rparen in #pragma pack. llvm-svn: 104784
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-17/+17
| | | | llvm-svn: 81346
* Per advice that Doug Gregor gave me several months ago, clean up theTed Kremenek2009-08-031-25/+8
| | | | | | | | | | | | | implementation of '#pragma unused' by not constructing intermediate DeclRefExprs, but instead do the name lookup directly. The implementation is greatly simplified. Along the way, degrade '#pragma unused(undeclaredvariable)' to a warning instead of being a hard error. This implements: <rdar://problem/6761874> [sema] allow #pragma unused to reference undefined variable (with warning) llvm-svn: 78019
OpenPOWER on IntegriCloud