diff --git a/src/Agent/NewRelic/Home/Home.csproj b/src/Agent/NewRelic/Home/Home.csproj
index d14d4762ed..23388021b8 100644
--- a/src/Agent/NewRelic/Home/Home.csproj
+++ b/src/Agent/NewRelic/Home/Home.csproj
@@ -13,7 +13,7 @@
-
+
diff --git a/src/Agent/NewRelic/Profiler/Common/CorStandIn.h b/src/Agent/NewRelic/Profiler/Common/CorStandIn.h
index ae80eab51a..0cfc09a524 100644
--- a/src/Agent/NewRelic/Profiler/Common/CorStandIn.h
+++ b/src/Agent/NewRelic/Profiler/Common/CorStandIn.h
@@ -3,8 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/
#pragma warning(push)
-// Since this isn't our code, we don't want to mess with it. These warnings can be safely ignored.
-#pragma warning(disable: 4458) // Scope hides class member with same name.
-#pragma warning(disable: 26495) // Uninitialized member variable, even if it's always set before use.
+#pragma warning(disable : 4458)
#include
#pragma warning(pop)
diff --git a/src/Agent/NewRelic/Profiler/Configuration/Configuration.h b/src/Agent/NewRelic/Profiler/Configuration/Configuration.h
index 8fbe4a3677..14e816327a 100644
--- a/src/Agent/NewRelic/Profiler/Configuration/Configuration.h
+++ b/src/Agent/NewRelic/Profiler/Configuration/Configuration.h
@@ -47,10 +47,10 @@ namespace NewRelic { namespace Profiler { namespace Configuration {
, _ignoreList(new IgnoreInstrumentationList())
{
try {
- auto globalNewRelicConfigurationDocument = std::make_shared>();
- globalNewRelicConfigurationDocument->parse(const_cast(globalNewRelicConfiguration.c_str()));
+ rapidxml::xml_document globalNewRelicConfigurationDocument;
+ globalNewRelicConfigurationDocument.parse(const_cast(globalNewRelicConfiguration.c_str()));
- auto globalNewRelicConfigurationNode = GetConfigurationNode(globalNewRelicConfigurationDocument);
+ auto globalNewRelicConfigurationNode = GetConfigurationNode(globalNewRelicConfigurationDocument);
if (globalNewRelicConfigurationNode == nullptr)
{
LogError(L"Unable to locate configuration node in the global newrelic.config file.");
@@ -58,13 +58,13 @@ namespace NewRelic { namespace Profiler { namespace Configuration {
}
auto appliedNewRelicConfigurationNode = globalNewRelicConfigurationNode;
- auto localNewRelicConfigurationDocument = std::make_shared>();
if (localNewRelicConfiguration.second)
{
try
{
- localNewRelicConfigurationDocument->parse(const_cast(localNewRelicConfiguration.first.c_str()));
+ rapidxml::xml_document localNewRelicConfigurationDocument;
+ localNewRelicConfigurationDocument.parse(const_cast(localNewRelicConfiguration.first.c_str()));
auto localNewRelicConfigurationNode = GetConfigurationNode(localNewRelicConfigurationDocument);
if (localNewRelicConfigurationNode == nullptr)
@@ -92,7 +92,7 @@ namespace NewRelic { namespace Profiler { namespace Configuration {
SetLogLevel(appliedNewRelicConfigurationNode);
SetInstrumentationData(appliedNewRelicConfigurationNode);
SetApplicationPools(appliedNewRelicConfigurationNode);
-
+
} catch (const rapidxml::parse_error& exception) {
// We log two separate error messages here because sometimes the logging macros hang when
// logging the "where" contents
@@ -196,15 +196,15 @@ namespace NewRelic { namespace Profiler { namespace Configuration {
return _logLevel;
}
- bool GetConsoleLogging() const
+ bool GetConsoleLogging()
{
return _consoleLogging;
}
- bool GetLoggingEnabled() const
+ bool GetLoggingEnabled()
{
return _loggingEnabled;
}
- IgnoreInstrumentationListPtr GetIgnoreInstrumentationList() const
+ IgnoreInstrumentationListPtr GetIgnoreInstrumentationList()
{
return _ignoreList;
}
@@ -224,9 +224,9 @@ namespace NewRelic { namespace Profiler { namespace Configuration {
std::shared_ptr _systemCalls;
IgnoreInstrumentationListPtr _ignoreList;
- rapidxml::xml_node* GetConfigurationNode(const std::shared_ptr> document)
+ rapidxml::xml_node* GetConfigurationNode(const rapidxml::xml_document& document)
{
- auto configurationNode = document->first_node(_X("configuration"), 0, false);
+ auto configurationNode = document.first_node(_X("configuration"), 0, false);
if (configurationNode == nullptr) {
return nullptr;
}
@@ -294,7 +294,7 @@ namespace NewRelic { namespace Profiler { namespace Configuration {
_logLevel = TryParseLogLevel(level);
}
- Logger::Level TryParseLogLevel(const xstring_t& logText) const
+ Logger::Level TryParseLogLevel(const xstring_t& logText)
{
if (Strings::AreEqualCaseInsensitive(logText, _X("off"))) {
return Logger::Level::LEVEL_ERROR;
@@ -423,8 +423,8 @@ namespace NewRelic { namespace Profiler { namespace Configuration {
if (applicationConfiguration.empty())
return;
- auto document = std::make_shared>();
- document->parse(const_cast(applicationConfiguration.c_str()));
+ rapidxml::xml_document document;
+ document.parse(const_cast(applicationConfiguration.c_str()));
auto configurationNode = GetConfigurationNode(document);
auto appSettingsNode = configurationNode->first_node(_X("appSettings"), 0, false);
@@ -468,7 +468,7 @@ namespace NewRelic { namespace Profiler { namespace Configuration {
static bool IsProcessInProcessList(const ProcessesPtr& processes, const xstring_t& processName)
{
// check the processes loaded from configuration
- for (auto& validProcessName : *processes) {
+ for (auto validProcessName : *processes) {
if (Strings::EndsWith(processName, validProcessName)) {
return true;
}
@@ -498,7 +498,7 @@ namespace NewRelic { namespace Profiler { namespace Configuration {
return isIis;
}
- bool ShouldInstrumentApplicationPool(const xstring_t& appPoolId) const
+ bool ShouldInstrumentApplicationPool(const xstring_t& appPoolId)
{
if (ApplicationPoolIsOnBlackList(appPoolId, _applicationPoolsBlackList)) {
LogInfo(_X("This application pool (") + appPoolId + _X(") is explicitly configured to NOT be instrumented."));
diff --git a/src/Agent/NewRelic/Profiler/Configuration/IgnoreInstrumentation.h b/src/Agent/NewRelic/Profiler/Configuration/IgnoreInstrumentation.h
index a98f68e09b..98438898bf 100644
--- a/src/Agent/NewRelic/Profiler/Configuration/IgnoreInstrumentation.h
+++ b/src/Agent/NewRelic/Profiler/Configuration/IgnoreInstrumentation.h
@@ -50,7 +50,7 @@ namespace NewRelic { namespace Profiler { namespace Configuration
}
private:
- bool Matches(xstring_t assembly, xstring_t className) const
+ bool Matches(xstring_t assembly, xstring_t className)
{
if (!Strings::AreEqualCaseInsensitive(AssemblyName, assembly))
{
diff --git a/src/Agent/NewRelic/Profiler/Configuration/InstrumentationConfiguration.h b/src/Agent/NewRelic/Profiler/Configuration/InstrumentationConfiguration.h
index bcc6fbeeb4..8678606da5 100644
--- a/src/Agent/NewRelic/Profiler/Configuration/InstrumentationConfiguration.h
+++ b/src/Agent/NewRelic/Profiler/Configuration/InstrumentationConfiguration.h
@@ -33,7 +33,7 @@ namespace NewRelic { namespace Profiler { namespace Configuration
, _foundServerlessInstrumentationPoint(false)
{
// pull instrumentation points from every xml string
- for (auto& instrumentationXml : *instrumentationXmls)
+ for (auto instrumentationXml : *instrumentationXmls)
{
try
{
@@ -64,13 +64,13 @@ namespace NewRelic { namespace Profiler { namespace Configuration
, _systemCalls(nullptr)
, _foundServerlessInstrumentationPoint(false)
{
- for (auto& instrumentationPoint : *instrumentationPoints)
+ for (auto instrumentationPoint : *instrumentationPoints)
{
AddInstrumentationPointToCollectionsIfNotIgnored(instrumentationPoint);
}
}
- uint16_t GetInvalidFileCount() const
+ uint16_t GetInvalidFileCount()
{
return _invalidFileCount;
}
@@ -100,7 +100,7 @@ namespace NewRelic { namespace Profiler { namespace Configuration
// We may have multiple matching instrumentation points that target different assembly versions. See if we can find one that meets
// the version requirements
AssemblyVersion foundVersion(function->GetAssemblyProps());
- for (auto& instPoint : instPoints)
+ for (auto instPoint : instPoints)
{
if ((instPoint->MinVersion != nullptr) && (foundVersion < *instPoint->MinVersion))
{
@@ -236,9 +236,9 @@ namespace NewRelic { namespace Profiler { namespace Configuration
void GetInstrumentationPoints(xstring_t instrumentationXml)
{
- auto document = std::make_shared>();
- document->parse(const_cast(instrumentationXml.c_str()));
- auto extensionNode = document->first_node(_X("extension"), 0, false);
+ rapidxml::xml_document document;
+ document.parse(const_cast(instrumentationXml.c_str()));
+ auto extensionNode = document.first_node(_X("extension"), 0, false);
if (extensionNode == nullptr)
{
LogWarn(L"extension node not found in instrumentation file. Please validate your instrumentation files against extensions/extension.xsd or contact New Relic support.");
@@ -405,7 +405,7 @@ namespace NewRelic { namespace Profiler { namespace Configuration
// if the ClassName includes multiple classes, we have to split this into multiple instrumentation points
auto instrumentationPoints = SplitInstrumentationPointsOnClassNames(instrumentationPoint);
- for (auto& iPoint : instrumentationPoints) {
+ for (auto iPoint : instrumentationPoints) {
// finally add the new instrumentation point(s) to our set of instrumentation points
// Note that there may be "duplicated" instrumentation points that target different assembly versions
diff --git a/src/Agent/NewRelic/Profiler/Configuration/InstrumentationPoint.h b/src/Agent/NewRelic/Profiler/Configuration/InstrumentationPoint.h
index 7a08d71e06..17363d4938 100644
--- a/src/Agent/NewRelic/Profiler/Configuration/InstrumentationPoint.h
+++ b/src/Agent/NewRelic/Profiler/Configuration/InstrumentationPoint.h
@@ -52,7 +52,7 @@ namespace NewRelic { namespace Profiler { namespace Configuration
ParametersMatch(other);
}
- xstring_t ToString() const
+ xstring_t ToString()
{
if (Parameters == nullptr)
{
@@ -63,7 +63,7 @@ namespace NewRelic { namespace Profiler { namespace Configuration
}
}
- xstring_t GetMatchKey() const
+ xstring_t GetMatchKey()
{
return Parameters == nullptr
? GetMatchKey(AssemblyName, ClassName, MethodName)
@@ -82,7 +82,7 @@ namespace NewRelic { namespace Profiler { namespace Configuration
private:
- bool ParametersMatch(const InstrumentationPoint& other) const
+ bool ParametersMatch(const InstrumentationPoint& other)
{
// nullptr means no parameters attribute was supplied in configuration, suggesting that we should instrument all overloads
if (this->Parameters == nullptr)
diff --git a/src/Agent/NewRelic/Profiler/MethodRewriter/ExceptionHandlerManipulator.h b/src/Agent/NewRelic/Profiler/MethodRewriter/ExceptionHandlerManipulator.h
index f955ad9eee..ce5ef9f520 100644
--- a/src/Agent/NewRelic/Profiler/MethodRewriter/ExceptionHandlerManipulator.h
+++ b/src/Agent/NewRelic/Profiler/MethodRewriter/ExceptionHandlerManipulator.h
@@ -262,12 +262,12 @@ namespace NewRelic { namespace Profiler { namespace MethodRewriter
// shift the original clauses up to the correct
for (uint32_t i = 0; i < _originalExceptionClauseCount; ++i)
{
- auto& clause = _exceptionClauses[i];
+ auto clause = _exceptionClauses[i];
clause->ShiftOffsets(userCodeOffset);
}
// append the clauses
- for (auto& clause : _exceptionClauses)
+ for (auto clause : _exceptionClauses)
{
auto clauseBytes = clause->GetBytes();
bytes->insert(bytes->end(), clauseBytes->begin(), clauseBytes->end());
@@ -276,7 +276,7 @@ namespace NewRelic { namespace Profiler { namespace MethodRewriter
return bytes;
}
- uint32_t GetOriginalExceptionClauseCount() const
+ uint32_t GetOriginalExceptionClauseCount()
{
return _originalExceptionClauseCount;
}
diff --git a/src/Agent/NewRelic/Profiler/MethodRewriter/FunctionManipulator.h b/src/Agent/NewRelic/Profiler/MethodRewriter/FunctionManipulator.h
index 81bfbccfd8..56bbaf3683 100644
--- a/src/Agent/NewRelic/Profiler/MethodRewriter/FunctionManipulator.h
+++ b/src/Agent/NewRelic/Profiler/MethodRewriter/FunctionManipulator.h
@@ -350,7 +350,7 @@ namespace NewRelic { namespace Profiler { namespace MethodRewriter
_instructions->Append(CEE_NEWARR, _X("[mscorlib]System.Object"));
uint32_t index = 0;
- for (auto& func : elementLoadLambdas)
+ for (auto func : elementLoadLambdas)
{
auto nextIndex = index++;
// get an extra copy of the array (it will be popped off the stack each time we add an element to it)
diff --git a/src/Agent/NewRelic/Profiler/MethodRewriter/InstructionSet.h b/src/Agent/NewRelic/Profiler/MethodRewriter/InstructionSet.h
index 77592897b9..0b4493dd2d 100644
--- a/src/Agent/NewRelic/Profiler/MethodRewriter/InstructionSet.h
+++ b/src/Agent/NewRelic/Profiler/MethodRewriter/InstructionSet.h
@@ -403,7 +403,7 @@ namespace NewRelic { namespace Profiler { namespace MethodRewriter
void AppendTryEnd()
{
- auto& exception = _exceptionStack.top();
+ auto exception = _exceptionStack.top();
if (exception->_tryLength != 0)
{
LogError(L"Attempted to set try close on the same exception twice.");
@@ -414,7 +414,7 @@ namespace NewRelic { namespace Profiler { namespace MethodRewriter
void AppendCatchStart(uint32_t typeToken)
{
- auto& exception = _exceptionStack.top();
+ auto exception = _exceptionStack.top();
if (exception->_handlerOffset != 0)
{
LogError(L"Attempted to set catch start on the same exception twice.");
@@ -439,7 +439,7 @@ namespace NewRelic { namespace Profiler { namespace MethodRewriter
void AppendCatchEnd()
{
- auto& exception = _exceptionStack.top();
+ auto exception = _exceptionStack.top();
if (exception->_handlerLength != 0)
{
LogError(L"Attempted to set catch end on the same exception twice.");
diff --git a/src/Agent/NewRelic/Profiler/MethodRewriter/InstrumentFunctionManipulator.h b/src/Agent/NewRelic/Profiler/MethodRewriter/InstrumentFunctionManipulator.h
index 5e90471b93..1a11be8a7e 100644
--- a/src/Agent/NewRelic/Profiler/MethodRewriter/InstrumentFunctionManipulator.h
+++ b/src/Agent/NewRelic/Profiler/MethodRewriter/InstrumentFunctionManipulator.h
@@ -16,10 +16,7 @@ namespace NewRelic { namespace Profiler { namespace MethodRewriter
public:
InstrumentFunctionManipulator(IFunctionPtr function, InstrumentationSettingsPtr instrumentationSettings) :
FunctionManipulator(function),
- _instrumentationSettings(instrumentationSettings),
- _userExceptionLocalIndex(0),
- _resultLocalIndex(0),
- _tracerLocalIndex(0)
+ _instrumentationSettings(instrumentationSettings)
{
if (_function->Preprocess()) {
Initialize();
@@ -231,4 +228,4 @@ namespace NewRelic { namespace Profiler { namespace MethodRewriter
_resultLocalIndex = AppendReturnTypeLocal(_newLocalVariablesSignature, _methodSignature);
}
};
-}}}
+}}}
\ No newline at end of file
diff --git a/src/Agent/NewRelic/Profiler/MethodRewriter/MethodRewriter.h b/src/Agent/NewRelic/Profiler/MethodRewriter/MethodRewriter.h
index 1f05a83204..3dd98229d7 100644
--- a/src/Agent/NewRelic/Profiler/MethodRewriter/MethodRewriter.h
+++ b/src/Agent/NewRelic/Profiler/MethodRewriter/MethodRewriter.h
@@ -54,7 +54,7 @@ namespace NewRelic { namespace Profiler { namespace MethodRewriter {
auto instrumentationPoints = _instrumentationConfiguration->GetInstrumentationPoints();
- for (auto& instrumentationPoint : *instrumentationPoints) {
+ for (auto instrumentationPoint : *instrumentationPoints) {
_instrumentedAssemblies->emplace(instrumentationPoint->AssemblyName);
_instrumentedFunctionNames->emplace(instrumentationPoint->MethodName);
@@ -74,7 +74,7 @@ namespace NewRelic { namespace Profiler { namespace MethodRewriter {
std::set GetAssemblyInstrumentation(xstring_t assemblyName)
{
std::set set;
- for (auto& instrumentationPoint : *_instrumentationConfiguration->GetInstrumentationPoints().get()) {
+ for (auto instrumentationPoint : *_instrumentationConfiguration->GetInstrumentationPoints().get()) {
if (assemblyName == instrumentationPoint->AssemblyName) {
set.emplace(instrumentationPoint);
}
diff --git a/src/Agent/NewRelic/Profiler/ModuleInjector/ModuleInjector.h b/src/Agent/NewRelic/Profiler/ModuleInjector/ModuleInjector.h
index 3fa8619ae9..5217285b75 100644
--- a/src/Agent/NewRelic/Profiler/ModuleInjector/ModuleInjector.h
+++ b/src/Agent/NewRelic/Profiler/ModuleInjector/ModuleInjector.h
@@ -10,7 +10,6 @@
#include "../Logging/Logger.h"
#include "../Sicily/Sicily.h"
#include "IModule.h"
-#include "../Profiler/Exceptions.h"
namespace NewRelic { namespace Profiler { namespace ModuleInjector
{
diff --git a/src/Agent/NewRelic/Profiler/Profiler/CorProfilerCallbackImpl.h b/src/Agent/NewRelic/Profiler/Profiler/CorProfilerCallbackImpl.h
index 268b107e71..aeaf684641 100644
--- a/src/Agent/NewRelic/Profiler/Profiler/CorProfilerCallbackImpl.h
+++ b/src/Agent/NewRelic/Profiler/Profiler/CorProfilerCallbackImpl.h
@@ -574,7 +574,7 @@ namespace NewRelic { namespace Profiler {
std::shared_ptr> GroupByAssemblyName(Configuration::InstrumentationPointSetPtr allInstrumentationPoints)
{
std::shared_ptr> instrumentationPointsByAssembly = std::make_shared>();
- for (auto& point : *allInstrumentationPoints) {
+ for (auto point : *allInstrumentationPoints) {
Configuration::InstrumentationPointSetPtr instrumentationPoints;
auto it = instrumentationPointsByAssembly->find(point->AssemblyName);
@@ -632,7 +632,7 @@ namespace NewRelic { namespace Profiler {
auto instrumentationXmls = GetInstrumentationXmlsFromDisk(_systemCalls);
auto customXml = _customInstrumentation.GetCustomInstrumentationXml();
- for (auto& xmlPair : *customXml) {
+ for (auto xmlPair : *customXml) {
(*instrumentationXmls)[xmlPair.first] = xmlPair.second;
}
@@ -683,7 +683,7 @@ namespace NewRelic { namespace Profiler {
{
auto oldIter = instrumentationByAssembly->find(assemblyName);
if (oldIter != instrumentationByAssembly->end()) {
- auto& points = oldIter->second;
+ auto points = oldIter->second;
return GetMethodDefs(moduleId, points);
}
@@ -789,15 +789,12 @@ namespace NewRelic { namespace Profiler {
ModuleID* moduleIds = new ModuleID[numberMethods];
mdMethodDef* methodIds = new mdMethodDef[numberMethods];
-#pragma warning(push)
-#pragma warning(disable : 6386) // Not possible to overrun the buffer since we're using the set size
int i = 0;
for (auto methodDef : *methodSet) {
moduleIds[i] = moduleId;
methodIds[i] = methodDef;
i++;
}
-#pragma warning(pop)
func(numberMethods, moduleIds, methodIds);
@@ -882,7 +879,7 @@ namespace NewRelic { namespace Profiler {
bool _isCoreClr = false;
- MethodRewriter::MethodRewriterPtr GetMethodRewriter() const
+ MethodRewriter::MethodRewriterPtr GetMethodRewriter()
{
return std::atomic_load(&_methodRewriter);
}
@@ -945,7 +942,7 @@ namespace NewRelic { namespace Profiler {
auto filePaths = GetXmlFilesInExtensionsDirectory(systemCalls);
- for (auto& filePath : filePaths) {
+ for (auto filePath : filePaths) {
instrumentationXmls->emplace(filePath, ReadFile(filePath));
}
@@ -1261,7 +1258,7 @@ namespace NewRelic { namespace Profiler {
struct LANGANDCODEPAGE {
WORD wLanguage;
WORD wCodePage;
- } *lpTranslate = nullptr;
+ } * lpTranslate;
//xstring_t expectedProductName = _X("New Relic .NET CoreCLR Agent");
@@ -1280,7 +1277,7 @@ namespace NewRelic { namespace Profiler {
if (VerQueryValue(versionInfo, (LPTSTR)szSFI, (LPVOID*)&lpszBuf, &uLen)) {
if (expectedProductName == lpszBuf) {
- void* block = nullptr;
+ void* block;
UINT blockSize;
if (VerQueryValue(versionInfo, L"\\", (LPVOID*)&block, &blockSize)) {
auto fileInfo = (VS_FIXEDFILEINFO*)block;
diff --git a/src/Agent/NewRelic/Profiler/Profiler/CorTokenResolver.h b/src/Agent/NewRelic/Profiler/Profiler/CorTokenResolver.h
index b3db943938..10d7d719d5 100644
--- a/src/Agent/NewRelic/Profiler/Profiler/CorTokenResolver.h
+++ b/src/Agent/NewRelic/Profiler/Profiler/CorTokenResolver.h
@@ -42,7 +42,7 @@ namespace NewRelic { namespace Profiler
xstring_t GetTypeStringsFromTypeSpec(uint32_t typeDefOrRefOrSpecToken)
{
- uint8_t* signature = 0;
+ uint8_t* signature;
ULONG signatureLength;
_metaDataImport->GetTypeSpecFromToken(typeDefOrRefOrSpecToken, (PCCOR_SIGNATURE*)(&signature), &signatureLength);
diff --git a/src/Agent/NewRelic/Profiler/Profiler/CorTokenizer.h b/src/Agent/NewRelic/Profiler/Profiler/CorTokenizer.h
index f1487fcc90..9b43baa352 100644
--- a/src/Agent/NewRelic/Profiler/Profiler/CorTokenizer.h
+++ b/src/Agent/NewRelic/Profiler/Profiler/CorTokenizer.h
@@ -304,7 +304,7 @@ namespace NewRelic { namespace Profiler
xstring_t ResolveAssemblyForType(xstring_t assemblyName, xstring_t fullQualifiedType)
{
- auto& coreAssembly = (*_typeNameToAssembly.get())[fullQualifiedType];
+ auto coreAssembly = (*_typeNameToAssembly.get())[fullQualifiedType];
return coreAssembly.empty() ? assemblyName : coreAssembly;
}
};
diff --git a/src/Agent/NewRelic/Profiler/Profiler/Function.h b/src/Agent/NewRelic/Profiler/Profiler/Function.h
index c9f8738144..fc586e8eeb 100644
--- a/src/Agent/NewRelic/Profiler/Profiler/Function.h
+++ b/src/Agent/NewRelic/Profiler/Profiler/Function.h
@@ -431,7 +431,7 @@ namespace NewRelic { namespace Profiler
return _functionId;
}
- ModuleID GetModuleID() const
+ ModuleID GetModuleID()
{
return _moduleId;
}
@@ -536,7 +536,7 @@ namespace NewRelic { namespace Profiler
virtual ByteVectorPtr GetSignatureFromToken(mdToken token) override
{
ULONG signatureLength;
- uint8_t* signature = 0;
+ uint8_t* signature;
ThrowOnError(_metaDataImport->GetSigFromToken, token, (PCCOR_SIGNATURE*)&signature, &signatureLength);
return std::make_shared(signature, signature + signatureLength);
}
diff --git a/src/Agent/NewRelic/Profiler/Profiler/FunctionHeaderInfo.h b/src/Agent/NewRelic/Profiler/Profiler/FunctionHeaderInfo.h
index eeed2436fb..053a53afde 100644
--- a/src/Agent/NewRelic/Profiler/Profiler/FunctionHeaderInfo.h
+++ b/src/Agent/NewRelic/Profiler/Profiler/FunctionHeaderInfo.h
@@ -68,7 +68,7 @@ namespace NewRelic {
else if (info->instruction == CEE_SWITCH) {
counts.switchCount += 1;
const unsigned numberArms = ReadNumber(&bodyBytes[pos + 1], 4) & 0xFFFFFFFF;
- const unsigned numberBytesTable = (1 + static_cast(numberArms)) * sizeof(DWORD);
+ const unsigned numberBytesTable = (1 + numberArms) * sizeof(DWORD);
const unsigned totalBytesInstruction = 1 + numberBytesTable;
pos += totalBytesInstruction;
}
@@ -209,4 +209,4 @@ namespace NewRelic {
}
}
}
-}
+}
\ No newline at end of file
diff --git a/src/Agent/NewRelic/Profiler/Profiler/FunctionPreprocessor.h b/src/Agent/NewRelic/Profiler/Profiler/FunctionPreprocessor.h
index a5bc8db7e1..da9f78c57c 100644
--- a/src/Agent/NewRelic/Profiler/Profiler/FunctionPreprocessor.h
+++ b/src/Agent/NewRelic/Profiler/Profiler/FunctionPreprocessor.h
@@ -140,15 +140,15 @@ namespace NewRelic {
}
}
- OpCodePtr GetOpCode() const
+ OpCodePtr GetOpCode()
{
return _opcode;
}
- unsigned GetOffset() const
+ unsigned GetOffset()
{
return _offset;
}
- bool IsValid() const
+ bool IsValid()
{
return _valid;
}
@@ -177,7 +177,7 @@ namespace NewRelic {
{
auto offsetOfInstructionFollowingSwitch = _offset + _opcode->totalSize;
auto offsetOfArm = _offset + _opcode->instructionSize + sizeof(DWORD);
- for (auto& target : *_targets) {
+ for (auto target : *_targets) {
auto jumpLength = target->GetOffset() - offsetOfInstructionFollowingSwitch;
auto armLocation = instructions->data() + offsetOfArm;
@@ -193,7 +193,7 @@ namespace NewRelic {
{
// a better person would do this in place but the iter pointer stuff confuses me
auto newTargetsList = std::make_shared>();
- for (auto& targetInstruction : *_targets) {
+ for (auto targetInstruction : *_targets) {
if (oldInstruction == targetInstruction)
{
newTargetsList->push_back(newInstruction);
@@ -232,14 +232,11 @@ namespace NewRelic {
class BranchInstruction :public Instruction
{
public:
- BranchInstruction(OpCodePtr opCode, unsigned offset) : Instruction(opCode, offset),
- _targetInstruction(nullptr),
- _targetOffset(0)
+ BranchInstruction(OpCodePtr opCode, unsigned offset) : Instruction(opCode, offset)
{
}
- BranchInstruction(OpCodePtr opCode, unsigned offset, InstructionPtr target) : Instruction(opCode, offset),
- _targetOffset(0)
+ BranchInstruction(OpCodePtr opCode, unsigned offset, InstructionPtr target) : Instruction(opCode, offset)
{
_targetInstruction = target;
}
@@ -387,7 +384,7 @@ namespace NewRelic {
}
// sanity check the final instruction. If it isn't a RET, we likely mucked up the instruction parsing
- auto& lastInstruction = instructions->at(finalInstructionIndex);
+ auto lastInstruction = instructions->at(finalInstructionIndex);
if (lastInstruction->GetOpCode()->instruction != CEE_RET) {
LogTrace(L"Expected RET as final instruction but found ", lastInstruction->GetOpCode()->instruction);
return nullptr;
@@ -399,7 +396,7 @@ namespace NewRelic {
lastInstruction->GetOpCode()->Reset(GetOpCode(CEE_NOP));
auto branches = std::make_shared>();
- for (auto& instruction : *instructions.get())
+ for (auto instruction : *instructions.get())
{
if (instruction.second->GetOpCode()->instruction == CEE_RET)
{
@@ -435,14 +432,14 @@ namespace NewRelic {
// write the instructions into our bytecode vector. that'll reset the offsets
// of the instructions so that we can recompute the branch jumps.
- for (auto& instruction : *instructions.get())
+ for (auto instruction : *instructions.get())
{
instruction.second->Write(oldCodeBytes, newByteCode);
}
// now all instructions contain their final offset, so we can
// write the branch instruction offsets
- for (auto& branch : *branches) {
+ for (auto branch : *branches) {
branch->WriteBranches(newByteCode, instructions);
}
@@ -484,7 +481,7 @@ namespace NewRelic {
static void NotifyOfInstructionChange(OffsetToInstructionMapPtr instructions, InstructionPtr oldInstruction, InstructionPtr newInstruction)
{
- for (auto& iter : *instructions)
+ for (auto iter : *instructions)
{
iter.second->OnInstructionChange(oldInstruction, newInstruction);
}
@@ -492,7 +489,7 @@ namespace NewRelic {
static bool AllValid(OffsetToInstructionMapPtr instructions)
{
- for (auto& instruction : *instructions.get())
+ for (auto instruction : *instructions.get())
{
if (!instruction.second->IsValid()) {
return false;
@@ -530,7 +527,7 @@ namespace NewRelic {
static void PrintInstructions(OffsetToInstructionMapPtr instructions)
{
#ifdef DEBUG
- for (auto& iter : *instructions.get())
+ for (auto iter : *instructions.get())
{
LogInfo(iter.second->ToString());
}
@@ -606,23 +603,23 @@ namespace NewRelic {
for (unsigned c = 0; c < sehClauseCount; c++) {
COR_ILMETHOD_SECT_EH_CLAUSE_FAT* clause = &sehClauses[c];
- auto& tryInstruction = instructions->at(clause->TryOffset);
+ auto tryInstruction = instructions->at(clause->TryOffset);
//unsigned newTryLength = _oldPositionToNew[clause->TryOffset + clause->TryLength] - _oldPositionToNew[clause->TryOffset];
- auto& tryEndInstruction = instructions->at(clause->TryOffset + clause->TryLength);
+ auto tryEndInstruction = instructions->at(clause->TryOffset + clause->TryLength);
auto tryLength = tryEndInstruction->GetOffset() - tryInstruction->GetOffset();
clause->SetTryLength(tryLength);
clause->SetTryOffset(tryInstruction->GetOffset());
- auto& handlerInstruction = instructions->at(clause->HandlerOffset);
- auto& handlerEndInstruction = instructions->at(clause->HandlerOffset + clause->HandlerLength);
+ auto handlerInstruction = instructions->at(clause->HandlerOffset);
+ auto handlerEndInstruction = instructions->at(clause->HandlerOffset + clause->HandlerLength);
auto handlerLength = handlerEndInstruction->GetOffset() - handlerInstruction->GetOffset();
clause->SetHandlerLength(handlerLength);
clause->SetHandlerOffset(handlerInstruction->GetOffset());
if (clause->GetFlags() == static_cast(COR_ILEXCEPTION_CLAUSE_FILTER)) {
- auto& filterInstruction = instructions->at(clause->FilterOffset);
+ auto filterInstruction = instructions->at(clause->FilterOffset);
clause->SetFilterOffset(filterInstruction->GetOffset());
// There's no FilterLength to adjust.
@@ -671,7 +668,7 @@ namespace NewRelic {
}
// resolve the target instruction(s) of all branches
- for (auto& instruction : *branches)
+ for (auto instruction : *branches)
{
instruction->ResolveTargets(methodBody, instructions);
}
diff --git a/src/Agent/NewRelic/Profiler/Profiler/OpCodes.h b/src/Agent/NewRelic/Profiler/Profiler/OpCodes.h
index b10a396f25..f517e123be 100644
--- a/src/Agent/NewRelic/Profiler/Profiler/OpCodes.h
+++ b/src/Agent/NewRelic/Profiler/Profiler/OpCodes.h
@@ -96,16 +96,6 @@ namespace NewRelic {
unsigned controlFlow;
xstring_t name;
- OpCode() :
- instruction(0),
- instructionSize(0),
- arrayOffset(0),
- operandSize(0),
- totalSize(0),
- controlFlow(0)
- {}
-
-
void Reset(std::shared_ptr newOpCode)
{
instruction = newOpCode->instruction;
@@ -156,4 +146,4 @@ namespace NewRelic {
return GetOpCode((const BYTE*)&opcode, 0);
}
}
-}
+}
\ No newline at end of file
diff --git a/src/Agent/NewRelic/Profiler/Profiler/SystemCalls.h b/src/Agent/NewRelic/Profiler/Profiler/SystemCalls.h
index 1b42439c68..fde2daed3f 100644
--- a/src/Agent/NewRelic/Profiler/Profiler/SystemCalls.h
+++ b/src/Agent/NewRelic/Profiler/Profiler/SystemCalls.h
@@ -44,7 +44,7 @@ namespace NewRelic { namespace Profiler
static std::unique_ptr TryGetRegistryStringValue(HKEY rootKey, const xstring_t& path, const xstring_t& valueName)
{
- DWORD valueSize = 0;
+ DWORD valueSize;
CRegKey key;
// open the key
diff --git a/src/Agent/NewRelic/Profiler/Profiler/stdafx.h b/src/Agent/NewRelic/Profiler/Profiler/stdafx.h
index 654b5cccbf..7f16e03b1e 100644
--- a/src/Agent/NewRelic/Profiler/Profiler/stdafx.h
+++ b/src/Agent/NewRelic/Profiler/Profiler/stdafx.h
@@ -33,10 +33,7 @@
// Profiler Header Files:
-#pragma warning(push)
-#pragma warning(disable: 26495) // Uninitialized member variable, even if it's always set before use
#include
-#pragma warning(pop)
// Windows Header Files:
#ifndef _WIN32_WINNT
diff --git a/src/Agent/NewRelic/Profiler/RapidXML/rapidxml.hpp b/src/Agent/NewRelic/Profiler/RapidXML/rapidxml.hpp
index 59cba658fe..a63f265fb6 100644
--- a/src/Agent/NewRelic/Profiler/RapidXML/rapidxml.hpp
+++ b/src/Agent/NewRelic/Profiler/RapidXML/rapidxml.hpp
@@ -658,8 +658,6 @@ namespace rapidxml
: m_name(0)
, m_value(0)
, m_parent(0)
- , m_name_size(0)
- , m_value_size(0)
{
}
@@ -809,9 +807,7 @@ namespace rapidxml
//! Constructs an empty attribute with the specified type.
//! Consider using memory_pool of appropriate xml_document if allocating attributes manually.
- xml_attribute() :
- m_prev_attribute(nullptr),
- m_next_attribute(nullptr)
+ xml_attribute()
{
}
@@ -906,10 +902,6 @@ namespace rapidxml
: m_type(type)
, m_first_node(0)
, m_first_attribute(0)
- , m_last_node(0)
- , m_last_attribute(0)
- , m_prev_sibling(0)
- , m_next_sibling(0)
{
}
diff --git a/src/Agent/NewRelic/Profiler/SignatureParser/Types.h b/src/Agent/NewRelic/Profiler/SignatureParser/Types.h
index b6b1f02df8..e5cf551622 100644
--- a/src/Agent/NewRelic/Profiler/SignatureParser/Types.h
+++ b/src/Agent/NewRelic/Profiler/SignatureParser/Types.h
@@ -475,7 +475,7 @@ namespace NewRelic { namespace Profiler { namespace SignatureParser
stream += _type->ToString(tokenResolver);
stream.push_back('[');
bool first = true;
- for (auto& genericArgumentType : *_genericArgumentTypes)
+ for (auto genericArgumentType : *_genericArgumentTypes)
{
if (first) first = false;
else stream.push_back(',');
@@ -493,7 +493,7 @@ namespace NewRelic { namespace Profiler { namespace SignatureParser
bytes->push_back(ELEMENT_TYPE_GENERICINST);
bytes->insert(bytes->end(), typeBytes->begin(), typeBytes->end());
bytes->insert(bytes->end(), compressedArgCount->begin(), compressedArgCount->end());
- for (auto& argumentType : *_genericArgumentTypes)
+ for (auto argumentType : *_genericArgumentTypes)
{
auto argumentTypeBytes = argumentType->ToBytes();
bytes->insert(bytes->end(), argumentTypeBytes->begin(), argumentTypeBytes->end());
@@ -801,11 +801,11 @@ namespace NewRelic { namespace Profiler { namespace SignatureParser
_genericParamCount(genericParamCount)
{}
- xstring_t ToString(ITokenResolverPtr tokenResolver) const
+ xstring_t ToString(ITokenResolverPtr tokenResolver)
{
auto stream = xstring_t();
bool firstParam = true;
- for (auto& parameter : *_parameters)
+ for (auto parameter : *_parameters)
{
if (firstParam) firstParam = false;
else stream.push_back(',');
@@ -836,7 +836,7 @@ namespace NewRelic { namespace Profiler { namespace SignatureParser
auto returnTypeBytes = _returnType->ToBytes();
bytes->insert(bytes->end(), returnTypeBytes->begin(), returnTypeBytes->end());
- for (auto& parameter : *_parameters)
+ for (auto parameter : *_parameters)
{
auto parameterBytes = parameter->ToBytes();
bytes->insert(bytes->end(), parameterBytes->begin(), parameterBytes->end());