diff options
author | dim <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
commit | 39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df (patch) | |
tree | a9243275843fbeaa590afc07ee888e006b8d54ea /include/clang/Lex/LiteralSupport.h | |
parent | 69b4eca4a4255ba43baa5c1d9bbdec3ec17f479e (diff) | |
download | FreeBSD-src-39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df.zip FreeBSD-src-39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df.tar.gz |
Vendor import of clang trunk r126079:
http://llvm.org/svn/llvm-project/cfe/trunk@126079
Diffstat (limited to 'include/clang/Lex/LiteralSupport.h')
-rw-r--r-- | include/clang/Lex/LiteralSupport.h | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/include/clang/Lex/LiteralSupport.h b/include/clang/Lex/LiteralSupport.h index ba46fb1..bf2c06b 100644 --- a/include/clang/Lex/LiteralSupport.h +++ b/include/clang/Lex/LiteralSupport.h @@ -15,10 +15,11 @@ #ifndef CLANG_LITERALSUPPORT_H #define CLANG_LITERALSUPPORT_H -#include <string> #include "llvm/ADT/APFloat.h" #include "llvm/ADT/SmallString.h" -#include "llvm/System/DataTypes.h" +#include "llvm/Support/DataTypes.h" +#include <cctype> +#include <string> namespace clang { @@ -27,6 +28,8 @@ class Preprocessor; class Token; class SourceLocation; class TargetInfo; +class SourceManager; +class LangOptions; /// NumericLiteralParser - This performs strict semantic analysis of the content /// of a ppnumber, classifying it as either integer, floating, or erroneous, @@ -138,8 +141,11 @@ public: /// wide string analysis and Translation Phase #6 (concatenation of string /// literals) (C99 5.1.1.2p1). class StringLiteralParser { - Preprocessor &PP; - + const SourceManager &SM; + const LangOptions &Features; + const TargetInfo &Target; + Diagnostic *Diags; + unsigned MaxTokenLength; unsigned SizeBound; unsigned wchar_tByteWidth; @@ -148,6 +154,14 @@ class StringLiteralParser { public: StringLiteralParser(const Token *StringToks, unsigned NumStringToks, Preprocessor &PP, bool Complain = true); + StringLiteralParser(const Token *StringToks, unsigned NumStringToks, + const SourceManager &sm, const LangOptions &features, + const TargetInfo &target, Diagnostic *diags = 0) + : SM(sm), Features(features), Target(target), Diags(diags) { + init(StringToks, NumStringToks); + } + + bool hadError; bool AnyWide; bool Pascal; @@ -163,8 +177,13 @@ public: /// getOffsetOfStringByte - This function returns the offset of the /// specified byte of the string data represented by Token. This handles /// advancing over escape sequences in the string. - static unsigned getOffsetOfStringByte(const Token &TheTok, unsigned ByteNo, - Preprocessor &PP, bool Complain = true); + /// + /// If the Diagnostics pointer is non-null, then this will do semantic + /// checking of the string literal and emit errors and warnings. + unsigned getOffsetOfStringByte(const Token &TheTok, unsigned ByteNo) const; + +private: + void init(const Token *StringToks, unsigned NumStringToks); }; } // end namespace clang |