Files
UnrealEngineUWP/Engine/Source/Programs/UnrealCodeAnalyzer/Private/MacroCallback.h
Matthew Griffin bb70b349ce Merging CL 2804086 from //UE4/Release-4.11 to Dev-Main (//UE4/Dev-Main) to isolate copyright update
#lockdown Nick.Penwarden

[CL 2819020 by Matthew Griffin in Main branch]
2016-01-07 08:17:16 -05:00

39 lines
1.6 KiB
C++

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
#pragma once
namespace UnrealCodeAnalyzer
{
class FMacroCallback : public clang::PPCallbacks
{
public:
FMacroCallback(clang::StringRef Filename, clang::SourceManager& SourceManager, const clang::Preprocessor& Preprocessor);
virtual void MacroExpands(const clang::Token &MacroNameTok, const clang::MacroDirective *MD, clang::SourceRange Range, const clang::MacroArgs *Args) override;
virtual void MacroDefined(const clang::Token &MacroNameTok, const clang::MacroDirective *MD) override;
virtual void If(clang::SourceLocation Loc, clang::SourceRange ConditionRange, ConditionValueKind ConditionValue) override;
virtual void Elif(clang::SourceLocation Loc, clang::SourceRange ConditionRange, ConditionValueKind ConditionValue, clang::SourceLocation IfLoc) override;
virtual void Ifdef(clang::SourceLocation Loc, const clang::Token &MacroNameTok, const clang::MacroDirective *MD) override;
virtual void Ifndef(clang::SourceLocation Loc, const clang::Token &MacroNameTok, const clang::MacroDirective *MD) override;
FPreHashedIncludeSetMap& GetIncludes()
{
return Includes;
}
private:
bool IsMacroDefinedInCommandLine(clang::StringRef Macro);
bool IsPredefinedMacro(clang::StringRef Macro);
bool FMacroCallback::IsBuiltInMacro(const clang::MacroDirective* MacroDirective);
clang::StringRef Filename;
clang::SourceManager& SourceManager;
const clang::Preprocessor& Preprocessor;
TMap<FString, FString> MacroDefinitionToFile;
FPreHashedIncludeSetMap Includes;
static ELogVerbosity::Type LogVerbosity;
};
}